scons: facilitate passing linker options with '$ORIGIN'

Passing CUSTOM_LDFLAGS='-Wl,-rpath=$ORIGIN' to ./configure is
unnecessarily difficult and error-prone. The option needs to be
protected from SCons variable substitution by doubling the '$',
and also from shell parameter expansion with a backslash.
Such fortified value then cannot be used directly in contexts
where either expansion does not happen.

This commit makes that protection optional by injecting variable
named ORIGIN, that resolves to '$ORIGIN', into both the SCons
construction Environment and the process environment, so whenever
'$ORIGIN' undergoes variable substitution, it is replaced by the
original string.
This commit is contained in:
Mickey Rose 2019-08-18 22:48:18 +02:00
parent e80dd063ba
commit 08ccaf109b

View file

@ -142,6 +142,8 @@ PLUGINS = { # plugins with external dependencies
def init_environment(env):
env.Decider('MD5-timestamp')
env.SourceCode(".", None)
env['ORIGIN'] = Literal('$ORIGIN')
env['ENV']['ORIGIN'] = '$ORIGIN'
if os.environ.get('RANLIB'):
env['RANLIB'] = os.environ['RANLIB']
if os.environ.get('AR'):