NetBSD Problem Report #30029

From www@netbsd.org  Fri Apr 22 07:58:41 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
	id 4F1D363B11A; Fri, 22 Apr 2005 07:58:41 +0000 (UTC)
Message-Id: <20050422075841.4F1D363B11A@narn.netbsd.org>
Date: Fri, 22 Apr 2005 07:58:41 +0000 (UTC)
From: idart@performancedesign.no
Reply-To: idart@performancedesign.no
To: gnats-bugs@netbsd.org
Subject: [PATCH] devel/glib2 patches in defines never seen by the compiler
X-Send-Pr-Version: www-1.0

>Number:         30029
>Category:       pkg
>Synopsis:       [PATCH] devel/glib2 patches in defines never seen by the compiler
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jmmv
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 22 07:59:00 +0000 2005
>Closed-Date:    Mon Sep 26 11:47:44 +0000 2005
>Last-Modified:  Mon Sep 26 11:47:44 +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:
devel/glib2/patch/patch-ah replaces certain directory variables in glib/gutils.c with defines to pkgsrc directories. devel/glib2/Makefile then tries to define these by settings some of them in CONFIGURE_ENV and all of them as -D flags 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 devel/glib2.
It is possible that the problem is platform specific.
If so, try to build devel/glib2 on OS X.
>Fix:
Altough the problem _might_ be OS X specific, the solution isn't.
Instead of trying to get the necessary defines passed to the compiler from the command line, include the definitions in config.h.

The patch also changes F77=${FALSE} to only apply to SunOS where the comment says it's needed. It otherwise generates annoying warnings during configuration.

Here's the patch against devel/glib2/Makefile:
----------------------------------------------

--- Makefile.orig	Fri Apr 22 08:47:33 2005
+++ Makefile	Fri Apr 22 09:24:04 2005
@@ -34,7 +34,6 @@
 PKGCONFIG_OVERRIDE+=	gthread-2.0.pc.in

 GNU_CONFIGURE=		# defined
-CONFIGURE_ENV+=		PKGLOCALEDIR=${PKGLOCALEDIR}
 CONFIGURE_ARGS+=	--enable-gtk-doc=no
 CONFIGURE_ARGS+=	--includedir=${PREFIX}/include/glib
 CONFIGURE_ARGS+=	--with-html-dir=${PREFIX}/share/doc
@@ -42,18 +41,16 @@

 CONFIGURE_ARGS.gnu-iconv=	--with-libiconv=gnu

-# Avoid an ICE in gcc2 on sparc64
-CONFIGURE_ENV+=		F77=${FALSE}
-
 CONFIGURE_ENV+=		PERL=${PERL5}
 CONFIGURE_ENV+=		PERL_PATH=${PERL5}

-CPPFLAGS+=		-DPREFIX="\"${PREFIX}\""
-CPPFLAGS+=		-DPKGLOCALEDIR="\"${PKGLOCALEDIR}\""
-CPPFLAGS+=		-DPKG_SYSCONFDIR="\"${PKG_SYSCONFDIR}\""
-
 .include "../../mk/bsd.prefs.mk"

+# Avoid an ICE in gcc2 on sparc64
+.if ${OPSYS} == "SunOS"
+CONFIGURE_ENV+=		F77=${FALSE}
+.endif
+
 # FreeBSD fix for libgthread:
 # Be sure libgthread is linked to the threaded library (libc_r), otherwise
 # -pthread is added and this won't work with libraries, only executable
@@ -73,6 +70,13 @@
 PRINT_PLIST_AWK+=	/^@dirrm include\/glib$$/ \
 				{ print "@unexec $${RMDIR} %D/" $$2 \
 				  " 2>/dev/null || $${TRUE}"; next; }
+
+post-configure:
+	@${ECHO} "" >> ${WRKSRC}/config.h
+	@${ECHO} "/* pkgsrc definitions. */" >> ${WRKSRC}/config.h
+	@${ECHO} "#define PREFIX \"${PREFIX}\"" >> ${WRKSRC}/config.h
+	@${ECHO} "#define PKGLOCALEDIR \"${PKGLOCALEDIR}\"" >> ${WRKSRC}/config.h
+	@${ECHO} "#define PKG_SYSCONFDIR \"${PKG_SYSCONFDIR}\"" >> ${WRKSRC}/config.h

 .include "../../converters/libiconv/buildlink3.mk"
 .include "../../devel/gettext-lib/buildlink3.mk"

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->jmmv
Responsible-Changed-By: reed@netbsd.org
Responsible-Changed-When: Fri, 22 Apr 2005 15:38:13 +0000
Responsible-Changed-Why:
Assigned to maintainer.


From: Idar Tollefsen <idart@performancedesign.no>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/30029: [PATCH] devel/glib2 patches in defines never seen
 by the compiler
Date: Sat, 23 Apr 2005 01:15:29 +0200

 pkg/30030 describes a similar problem in databases/shared-mime-info,
 but with a different solution.

 databases/shared-mime-info uses intltool, and when the build process
 detects changes made by the intltool override, it regenerates, among
 others, config.h. Putting the necessary definitions in config.h,
 as proposed for this problem, therefore doesn't work for 
 databases/shared-mime-info since config.h is overwritten after
 post-configure (and after pre-build for that matter).

 glib2 doesn't seem to use the intltool override, so that's not what's
 causing the problem here and the same solution can't be applied.

From: Idar Tollefsen <idart@performancedesign.no>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/30029
Date: Thu, 28 Apr 2005 13:05:44 +0200

 pkg/30081 describes a a similar problem in x11/gtk2 were the proposed solution 
 is the same as here (i.e. include the definition in config.h).

State-Changed-From-To: open->feedback
State-Changed-By: kristerw@netbsd.org
State-Changed-When: Sun, 17 Jul 2005 20:35:18 +0000
State-Changed-Why:
The current package (glib2-2.6.5nb1) builds without problems on
my Darwin 7.9.0 system.  Does the current package work for you?


From: Idar Tollefsen <idart@performancedesign.no>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/30029
Date: Thu, 21 Jul 2005 17:13:54 +0200

  > The current package (glib2-2.6.5nb1) builds without problems on
  > my Darwin 7.9.0 system.  Does the current package work for you?


 Nope, same problem, no change.

State-Changed-From-To: feedback->open
State-Changed-By: kristerw@netbsd.org
State-Changed-When: Tue, 26 Jul 2005 02:28:37 +0000
State-Changed-Why:
Feedback provided


State-Changed-From-To: open->feedback
State-Changed-By: jmmv@netbsd.org
State-Changed-When: Thu, 22 Sep 2005 21:45:07 +0000
State-Changed-Why:
Could you please try replacing all instances of CONFIGURE_ENV to
CONFIGURE_ARGS?  I guess something wired is going on with your
shell...  Thank you.


From: Idar Tollefsen <idart@performancedesign.no>
To: jmmv@netbsd.org
Cc: pkgsrc-bugs@netbsd.org, gnats-bugs@NetBSD.org
Subject: Re: pkg/30029
Date: Mon, 26 Sep 2005 12:33:10 +0200

 This is a multi-part message in MIME format.
 --------------010701070504040305070902
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit

 > Could you please try replacing all instances of CONFIGURE_ENV to
 > CONFIGURE_ARGS?  I guess something wired is going on with your
 > shell...  Thank you.

 I'm having the same problem on Solaris 10, but I just realized how stupidly 
 simple this is.

 devel/glib2/Makefile doesn't include bsd.prefs.mk before adding to CPPFLAGS. 
 When bsd.prefs.mk is eventually included, it overwrites CPPFLAGS because I have 
 CPPFLAGS=, not CPPFLAGS+=, in my mk.conf.

 Here's a new patch that fixes this. It's the same problem with pkg/30081 
 (x11/gtk2) and I've tested the same fix for it. I suspect it's the same with 
 pkg/30030 (databases/shared-mime-info) as well.

 --------------010701070504040305070902
 Content-Type: text/plain;
  name="Makefile.diff.glib2"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="Makefile.diff.glib2"

 --- Makefile.orig	Thu Sep 22 12:34:50 2005
 +++ Makefile	Mon Sep 26 11:00:29 2005
 @@ -47,12 +47,12 @@

  CONFIGURE_ENV+=		PERL_PATH=${PERL5}

 -CPPFLAGS+=		-DPREFIX="\"${PREFIX}\""
 -CPPFLAGS+=		-DPKGLOCALEDIR="\"${PKGLOCALEDIR}\""
 -CPPFLAGS+=		-DPKG_SYSCONFDIR="\"${PKG_SYSCONFDIR}\""
 -
  .include "../../mk/bsd.prefs.mk"

 +CPPFLAGS+=		-DPREFIX=\"${PREFIX}\"
 +CPPFLAGS+=		-DPKGLOCALEDIR=\"${PKGLOCALEDIR}\"
 +CPPFLAGS+=		-DPKG_SYSCONFDIR=\"${PKG_SYSCONFDIR}\"
 +
  .if ${OPSYS} == "FreeBSD"

  SUBST_CLASSES=		thr

 --------------010701070504040305070902--

From: "Julio M. Merino Vidal" <jmmv@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/30029 CVS commit: pkgsrc/devel/glib2
Date: Mon, 26 Sep 2005 11:44:55 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	jmmv
 Date:		Mon Sep 26 11:44:54 UTC 2005

 Modified Files:
 	pkgsrc/devel/glib2: Makefile

 Log Message:
 Move CPPFLAGS definitions below inclusion of bsd.prefs.mk, as mk.conf may
 do a 'CPPFLAGS=...' overriding its value.  Fixes PR pkg/30029 by
 Idar Tollefsen.  Allowed by agc@ during freeze.


 To generate a diff of this commit:
 cvs rdiff -r1.79 -r1.80 pkgsrc/devel/glib2/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: jmmv@netbsd.org
State-Changed-When: Mon, 26 Sep 2005 11:47:44 +0000
State-Changed-Why:
Fixed, thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.