grep-2.6.3 fails to build with error: CC fgrep.o kwset.c: In function 'kwsalloc': kwset.c:47: error: 'malloc' undeclared (first use in this function) kwset.c:47: error: (Each undeclared identifier is reported only once kwset.c:47: error: for each function it appears in.) make[2]: *** [kwset.o] Error 1 acorrding to http://article.gmane.org/gmane.comp.gnu.grep.bugs/3003 applying the patch works fine. Reproducible: Always Steps to Reproduce: 1. emerge grep ebuild patch: --- /home/k/benda/local/usr/portage/sys-apps/grep/grep-2.6.3.ebuild 2010-05-16 21:31:51 +0900 +++ grep-2.6.3.ebuild 2010-05-23 10:57:18 +0900 @@ -2,6 +2,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-apps/grep/grep-2.6.3.ebuild,v 1.1 2010/04/02 20:06:36 vapier Exp $ +inherit eutils + EAPI="2" DESCRIPTION="GNU regular expression matcher" @@ -19,6 +21,13 @@ DEPEND="${RDEPEND} nls? ( sys-devel/gettext )" +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}"/${PN}-2.6.3-malloc.patch +} + src_prepare() { sed -i '1i#include "../lib/progname.h"' tests/get-mb-cur-max.c ~/local/usr/local/portage/neutrino/sys-apps/grep/files$ cat grep-2.6.3-malloc.patch http://article.gmane.org/gmane.comp.gnu.grep.bugs/3003 diff --git a/src/kwset.c b/src/kwset.c index 050562e..995be79 100644 --- a/src/kwset.c +++ b/src/kwset.c @@ -40,7 +40,7 @@ #ifdef GREP # include "xalloc.h" # undef malloc -# define malloc(s) xmalloc(s) +# define malloc xmalloc #endif #define NCHAR (UCHAR_MAX + 1)
ok, I applied the patch. Few things: - If you grab a patch from upstream, make sure you directly include the upstream comments. In this case it was a git commit, so retain the hash at least. This way we can easily evaluate on a version bump whether or not it has to be dropped or should be fixed. In this case, next release of grep should have this fix included, so we can drop the patch. - Starting from EAPI=2, patches need to be applied in src_prepare. src_unpack is just for unpacking the vanilla sources, src_prepare to apply patches and other modifications. - inherit <eclass> ... needs to go *after* the EAPI= line, since they need to know what EAPI they have to provide to the ebuild. So make sure your inherit line is always next thing below the EAPI=... Nevertheless, thanks!
(In reply to comment #1) > ok, I applied the patch. Few things: > > - If you grab a patch from upstream, make sure you directly include the > upstream comments. In this case it was a git commit, so retain the hash at > least. This way we can easily evaluate on a version bump whether or not it has > to be dropped or should be fixed. In this case, next release of grep should > have this fix included, so we can drop the patch. Oh, I see. I would be careful next time. > - Starting from EAPI=2, patches need to be applied in src_prepare. src_unpack > is just for unpacking the vanilla sources, src_prepare to apply patches and > other modifications. > > - inherit <eclass> ... needs to go *after* the EAPI= line, since they need to > know what EAPI they have to provide to the ebuild. So make sure your inherit > line is always next thing below the EAPI=... Sorry I did not know these until now. I just copied the structure from grep-2.5.x.ebuild in the same subdir :)