diff options
| author | Steven Knight <knight@baldmt.com> | 2003-01-21 22:06:11 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-01-21 22:06:11 (GMT) |
| commit | ee27787c3d7718d2670e86f62c97f45b7d303f05 (patch) | |
| tree | 4871a92debf89a825d31b5841746944b67387d18 /src | |
| parent | 74b60176d6fa68928d9557f79d8206782d04ad4c (diff) | |
| download | SCons-ee27787c3d7718d2670e86f62c97f45b7d303f05.zip SCons-ee27787c3d7718d2670e86f62c97f45b7d303f05.tar.gz SCons-ee27787c3d7718d2670e86f62c97f45b7d303f05.tar.bz2 | |
Fix library dependencies when the prefix is specified explicitly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CHANGES.txt | 3 | ||||
| -rw-r--r-- | src/engine/SCons/Defaults.py | 39 | ||||
| -rw-r--r-- | src/engine/SCons/Tool/gnulink.py | 1 |
3 files changed, 32 insertions, 11 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index be0a4c9..7cd7e36 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -20,6 +20,9 @@ RELEASE 0.11 - XXX - Allow Python function Actions to specify a list of construction variables that should be included in the Action's signature. + - Allow libraries in the LIBS variable to explicitly include the prefix + and suffix, even when using the GNU linker. + From Anthony Roach: - Use a different static object suffix (.os) when using gcc so shared diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 2748436..6a3659d 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -184,12 +184,12 @@ Program = SCons.Builder.Builder(action=[ StaticCheck, '$LINKCOM' ], scanner = ProgScan) def _concat(prefix, list, suffix, locals, globals, f=lambda x: x): - """Creates a new list from 'list' by first interpolating each element - in the list using 'locals' and 'globals' and then calling f on the list, and - finally concatinating 'prefix' and 'suffix' onto each element of the - list. A trailing space on 'prefix' or leading space on 'suffix' will - cause them to be put into seperate list elements rather than being - concatinated.""" + """Creates a new list from 'list' by first interpolating each + element in the list using 'locals' and 'globals' and then calling f + on the list, and finally concatenating 'prefix' and 'suffix' onto + each element of the list. A trailing space on 'prefix' or leading + space on 'suffix' will cause them to be put into seperate list + elements rather than being concatenated.""" if not list: return list @@ -202,17 +202,17 @@ def _concat(prefix, list, suffix, locals, globals, f=lambda x: x): return SCons.Util.scons_subst(x, locals, globals) else: return x - + list = map(subst, list) list = f(list) ret = [] - + # ensure that prefix and suffix are strings prefix = str(prefix) suffix = str(suffix) - + for x in list: x = str(x) @@ -226,14 +226,30 @@ def _concat(prefix, list, suffix, locals, globals, f=lambda x: x): ret.append(suffix[1:]) else: ret[-1] = ret[-1]+suffix - + return ret +def _stripixes(prefix, list, suffix, locals, globals, stripprefix, stripsuffix, c=_concat): + """This is a wrapper around _concat() that checks for the existence + of prefixes or suffixes on list elements and strips them where it + finds them. This is used by tools (like the GNU linker) that need + to turn something like 'libfoo.a' into '-lfoo'.""" + def f(list, sp=stripprefix, ss=stripsuffix): + ret = [] + for l in list: + if l[:len(sp)] == sp: + l = l[len(sp):] + if l[-len(ss):] == ss: + l = l[:-len(ss)] + ret.append(l) + return ret + return c(prefix, list, suffix, locals, globals, f) + ConstructionEnvironment = { 'BUILDERS' : { 'SharedLibrary' : SharedLibrary, 'Library' : StaticLibrary, 'StaticLibrary' : StaticLibrary, - 'Alias' : Alias, + 'Alias' : Alias, 'Program' : Program }, 'SCANNERS' : [CScan, FortranScan], 'PDFPREFIX' : '', @@ -242,6 +258,7 @@ ConstructionEnvironment = { 'PSSUFFIX' : '.ps', 'ENV' : {}, '_concat' : _concat, + '_stripixes' : _stripixes, '_LIBFLAGS' : '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, locals(), globals())}', '_LIBDIRFLAGS' : '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, locals(), globals(), RDirs)} $)', '_CPPINCFLAGS' : '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, locals(), globals(), RDirs)} $)', diff --git a/src/engine/SCons/Tool/gnulink.py b/src/engine/SCons/Tool/gnulink.py index 2e92752..db7ff4b 100644 --- a/src/engine/SCons/Tool/gnulink.py +++ b/src/engine/SCons/Tool/gnulink.py @@ -52,6 +52,7 @@ def generate(env, platform): env['LINKCOM'] = '$LINK $LINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' env['LIBDIRPREFIX']='-L' env['LIBDIRSUFFIX']='' + env['_LIBFLAGS']='${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, locals(), globals(), LIBPREFIX, LIBSUFFIX)}' env['LIBLINKPREFIX']='-l' env['LIBLINKSUFFIX']='' |
