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
This commit is contained in:
Mathieu Arnold 2015-08-28 12:28:13 +00:00
parent 5184f8775c
commit 9c517d8878
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=395468
2 changed files with 40 additions and 0 deletions

11
CHANGES
View File

@ -10,6 +10,17 @@ in the release notes and/or placed into UPDATING.
All ports committers are allowed to commit to this file.
20150828:
AUTHOR: mat@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@FreeBSD.org

View File

@ -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/=.*//}