[Scons-users] Passing $ORIGIN through Variables from the command line?

Andrew C. Morrow andrew.c.morrow at gmail.com
Wed Jan 21 17:16:24 EST 2015


Given the following minimal SConstruct:

print("ARGUMENTS: %r" % ARGUMENTS)

def identity_converter(val):
    print(val)
    return val

env_vars = Variables()

env_vars.Add(
    'SHLINKFLAGS',
    help='Sets flags for the linker when building shared libraries',
    converter=identity_converter)

env = Environment(
    tools=[],
    variables=env_vars)

print 'SHLINKFLAGS: %r' % env.get('SHLINKFLAGS', "<not set>")

I can't see how to get env['SHLINKFLAGS'] to contain the string
-Wl,-rpath=$ORIGIN/../lib from the command line:

It works fine when invoked with a simple flag:

> scons SHLINKFLAGS=-foo

scons: Reading SConscript files ...
ARGUMENTS: {'SHLINKFLAGS': '-foo'}
-foo
SHLINKFLAGS: '-foo'
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.


But the $ORIGIN seems to be eaten:

> scons SHLINKFLAGS='-Wl,-rpath=$ORIGIN/../lib'
scons: Reading SConscript files ...
ARGUMENTS: {'SHLINKFLAGS': '-Wl,-rpath=$ORIGIN/../lib'}
-Wl,-rpath=/../lib
SHLINKFLAGS: '-Wl,-rpath=/../lib'
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.

Note that the $ORIGIN does exist in ARGUMENTS so this is not shell
expansion eating $ORIGIN. Additionally, note that by the time the argument
has been passed to the validator, the $ORIGIN has already disappeared.

I've tried various forms of escaping like \$ORIGIN, etc, but without
success.

How can I pass a $ prefixed value through Variables on the command line?

Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150121/fa267d59/attachment.html>


More information about the Scons-users mailing list