Subject: pkg/30081: [PATCH] x11/gtk2 patches in defines never seen by the compiler
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <idart@performancedesign.no>
List: pkgsrc-bugs
Date: 04/28/2005 11:02:00
>Number:         30081
>Category:       pkg
>Synopsis:       [PATCH] x11/gtk2 patches in defines never seen by the compiler
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 28 11:02:00 +0000 2005
>Originator:     Idar Tollefsen
>Release:        N/A
>Organization:
Performance Design
>Environment:
Darwin fulcrum.local 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC  Power Macintosh powerpc
>Description:
x11/gtk2/patches/patch-ad replaces certain directory variables in
gtk/xdgmime/xdgmime.c with a define to pkgsrc's PREFIX directory.
x11/gtk2/Makefile then tries to define this variable by setting
it as a -D flag in CPPFLAGS.


Unfortunately, the definitions set up the Makefile are never propagated
to the command line and the build fails.

>How-To-Repeat:
Just try to build x11/gtk2.
It is possible that the problem is platform specific.
If so, try to build x11/gtk2 on OS X.

>Fix:
Altough the problem _might_ be OS X specific, the solution isn't.
Instead of trying to get the necessary define passed to the compiler
from the command line, include the definition in config.h.

Here's the patch against x11/gtk2/Makefile:
----------------------------------------------

--- Makefile.orig	Thu Apr 28 10:29:35 2005
+++ Makefile	Thu Apr 28 10:32:26 2005
@@ -48,8 +48,6 @@
 
 BUILD_DIRS=		${WRKSRC} ${WRKSRC}/demos/gtk-demo
 
-CPPFLAGS+=		-DPREFIX="\"${PREFIX}\""
-
 PRINT_PLIST_AWK+=	/^@dirrm share\/themes\/Default$$/ \
 				{ print "@unexec $${RMDIR} %D/" $$2 \
 				  " 2>/dev/null || $${TRUE}"; next; }
@@ -66,6 +64,11 @@
 .elif ${OPSYS} == "IRIX" && !empty(CC_VERSION:Mgcc*)
 USE_GNU_TOOLS+=		awk
 .endif
+
+post-configure:
+	@${ECHO} "" >> ${WRKSRC}/config.h
+	@${ECHO} "/* pkgsrc definitions. */" >> ${WRKSRC}/config.h
+	@${ECHO} "#define PREFIX \"${PREFIX}\"" >> ${WRKSRC}/config.h
 
 post-install:
 	${INSTALL_DATA_DIR} ${PREFIX}/lib/gtk-2.0/modules