Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jan 2009 07:06:50 +0100 (CET)
From:      Gerald Pfeifer <gerald@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/130677: Centralize handling of CPPFLAGS
Message-ID:  <200901180606.n0I66oN4053115@sputnik1.dbai.tuwien.ac.at>
Resent-Message-ID: <200901180630.n0I6U14e046308@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         130677
>Category:       ports
>Synopsis:       Centralize handling of CPPFLAGS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 18 06:30:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Gerald Pfeifer
>Release:        FreeBSD 6.4-RELEASE i386
>Organization:
>Environment:
>Description:
	Dozens and dozens of ports, and even some of our own sub-
	Makefiles, explicitly set CPPFLAGS to -I${LOCALBASE}/include,
	pass it to configure, or MAKE_ENV.  That is a lot of duplication
	and needless port bloat, and rathers should be centralized like
	we do for CFLAGS.
>How-To-Repeat:
	
>Fix:
	This is a first attempt of updating Mk/* accordingly; tons of
	ports will need updating, too, and I hope someone (portmgr)
	has some scripts for changes like this?  In any case, a full
	-exp run looks needed (and a code review, too).

Index: bsd.database.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.database.mk,v
retrieving revision 1.33
diff -u -3 -p -r1.33 bsd.database.mk
--- bsd.database.mk	29 Nov 2008 23:17:04 -0000	1.33
+++ bsd.database.mk	18 Jan 2009 05:57:52 -0000
@@ -199,9 +199,8 @@ LIB_DEPENDS+=	pq.${PGSQL${PGSQL_VER}_LIB
 .else
 IGNORE=		cannot install: unknown PostgreSQL version: ${PGSQL_VER}
 .endif # Check for correct version
-CPPFLAGS+=		-I${LOCALBASE}/include
 LDFLAGS+=		-L${LOCALBASE}/lib
-CONFIGURE_ENV+=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CONFIGURE_ENV+=	LDFLAGS="${LDFLAGS}"
 .endif # USE_PGSQL
 
 
Index: bsd.efl.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.efl.mk,v
retrieving revision 1.3
diff -u -3 -p -r1.3 bsd.efl.mk
--- bsd.efl.mk	19 Apr 2008 17:46:02 -0000	1.3
+++ bsd.efl.mk	18 Jan 2009 05:57:52 -0000
@@ -512,8 +512,7 @@ LIB_DEPENDS+=	${_${LIB}_SLIB}.${_${LIB}_
 #
 # Initialize configure enviropment
 #
-CONFIGURE_ENV+=	CPPFLAGS="-I${LOCALBASE}/include" \
-		CFLAGS="-I${LOCALBASE}/include ${CFLAGS}" \
+CONFIGURE_ENV+=	CFLAGS="-I${LOCALBASE}/include ${CFLAGS}" \
 		LDFLAGS="-L${LOCALBASE}/lib ${LDFLAGS}"
 
 PLIST_SUB+=	E17_ARCH=freebsd${OSREL}-${ARCH}
Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.608
diff -u -3 -p -r1.608 bsd.port.mk
--- bsd.port.mk	17 Jan 2009 18:44:15 -0000	1.608
+++ bsd.port.mk	18 Jan 2009 05:57:57 -0000
@@ -889,10 +889,10 @@ FreeBSD_MAINTAINER=	portmgr@FreeBSD.org
 #				- Pass these args to configure if ${HAS_CONFIGURE} is set.
 #				  Default: "--prefix=${PREFIX} --infodir=${PREFIX}/${INFO_PATH}
 #				  --mandir=${MANPREFIX}/man --build=${CONFIGURE_TARGET}" if
-#				  GNU_CONFIGURE is set, "CC=${CC} CCFLAGS=${CFLAGS}
-#				  PREFIX=${PREFIX} INSTALLPRIVLIB=${PREFIX}/lib
-#				  INSTALLARCHLIB=${PREFIX}/lib" if PERL_CONFIGURE is set,
-#				  empty otherwise.
+#				  GNU_CONFIGURE is set, "CPPFLAGS=${CPPFLAGS} CC=${CC}
+#				  CCFLAGS=${CFLAGS} PREFIX=${PREFIX}
+#				  INSTALLPRIVLIB=${PREFIX}/lib INSTALLARCHLIB=${PREFIX}/lib"
+#				  if PERL_CONFIGURE is set, empty otherwise.
 # CONFIGURE_ENV	- Pass these env (shell-like) to configure if
 #				  ${HAS_CONFIGURE} is set.
 # CONFIGURE_LOG	- The name of configure log file. It will be printed to
@@ -1595,6 +1595,8 @@ PLIST_REINPLACE_DIRRMTRY=s!^@dirrmtry \(
 PLIST_REINPLACE_RMTRY=s!^@rmtry \(.*\)!@unexec rm -f %D/\1 2>/dev/null || true!
 PLIST_REINPLACE_STOPDAEMON=s!^@stopdaemon \(.*\)!@unexec %D/etc/rc.d/\1${RC_SUBR_SUFFIX} forcestop 2>/dev/null || true!
 
+CPPFLAGS:=	-I${LOCALBASE}/include
+
 # kludge to strip trailing whitespace from CFLAGS;
 # sub-configure will not # survive double space
 CFLAGS:=	${CFLAGS:C/ $//}
@@ -2131,6 +2133,7 @@ MAKEFILE?=		Makefile
 MAKE_ENV+=		PREFIX=${PREFIX} \
 			LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} \
 			MOTIFLIB="${MOTIFLIB}" LIBDIR="${LIBDIR}" \
+			CPPFLAGS="${CPPFLAGS}" \
 			CC="${CC}" CFLAGS="${CFLAGS}" CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \
 			MANPREFIX="${MANPREFIX}"
 
@@ -3623,7 +3626,7 @@ do-configure:
 .if defined(HAS_CONFIGURE)
 	@(cd ${CONFIGURE_WRKSRC} && \
 	    ${SET_LATE_CONFIGURE_ARGS} \
-		if ! ${SETENV} CC="${CC}" CXX="${CXX}" \
+		if ! ${SETENV} CPPFLAGS="${CPPFLAGS}" CC="${CC}" CXX="${CXX}" \
 	    CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
 	    INSTALL="/usr/bin/install -c ${_BINOWNGRP}" \
 	    INSTALL_DATA="${INSTALL_DATA}" \

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901180606.n0I66oN4053115>