ports/164423: [PATCH] Pass MAKE_ENV to recursive make invocations in Mk/bsd.port.mk

Greg Larkin glarkin at FreeBSD.org
Mon Jan 23 21:30:13 UTC 2012


>Number:         164423
>Category:       ports
>Synopsis:       [PATCH] Pass MAKE_ENV to recursive make invocations in Mk/bsd.port.mk
>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:   Mon Jan 23 21:30:12 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Greg Larkin
>Release:        FreeBSD 8.2-RELEASE-p3 amd64
>Organization:
The FreeBSD Project
>Environment:
System: FreeBSD pm.sourcehosting.net 8.2-RELEASE-p3 FreeBSD 8.2-RELEASE-p3 #0: Tue Sep 27 18:45:57 UTC 2011 root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64


	
>Description:
bsd.port.mk contains several targets that recursively invoke make. If
the top-level make was invoked with a user-specified MAKE_ENV, it is not
passed to the recursive invocations.

>How-To-Repeat:
In order to configure a port and store the options file
in a non-standard location, the config target can be invoked like so:

    cd /usr/ports/devel/git && \
        make PORT_DBDIR=/tmp config

The options file /tmp/git/options will be created in this example.  If
the port is configured recursively, both of the following commands place
the options files in the standard /var/db/ports location:

    cd /usr/ports/devel/git && \
        make PORT_DBDIR=/tmp config-recursive

    cd /usr/ports/devel/git && \
        make MAKE_ENV+="PORT_DBDIR=/tmp" config-recursive

>Fix:

The attached patch invokes recursive make processes with the environment
specified by the top-level MAKE_ENV variable.

--- bsd.port.mk.recursive-make-env.diff begins here ---
--- bsd.port.mk.orig	2012-01-16 17:34:21.000000000 -0500
+++ bsd.port.mk	2012-01-23 14:50:27.000000000 -0500
@@ -4329,18 +4329,18 @@
 .if ${UID} != 0 && defined(_${target:U}_SUSEQ) && !defined(INSTALL_AS_USER)
 .if defined(USE_SUBMAKE)
 ${${target:U}_COOKIE}: ${_${target:U}_DEP}
-	@cd ${.CURDIR} && ${MAKE} ${_${target:U}_SEQ}
+	@cd ${.CURDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} ${_${target:U}_SEQ}
 .else
 ${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_${target:U}_SEQ}
 .endif
 	@${ECHO_MSG} "===>  Switching to root credentials for '${target}' target"
 	@cd ${.CURDIR} && \
-		${SU_CMD} "${MAKE} ${_${target:U}_SUSEQ}"
+		${SU_CMD} "${SETENV} ${MAKE_ENV} ${MAKE} ${_${target:U}_SUSEQ}"
 	@${ECHO_MSG} "===>  Returning to user credentials"
 	@${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 .elif defined(USE_SUBMAKE)
 ${${target:U}_COOKIE}: ${_${target:U}_DEP}
-	@cd ${.CURDIR} && \
+	@cd ${.CURDIR} && ${SETENV} ${MAKE_ENV} \
 		${MAKE} ${_${target:U}_SEQ} ${_${target:U}_SUSEQ}
 	@${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 .else
@@ -4353,7 +4353,7 @@
 	@if [ -e ${.TARGET} ]; then \
 		${DO_NADA}; \
 	else \
-		cd ${.CURDIR} && ${MAKE} ${.TARGET}; \
+		cd ${.CURDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} ${.TARGET}; \
 	fi
 .endif
 
@@ -5263,14 +5263,14 @@
 fetch-recursive:
 	@${ECHO_MSG} "===> Fetching all distfiles for ${PKGNAME} and dependencies"
 	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} fetch); \
+		(cd $$dir; ${SETENV} ${MAKE_ENV} ${MAKE} fetch); \
 	done
 .endif
 
 .if !target(fetch-recursive-list)
 fetch-recursive-list:
 	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} fetch-list); \
+		(cd $$dir; ${SETENV} ${MAKE_ENV} ${MAKE} fetch-list); \
 	done
 .endif
 
@@ -5333,7 +5333,7 @@
 checksum-recursive:
 	@${ECHO_MSG} "===> Fetching and checking checksums for ${PKGNAME} and dependencies"
 	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} checksum); \
+		(cd $$dir; ${SETENV} ${MAKE_ENV} ${MAKE} checksum); \
 	done
 .endif
 
@@ -5458,7 +5458,7 @@
 
 package-recursive: package
 	@for dir in $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} package-noinstall); \
+		(cd $$dir; ${SETENV} ${MAKE_ENV} ${MAKE} package-noinstall); \
 	done
 
 # Show missing dependencies
@@ -6008,7 +6008,7 @@
 config-recursive:
 	@${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies";
 	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} config-conditional); \
+		(cd $$dir; ${SETENV} ${MAKE_ENV} ${MAKE} config-conditional); \
 	done
 .endif
 
@@ -6037,10 +6037,10 @@
 		shift 3; \
 	done; \
 	if [ "$${OPTIONS_INVALID}" = "yes" ]; then \
-		cd ${.CURDIR} && ${MAKE} config; \
+		cd ${.CURDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} config; \
 	fi;
 .else
-	cd ${.CURDIR} && ${MAKE} config;
+	cd ${.CURDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} config;
 .endif
 .endif
 .endif
@@ -6077,7 +6077,7 @@
 showconfig-recursive:
 	@${ECHO_MSG} "===> The following configuration options are available for ${PKGNAME} and dependencies";
 	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} showconfig); \
+		(cd $$dir; ${SETENV} ${MAKE_ENV} ${MAKE} showconfig); \
 	done
 .endif
 
@@ -6104,7 +6104,7 @@
 rmconfig-recursive:
 	@${ECHO_MSG} "===> Removing user-specified options for ${PKGNAME} and dependencies";
 	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} rmconfig); \
+		(cd $$dir; ${SETENV} ${MAKE_ENV} ${MAKE} rmconfig); \
 	done
 .endif
 
--- bsd.port.mk.recursive-make-env.diff ends here ---

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



More information about the freebsd-ports-bugs mailing list