Date: Fri, 28 Aug 2015 12:28:13 +0000 (UTC) From: Mathieu Arnold <mat@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r395468 - in head: . Mk Message-ID: <201508281228.t7SCSDB9059075@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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@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 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/=.*//}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508281228.t7SCSDB9059075>