diff options
author | mat <mat@FreeBSD.org> | 2015-10-01 15:56:36 +0800 |
---|---|---|
committer | mat <mat@FreeBSD.org> | 2015-10-01 15:56:36 +0800 |
commit | e4ad2266acb911d28850eaa2bcf03c3d650ffa3a (patch) | |
tree | dde9b9e10338d4516536d574ba5128648014e145 /Mk | |
parent | b7b2929901822a46001ac7ead1cd338854f3e91e (diff) | |
download | freebsd-ports-gnome-e4ad2266acb911d28850eaa2bcf03c3d650ffa3a.tar.gz freebsd-ports-gnome-e4ad2266acb911d28850eaa2bcf03c3d650ffa3a.tar.zst freebsd-ports-gnome-e4ad2266acb911d28850eaa2bcf03c3d650ffa3a.zip |
Fix opt_VARS premature expansion.
Due to the way .for loop work, opt_VARS was being expanded too early
evaluation, which made it impossible to use vars that are set/modifies
afterwards (such as PREFIX or PKGDIR)
Fix this by changing opt_VARS handling logic so that the right side is
not prematurely expanded:
- Loop not by words (each word here is single VAR=val / VAR+=val tuple)
but by unique left sides of assignments (VAR, VAR+ here)
- Using the left side, extract all corresponding right sides and
append/assign them to a variable
This changes the way this opt_VARS line work, which behavior is between
invalid and undefined:
opt_VARS= FOO=bar FOO=baz
Before it would end up with "FOO=baz", now it ends up with "FOO=bar baz"
Submitted by: amdmi3
Reviewed by: antoine, mat
Approved by: my portmgr hat
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D3729
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/bsd.options.mk | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Mk/bsd.options.mk b/Mk/bsd.options.mk index b299e548f43e..6961a71ce554 100644 --- a/Mk/bsd.options.mk +++ b/Mk/bsd.options.mk @@ -476,12 +476,12 @@ USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g} . endfor . endif . if defined(${opt}_VARS) -. for var in ${${opt}_VARS} -_u= ${var:C/=.*//} +. for var in ${${opt}_VARS:C/=.*//:O:u} +_u= ${var} . if ${_u:M*+} -${_u:C/.$//:tu}+= ${var:C/[^+]*\+=//:C/^"(.*)"$$/\1/} +${_u:C/.$//:tu}+= ${${opt}_VARS:M${var}=*:C/[^+]*\+=//:C/^"(.*)"$$/\1/} . else -${_u:tu}= ${var:C/[^=]*=//:C/^"(.*)"$$/\1/} +${_u:tu}= ${${opt}_VARS:M${var}=*:C/[^=]*=//:C/^"(.*)"$$/\1/} . endif . endfor . endif @@ -524,12 +524,12 @@ USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g} . endfor . endif . if defined(${opt}_VARS_OFF) -. for var in ${${opt}_VARS_OFF} -_u= ${var:C/=.*//} +. for var in ${${opt}_VARS_OFF:C/=.*//:O:u} +_u= ${var} . if ${_u:M*+} -${_u:C/.$//:tu}+= ${var:C/[^+]*\+=//:C/^"(.*)"$$/\1/} +${_u:C/.$//:tu}+= ${${opt}_VARS_OFF:M${var}=*:C/[^+]*\+=//:C/^"(.*)"$$/\1/} . else -${_u:tu}= ${var:C/[^=]*=//:C/^"(.*)"$$/\1/} +${_u:tu}= ${${opt}_VARS_OFF:M${var}=*:C/[^=]*=//:C/^"(.*)"$$/\1/} . endif . endfor . endif |