Subject: pkg/36590: [patch] sysutils/gnome-vfs2 sets 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: 07/01/2007 21:25:00
>Number:         36590
>Category:       pkg
>Synopsis:       [patch] sysutils/gnome-vfs2 sets 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:   Sun Jul 01 21:25:00 +0000 2007
>Originator:     Idar Tollefsen
>Release:        gnome-vfs2-2.18.1nb2
>Organization:
Performance Design
>Environment:
Darwin fulcrum.performancedesign.no 8.10.0 Darwin Kernel Version 8.10.0: Wed May 23 16:50:59 PDT 2007; root:xnu-792.21.3~1/RELEASE_PPC Power Macintosh powerpc
>Description:
sysutils/gnome-vfs2 sets several defines and build options in Makefile.common and Makefile that's never seen by the compiler during build. The end result is that the build fails because it doesn't know what PREFIX is;

gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -DORBIT2=1 -I/usr/pkg/pkgsrc/sysutils/gnome-vfs2/work/.buildlink/include/glib/glib-2.0 -I/usr/pkg/pkgsrc/sysutils/gnome-vfs2/work/.buildlink/lib/glib-2.0/include -I/usr/pkg/pkgsrc/sysutils/gnome-vfs2/work/.buildlink/include/gconf/2 -I/usr/pkg/pkgsrc/sysutils/gnome-vfs2/work/.buildlink/include/orbit-2.0 -I/usr/pkg/pkgsrc/sysutils/gnome-vfs2/work/.buildlink/include/libxml2 -I/usr/pkg/pkgsrc/sysutils/gnome-vfs2/work/.buildlink/include/dbus-1.0 -I/usr/pkg/pkgsrc/sysutils/gnome-vfs2/work/.buildlink/lib/dbus-1.0/include -I/usr/pkg/pkgsrc/sysutils/gnome-vfs2/work/.buildlink/include -DXDG_PREFIX=_gnome_vfs_xdg -DDBUS_API_SUBJECT_TO_CHANGE -D_FILE_OFFSET_BITS=64 -D_BSD_SOURCE -D_LARGEFILE64_SOURCE -D_POSIX_PTHREAD_SEMANTICS -DG_DISABLE_DEPRECATED -DGNOME_VFS_PREFIX=\"/usr/pkg\" -DGNOME_VFS_BINDIR=\"/usr/pkg/bin\" -DGNOME_VFS_DATADIR=\"/usr/pkg/share\" -DGNOME_VFS_LIBDIR=\"/usr/pkg/lib\" -DGNOME_VFS_LOCALEDIR=\"/usr/pkg/share/locale\" -DGNOME_V
 FS_SYSCONFDIR=\"/usr/pkg/etc\" -DG_LOG_DOMAIN=\"libgnomevfs\" -DNDEBUG -O2 -no-cpp-precomp -no-cpp-precomp -O2 -MT xdgmime.lo -MD -MP -MF .deps/xdgmime.Tpo -c xdgmime.c  -fno-common -DPIC -o .libs/xdgmime.o
In file included from xdgmime.c:32:
xdgmime.h:103:1: warning: "_xdg_mime_mime_type_equal" redefined
xdgmime.h:55:1: warning: this is the location of the previous definition
xdgmime.h:108:1: warning: "_xdg_mime_mime_type_subclass" redefined
xdgmime.h:58:1: warning: this is the location of the previous definition
xdgmime.h:111:1: warning: "_xdg_mime_unalias_mime_type" redefined
xdgmime.h:62:1: warning: this is the location of the previous definition
xdgmime.c: In function 'xdg_run_command_on_dirs':
xdgmime.c:239: error: 'PREFIX' undeclared (first use in this function)
xdgmime.c:239: error: (Each undeclared identifier is reported only once
xdgmime.c:239: error: for each function it appears in.)
xdgmime.c:239: error: parse error before string constant
gnumake[3]: *** [xdgmime.lo] Error 1
gnumake[2]: *** [all] Error 2
gnumake[1]: *** [all-recursive] Error 1
gnumake: *** [all] Error 2
*** Error code 2

This is because mk.conf sets CPPFLAGS with "=", not "+=" and sysutils/gnome-vfs2/Makefile.common includes bsd.prefs.mk after settings the necessary flags. It's common to use "=" instead of "+=" in mk.conf to override default values.
>How-To-Repeat:
Use a custom mk.conf where CPPFLAGS is set with "=", not "+="; then try to build sysutils/gnome-vfs2.

>Fix:
Move the inclusion of bsd.prefs.mk up in Makefile.common before CPPFLAGS is set. Move the inclusion of Makefile.common up in Makefile before settings any flags. Here are the patches:


--- sysutils/gnome-vfs2/Makefile.common.diff ---


--- Makefile.common	2007-07-01 16:58:35.000000000 +0200
+++ Makefile.common.orig	2007-04-29 15:09:27.000000000 +0200
@@ -22,8 +22,6 @@
 USE_TOOLS+=		gmake intltool msgfmt pkg-config
 USE_LIBTOOL=		YES
 
-.include "../../mk/bsd.prefs.mk"
-
 CONFIGURE_ARGS+=	--disable-cdda
 CONFIGURE_ARGS+=	--disable-gtk
 CONFIGURE_ARGS+=	--disable-howl
@@ -47,6 +45,8 @@
 CONF_FILES+=		${EGDIR}/${f} ${PKG_SYSCONFDIR}/${f}
 .endfor
 
+.include "../../mk/bsd.prefs.mk"
+
 # XXX Work-around for a problem in the configure script which checks for
 # statvfs(2) having SVR4 in mind.  Solving this in the script itself could
 # be the right way to go, but it is out of the scope of a local patch; it


--- sysutils/gnome-vfs2/Makefile.diff ---


--- Makefile	2007-07-01 16:59:58.000000000 +0200
+++ Makefile.orig	2007-07-01 16:57:30.000000000 +0200
@@ -4,8 +4,6 @@
 PKGCONFIG_OVERRIDE=	gnome-vfs-2.0.pc.in
 PKGCONFIG_OVERRIDE+=	gnome-vfs-module-2.0.pc.in
 
-.include "Makefile.common"
-
 OWN_DIRS=		${PKG_SYSCONFDIR}/modules
 
 EGFILES+=		modules/default-modules.conf
@@ -23,6 +21,8 @@
 
 PKG_DESTDIR_SUPPORT=	user-destdir
 
+.include "Makefile.common"
+
 CONFIGURE_ARGS+=	--enable-fam
 
 .include "../../devel/GConf2/schemas.mk"


-------


This is the same problem and fix as pkg/30029 (devel/glib2), pkg/30030 (databases/shared-mime-info) and pkg/30081 (x11/gtk2).