diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-10-27 11:46:41 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-10-27 11:46:41 (GMT) |
commit | e7888b15628b09af093621825b78df5cbcead088 (patch) | |
tree | 5c5a4afd7998be0a26cf3eb5636f5c5274cbddfd /test/Libs/bug2903 | |
parent | 5c7cea447b7f3b7833fbf4db25d32afa255cf52e (diff) | |
download | SCons-e7888b15628b09af093621825b78df5cbcead088.zip SCons-e7888b15628b09af093621825b78df5cbcead088.tar.gz SCons-e7888b15628b09af093621825b78df5cbcead088.tar.bz2 |
Correctly fix bug #2903, failure to rebuild when linker options change.
The failure to rebuild when linker options change was introduced in
abded0675444, "Add library version support to Shared Lib builder",
between 2.2.0 and 2.3.0.
Turning ShlinkAction into a FunctionAction instead of a CommandAction
made it stop depending on $SHLINKCOM. Normally, a CommandAction calls
get_presig (Action.py:815) which removes $( ... $) and uses the rest
of that string (recursively fully substituted) as the contents to
hash.
FunctionActions only look at the body of the function, so that removed
the dependency on $SHLINKCOM altogether. Adding it back in the
varlist does this (Action.py:443):
for v in vl:
result.append(env.subst('${'+v+'}'))
so it deep-substitutes the whole thing, including all the $( ... $)
parts. (All varlist vars do this, not just in FunctionActions.)
What we really want is to depend on the value of env['SHLINKCOM']
in the way CommandActions do, i.e. without the $( ... $)
parts, definitely not the fully substituted version of it.
I'm pretty sure the ignored $(...$) parts should not ever be
included in the signature, so this change updates the varlist handling
code to work the way CommandActions always have.
This change also renames the test files to use the correct bug
number and updates the test.
Diffstat (limited to 'test/Libs/bug2903')
-rw-r--r-- | test/Libs/bug2903/SConstruct | 13 | ||||
-rw-r--r-- | test/Libs/bug2903/SConstruct-libs | 3 | ||||
-rw-r--r-- | test/Libs/bug2903/lib.c | 1 | ||||
-rw-r--r-- | test/Libs/bug2903/main.c | 3 |
4 files changed, 20 insertions, 0 deletions
diff --git a/test/Libs/bug2903/SConstruct b/test/Libs/bug2903/SConstruct new file mode 100644 index 0000000..f7b66a8 --- /dev/null +++ b/test/Libs/bug2903/SConstruct @@ -0,0 +1,13 @@ +# SConstruct for testing but #2903. +# The test changes the lib name to make sure it rebuilds +# when the name changes, even if the content of the lib is the same. +# Also, the test passes in extra shlinkflags to ensure things rebuild +# when other linker options change, and not when they don't. +# (This doesn't specifically test LIBPATH, but there's a test for +# that already.) +env=Environment() +libname=ARGUMENTS.get('libname', 'foo') +env['SHLINKCOM'] = env['SHLINKCOM'] + ' $EXTRA_SHLINKFLAGS' +shlinkflags=ARGUMENTS.get('shlinkflags', '') +env.SharedLibrary('myshared', ['main.c'], + LIBS=[libname], LIBPATH='.', EXTRA_SHLINKFLAGS=shlinkflags) diff --git a/test/Libs/bug2903/SConstruct-libs b/test/Libs/bug2903/SConstruct-libs new file mode 100644 index 0000000..3f59f9c --- /dev/null +++ b/test/Libs/bug2903/SConstruct-libs @@ -0,0 +1,3 @@ +env=Environment() +libfoo = env.SharedLibrary('foo', 'lib.c') +env.InstallAs('${SHLIBPREFIX}bar${SHLIBSUFFIX}', libfoo)
\ No newline at end of file diff --git a/test/Libs/bug2903/lib.c b/test/Libs/bug2903/lib.c new file mode 100644 index 0000000..048f715 --- /dev/null +++ b/test/Libs/bug2903/lib.c @@ -0,0 +1 @@ +int i; diff --git a/test/Libs/bug2903/main.c b/test/Libs/bug2903/main.c new file mode 100644 index 0000000..3fe7d49 --- /dev/null +++ b/test/Libs/bug2903/main.c @@ -0,0 +1,3 @@ +void func() +{ +} |