aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2015-08-28 20:28:13 +0800
committermat <mat@FreeBSD.org>2015-08-28 20:28:13 +0800
commit6f3e2a2709b35068932c98852d98b7ec539b98b1 (patch)
treef691b46b14dc311252a12b21c239ac707eddc5fc /Mk
parent645bd704858dbecd1d91d966f516feb293c2bece (diff)
downloadfreebsd-ports-gnome-6f3e2a2709b35068932c98852d98b7ec539b98b1.tar.gz
freebsd-ports-gnome-6f3e2a2709b35068932c98852d98b7ec539b98b1.tar.zst
freebsd-ports-gnome-6f3e2a2709b35068932c98852d98b7ec539b98b1.zip
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
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.options.mk29
1 files changed, 29 insertions, 0 deletions
diff --git a/Mk/bsd.options.mk b/Mk/bsd.options.mk
index 22ec6a6562a1..bfdf348c1cda 100644
--- a/Mk/bsd.options.mk
+++ b/Mk/bsd.options.mk
@@ -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/=.*//}