svn commit: r395468 - in head: . Mk
Mathieu Arnold
mat at FreeBSD.org
Fri Aug 28 12:28:14 UTC 2015
Author: mat
Date: Fri Aug 28 12:28:13 2015
New Revision: 395468
URL: https://svnweb.freebsd.org/changeset/ports/395468
Log:
Add generic opt_VARS/opt_VARS_OFF.
OPT1_VARS= foo=bar baz+=bam
will set FOO to bar and append bam to BAZ if OPT1 is enabled. <opt>_VARS_OFF
works the same way, if the option is disabled.
Reviewed by: bapt
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D3410
Modified:
head/CHANGES
head/Mk/bsd.options.mk
Modified: head/CHANGES
==============================================================================
--- head/CHANGES Fri Aug 28 12:25:47 2015 (r395467)
+++ head/CHANGES Fri Aug 28 12:28:13 2015 (r395468)
@@ -10,6 +10,17 @@ in the release notes and/or placed into
All ports committers are allowed to commit to this file.
+20150828:
+AUTHOR: mat at FreeBSD.org
+
+ <opt>_VARS and <opt>_VARS_OFF have been introduced to allow for a generic way
+ to set/append to variables.
+
+ OPT1_VARS= foo=bar baz+=bam
+
+ will set FOO to bar and append bam to BAZ if OPT1 is enabled. <opt>_VARS_OFF
+ works the same way, if the option is disabled.
+
20150818:
AUTHOR: kde at FreeBSD.org
Modified: head/Mk/bsd.options.mk
==============================================================================
--- head/Mk/bsd.options.mk Fri Aug 28 12:25:47 2015 (r395467)
+++ head/Mk/bsd.options.mk Fri Aug 28 12:28:13 2015 (r395468)
@@ -110,6 +110,15 @@
# ${opt}_USE_OFF= FOO=bar When option is disabled, it will enable
# USE_FOO+= bar
#
+# ${opt}_VARS= FOO=bar When option is enabled, it will run
+# FOO= bar
+# ${opt}_VARS= FOO+=bar When option is enabled, it will run
+# FOO+= bar
+# ${opt}_VARS_OFF= FOO=bar When option is disabled, it will run
+# FOO= bar
+# ${opt}_VARS_OFF= FOO+=bar When option is disabled, it will run
+# FOO+= bar
+#
# For each of:
# ALL_TARGET BROKEN CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS CONFLICTS_BUILD
# CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES EXTRA_PATCHES EXTRACT_ONLY
@@ -463,6 +472,16 @@ _u= ${option:C/=.*//g}
USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g}
. endfor
. endif
+. if defined(${opt}_VARS)
+. for var in ${${opt}_VARS}
+_u= ${var:C/=.*//}
+. if ${_u:M*+}
+${_u:C/.$//:tu}+= ${var:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
+. else
+${_u:tu}= ${var:C/[^=]*=//:C/^"(.*)"$$/\1/}
+. endif
+. endfor
+. endif
. if defined(${opt}_CONFIGURE_ENABLE)
. for iopt in ${${opt}_CONFIGURE_ENABLE}
CONFIGURE_ARGS+= --enable-${iopt}
@@ -501,6 +520,16 @@ _u= ${option:C/=.*//g}
USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g}
. endfor
. endif
+. if defined(${opt}_VARS_OFF)
+. for var in ${${opt}_VARS_OFF}
+_u= ${var:C/=.*//}
+. if ${_u:M*+}
+${_u:C/.$//:tu}+= ${var:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
+. else
+${_u:tu}= ${var:C/[^=]*=//:C/^"(.*)"$$/\1/}
+. endif
+. endfor
+. endif
. if defined(${opt}_CONFIGURE_ENABLE)
. for iopt in ${${opt}_CONFIGURE_ENABLE}
CONFIGURE_ARGS+= --disable-${iopt:C/=.*//}
More information about the svn-ports-all
mailing list