ports/67437: patch for bsd.port.mk: NO_BUILD and PKGNAMESUFFIX do not work with OPTIONS

Hiroki Sato hrs at FreeBSD.org
Tue Jun 1 06:01:03 UTC 2004


>Number:         67437
>Category:       ports
>Synopsis:       patch for bsd.port.mk: NO_BUILD and PKGNAMESUFFIX do not work with OPTIONS
>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 May 31 23:00:44 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hiroki Sato
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Tokyo University of Science
>Environment:
System: FreeBSD alph.allbsd.org 4.9-STABLE FreeBSD 4.9-STABLE #2: Fri Mar 19 04:20:12 JST 2004     hrs at alph.allbsd.org:/usr/obj/usr/src/sys/ALPH  i386

>Description:
	I have two problems related to OPTIONS, PKGNAMESUFFIX, and NO_BUILD.

	First, I would like to change PKGNAMESUFFIX when a user specify
	non-standard flags in OPTIONS, but the following code fragment
	does not work.  "make clean && make rmconfig && make all" occurs
	an error "make: don't know how to make
	/usr/ports/xxx/yyy/work/.build_done.yyy._zzz. Stop".

	--------------------------
 
	...

	OPTIONS= FOO "Build with foo flag" off

	.include <bsd.port.pre.mk>

	.if defined(WITH_FOO)
	PKGNAMESUFFIX= -foo
	.endif

	....

	.include <bsd.port.post.mk>

	--------------------------

	This is because "make bar" depends on the old BAR_COOKIE.
	At that stage, ".bar_done.yyy-foo._zzz" (not ".bar_done.yyy._zzz")
	must be created.  In short, in the following lines of bsd.port.mk:

	3517  # Main logic. The loop generates 6 main targets and using cookies
	3518  # ensures that those already completed are skipped.
	3519  
	3520  .for target in extract patch configure build install package
	3521  
	3522  .if !target(${target}) && defined(_OPTIONS_OK)
	3523  ${target}: ${${target:U}_COOKIE}
	3524  .elif !target(${target})
	3525  ${target}: config
	3526	@cd ${.CURDIR} && ${MAKE} CONFIG_DONE=1 ${__softMAKEFLAGS} ${${target:U}_COOKIE}
	3527  .elif target(${target}) && defined(IGNORE)
	3528  .endif

	"${${target:U}_COOKIE}" in commands of the target "${target}: config",
	has to be re-evaluated after "make config" (i.e. including OPTIONS_FILE).

	When I try the following change to re-evaluate the *_COOKIE,
	it seems to work with no bad side-effect.

	-  @cd ${.CURDIR} && ${MAKE} CONFIG_DONE=1 ${__softMAKEFLAGS} ${${target:U}_COOKIE}
	+  @cd ${.CURDIR} && ${MAKE} CONFIG_DONE=1 ${__softMAKEFLAGS} `${MAKE} ${__softMAKEFLAGS} -V${target:U}_COOKIE`

	The second is that NO_BUILD is ignored when OPTIONS is used.
	'make clean && make rmconfig && make' occurs an error, too.
	This is because _OPTIONS_OK is not defined during the initial
	"make config" invoked as a dependency.  Another logic which does
	not depend on _OPTIONS_OK is needed to fix this problem and
	currently all of NO_* have the same problem, I guess.

	The attached patch fixes the two problems.

>How-To-Repeat:
	N/A

>Fix:

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.489
diff -d -u -I\$FreeBSD:.*\$ -I\$NetBSD:.*\$ -I\$OpenBSD:.*\$ -I\$DragonFly:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -r1.489 bsd.port.mk
--- bsd.port.mk	27 May 2004 11:29:06 -0000	1.489
+++ bsd.port.mk	1 Jun 2004 04:04:46 -0000
@@ -2689,27 +2689,12 @@
 	@${DO_NADA}
 .endif
 
-# Disable build
-.if defined(NO_BUILD) && !target(build) && defined(_OPTIONS_OK)
-build: configure
-	@${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
-.endif
-
-# Disable install
-.if defined(NO_INSTALL) && !target(install) && defined(_OPTIONS_OK)
-install: build
-	@${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
-.endif
-
-# Disable package
-.if defined(NO_PACKAGE) && !target(package) && defined(_OPTIONS_OK)
-package:
+no-package-message:
 .if defined(IGNORE_SILENT)
 	@${DO_NADA}
 .else
 	@${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
 .endif
-.endif
 
 # Disable describe
 .if defined(NO_DESCRIBE) && !target(describe)
@@ -3504,6 +3489,17 @@
 _PACKAGE_DEP=	install
 _PACKAGE_SEQ=	package-message pre-package pre-package-script \
 				do-package post-package-script
+_NO_PACKAGE_SEQ=no-package-message
+_NO_PACKAGE_SUSEQ=no-package-message
+
+.for target in extract patch configure build install package
+.if !defined(NO_${target:U}_SEQ)
+NO_${target:U}_SEQ=
+.endif
+.if !defined(NO_${target:U}_SEQ)
+NO_${target:U}_SUSEQ=
+.endif
+.endfor
 
 .if !target(check-sanity)
 check-sanity: ${_SANITY_SEQ}
@@ -3523,7 +3519,7 @@
 ${target}: ${${target:U}_COOKIE}
 .elif !target(${target})
 ${target}: config
-	@cd ${.CURDIR} && ${MAKE} CONFIG_DONE=1 ${__softMAKEFLAGS} ${${target:U}_COOKIE}
+	@cd ${.CURDIR} && ${MAKE} CONFIG_DONE=1 ${__softMAKEFLAGS} `${MAKE} ${__softMAKEFLAGS} -V${target:U}_COOKIE`
 .elif target(${target}) && defined(IGNORE)
 .endif
 
@@ -3532,10 +3528,18 @@
 .if ${UID} != 0 && defined(_${target:U}_SUSEQ) && !defined(INSTALL_AS_USER)
 .if defined(USE_SUBMAKE)
 ${${target:U}_COOKIE}: ${_${target:U}_DEP}
+.if defined(NO_${target:U})
+	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} ${_NO_${target:U}_SEQ}
+.else
 	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} ${_${target:U}_SEQ}
+.endif
+.else
+.if defined(NO_${target:U})
+${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_NO_${target:U}_SEQ}
 .else
 ${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_${target:U}_SEQ}
 .endif
+.endif
 	@${ECHO_MSG} "===>  Switching to root credentials for '${target}' target"
 	@cd ${.CURDIR} && \
 		${SU_CMD} "${MAKE} ${__softMAKEFLAGS} ${_${target:U}_SUSEQ}"
@@ -3543,11 +3547,20 @@
 	@${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 .elif defined(USE_SUBMAKE)
 ${${target:U}_COOKIE}: ${_${target:U}_DEP}
+.if defined(NO_${target:U})
+	@cd ${.CURDIR} && \
+		${MAKE} ${__softMAKEFLAGS} ${_NO_${target:U}_SEQ} ${_NO_${target:U}_SUSEQ}
+.else
 	@cd ${.CURDIR} && \
 		${MAKE} ${__softMAKEFLAGS} ${_${target:U}_SEQ} ${_${target:U}_SUSEQ}
+.endif
 	@${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 .else
+.if defined(NO_${target:U})
+${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_NO_${target:U}_SEQ} ${_NO_${target:U}_SUSEQ}
+.else
 ${${target:U}_COOKIE}: ${_${target:U}_DEP} ${_${target:U}_SEQ} ${_${target:U}_SUSEQ}
+.endif
 	@${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 .endif
 
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list