ports/149678: Mk/bsd.port.mk: add a sanity check for OPTIONS

bf bf1783 at gmail.com
Sun Aug 15 15:40:01 UTC 2010


>Number:         149678
>Category:       ports
>Synopsis:       Mk/bsd.port.mk: add a sanity check for OPTIONS
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 15 15:40:00 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     bf
>Release:        9-CURRENT amd64
>Organization:
-
>Environment:
>Description:
Currently, many build knobs are used in port Makefiles in an assortment of statements like:

.ifdef(WITH_FOO)
.ifndef(WITH_FOO)
.ifdef(WITHOUT_FOO)
.ifndef(WITHOUT_FOO)

, usually without any additional conditions. Hence having both WITH_FOO and WITHOUT_FOO defined in a build environment can lead to problems.  This can happen via environmental pollution, command-line directives, and/or definitions in port Makefiles.  Add a sanity check to ensure that at least those build knobs that are OPTIONS have a lower likelihood of being affected by such problems.

I chose to make a simple change; a safer but more complicated sanity check could instead be performed in the post-makefile section.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.643
diff -u -r1.643 bsd.port.mk
--- bsd.port.mk	15 Jul 2010 14:48:50 -0000	1.643
+++ bsd.port.mk	15 Aug 2010 15:25:32 -0000
@@ -1317,11 +1317,15 @@
 .	for W in ${WITH}
 .   if !defined(WITH_${W}) && !defined(WITHOUT_${W})
 WITH_${W}:=	true
+.   elif defined(WITH_${W}) && defined(WITHOUT_${W})
+.error ${.CURDIR}: The mutually-exclusive options WITH_${W} and WITHOUT_${W} are both defined in your build environment.
 .   endif
 .	endfor
 .	for W in ${WITHOUT}
 .   if !defined(WITH_${W}) && !defined(WITHOUT_${W})
 WITHOUT_${W}:=	true
+.   elif defined(WITH_${W}) && defined(WITHOUT_${W})
+.error ${.CURDIR}: The mutually-exclusive options WITH_${W} and WITHOUT_${W} are both defined in your build environment.
 .   endif
 .	endfor
 .	undef WITH


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



More information about the freebsd-ports-bugs mailing list