diff options
author | Tom Tanner <ttanner2@bloomberg.net> | 2013-09-30 15:42:17 (GMT) |
---|---|---|
committer | Tom Tanner <ttanner2@bloomberg.net> | 2013-09-30 15:42:17 (GMT) |
commit | 81524478eeffbb8ea011f2362ddbdce1a47dd96a (patch) | |
tree | 637320b155746cbd59ba9d162056b4e5523727fb | |
parent | e014d3bfc6e5d07666361e9d3071d12617e1e2d5 (diff) | |
parent | 43f296c7c2a350de0c59a442e566c165420803e3 (diff) | |
download | SCons-81524478eeffbb8ea011f2362ddbdce1a47dd96a.zip SCons-81524478eeffbb8ea011f2362ddbdce1a47dd96a.tar.gz SCons-81524478eeffbb8ea011f2362ddbdce1a47dd96a.tar.bz2 |
Merged scons/scons into default
-rw-r--r-- | src/CHANGES.txt | 17 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/Node/FS.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Subst.py | 14 | ||||
-rw-r--r-- | src/engine/SCons/SubstTests.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vc.py | 17 | ||||
-rw-r--r-- | src/engine/SCons/Tool/__init__.py | 26 | ||||
-rw-r--r-- | test/Libs/SharedLibrary-update-deps.py | 57 | ||||
-rw-r--r-- | test/Libs/SharedLibrary.py | 13 | ||||
-rw-r--r-- | test/Libs/bug2909/SConstruct | 3 | ||||
-rw-r--r-- | test/Libs/bug2909/SConstruct-libs | 3 | ||||
-rw-r--r-- | test/Libs/bug2909/lib.c | 1 | ||||
-rw-r--r-- | test/Libs/bug2909/main.c | 3 |
13 files changed, 148 insertions, 21 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index e80a161..50a27dc 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,23 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Bogdan Tenea: + - Check for 8.3 filenames on cygwin as well as win32 to make variant_dir work properly. + + From Alexandre Feblot: + - Make sure SharedLibrary depends on all dependent libs (by depending on SHLINKCOM) + + From Stefan Sperling: + - Fixed the setup of linker flags for a versioned SharedLibrary + under OpenBSD (#2916). + + From Antonio Cavallo: + - Improve error if Visual Studio bat file not found. + + From Manuel Francisco Naranjo: + - Allow Subst.Literal string objects to be compared with each other, + so they work better in AddUnique() and Remove(). + From David Rothenberger: - Added cyglink linker that uses Cygwin naming conventions for shared libraries and automatically generates import libraries. diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 750266a..a4fbefb 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1682,6 +1682,8 @@ def exists(env): CCC1 = '', CCC2 = '', DDD1 = ['a', 'b', 'c']) + env['LL1'] = [env.Literal('a literal'), env.Literal('b literal')] + env['LL2'] = [env.Literal('c literal'), env.Literal('b literal')] env.AppendUnique(AAA1 = 'a1', AAA2 = ['a2'], AAA3 = ['a3', 'b', 'c', 'c', 'b', 'a3'], # ignore dups @@ -1694,7 +1696,9 @@ def exists(env): BBB5 = ['b5.new'], CCC1 = 'c1', CCC2 = ['c2'], - DDD1 = 'b') + DDD1 = 'b', + LL1 = env.Literal('a literal'), + LL2 = env.Literal('a literal')) assert env['AAA1'] == 'a1a1', env['AAA1'] assert env['AAA2'] == ['a2'], env['AAA2'] @@ -1709,6 +1713,8 @@ def exists(env): assert env['CCC1'] == 'c1', env['CCC1'] assert env['CCC2'] == ['c2'], env['CCC2'] assert env['DDD1'] == ['a', 'b', 'c'], env['DDD1'] + assert env['LL1'] == [env.Literal('a literal'), env.Literal('b literal')], env['LL1'] + assert env['LL2'] == [env.Literal('c literal'), env.Literal('b literal'), env.Literal('a literal')], [str(x) for x in env['LL2']] env.AppendUnique(DDD1 = 'b', delete_existing=1) assert env['DDD1'] == ['a', 'c', 'b'], env['DDD1'] # b moves to end diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index f31ca83..4381697 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1841,7 +1841,7 @@ class Dir(Base): for entry in map(_my_normcase, entries): d[entry] = True self.on_disk_entries = d - if sys.platform == 'win32': + if sys.platform == 'win32' or sys.platform == 'cygwin': name = _my_normcase(name) result = d.get(name) if result is None: diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index 98097dc..318d7d9 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -78,6 +78,14 @@ class Literal(object): def is_literal(self): return 1 + def __eq__(self, other): + if not isinstance(other, Literal): + return False + return self.lstr == other.lstr + + def __neq__(self, other): + return not self.__eq__(other) + class SpecialAttrWrapper(object): """This is a wrapper for what we call a 'Node special attribute.' This is any of the attributes of a Node that we can reference from @@ -172,7 +180,7 @@ class NLWrapper(object): In practice, this might be a wash performance-wise, but it's a little cleaner conceptually... """ - + def __init__(self, list, func): self.list = list self.func = func @@ -190,7 +198,7 @@ class NLWrapper(object): self._create_nodelist = self._return_nodelist return self.nodelist _create_nodelist = _gen_nodelist - + class Targets_or_Sources(collections.UserList): """A class that implements $TARGETS or $SOURCES expansions by in turn @@ -451,7 +459,7 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={ raise_exception(NameError(key), lvars['TARGETS'], s) else: return '' - + # Before re-expanding the result, handle # recursive expansion by copying the local # variable dictionary and overwriting a null diff --git a/src/engine/SCons/SubstTests.py b/src/engine/SCons/SubstTests.py index 420fd73..ee9f3db 100644 --- a/src/engine/SCons/SubstTests.py +++ b/src/engine/SCons/SubstTests.py @@ -1147,6 +1147,11 @@ class LiteralTestCase(unittest.TestCase): cmd_list = escape_list(cmd_list[0], escape_func) assert cmd_list == ['BAZ', '**$BAR**'], cmd_list + def test_LiteralEqualsTest(self): + """Test that Literals compare for equality properly""" + assert Literal('a literal') == Literal('a literal') + assert Literal('a literal') != Literal('b literal') + class SpecialAttrWrapperTestCase(unittest.TestCase): def test_SpecialAttrWrapper(self): """Test the SpecialAttrWrapper() function.""" diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 1266ee8..c970118 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -258,15 +258,16 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): installed_sdks=get_installed_sdks() for _sdk in installed_sdks: - sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch) - sdk_bat_file_path=os.path.join(pdir,sdk_bat_file) - debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) - if os.path.exists(sdk_bat_file_path): - return (batfilename,sdk_bat_file_path) + sdk_bat_file = _sdk.get_sdk_vc_script(host_arch,target_arch) + if not sdk_bat_file: + debug("vc.py:find_batch_file() not found:%s"%_sdk) else: - debug("vc.py:find_batch_file() not found:%s"%sdk_bat_file_path) - else: - return (batfilename,None) + sdk_bat_file_path = os.path.join(pdir,sdk_bat_file) + if os.path.exists(sdk_bat_file_path): + debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) + return (batfilename,sdk_bat_file_path) + return (batfilename,None) + __INSTALLED_VCS_RUN = None diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index b80d6e4..7477f75 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -257,6 +257,10 @@ def VersionShLibLinkNames(version, libname, env): print "VersionShLibLinkNames: linkname = ",linkname linknames.append(linkname) elif platform == 'posix': + if sys.platform.startswith('openbsd'): + # OpenBSD uses x.y shared library versioning numbering convention + # and doesn't use symlinks to backwards-compatible libraries + return [] # For libfoo.so.x.y.z, linknames libfoo.so libfoo.so.x.y libfoo.so.x suffix_re = re.escape(shlib_suffix + '.' + version) # First linkname has no version number @@ -302,13 +306,17 @@ symlinks for the platform we are on""" if version: # set the shared library link flags if platform == 'posix': - suffix_re = re.escape(shlib_suffix + '.' + version) - (major, age, revision) = version.split(".") - # soname will have only the major version number in it - soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major - shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,-soname=%s' % soname ] - if Verbose: - print " soname ",soname,", shlink_flags ",shlink_flags + shlink_flags += [ '-Wl,-Bsymbolic' ] + # OpenBSD doesn't usually use SONAME for libraries + if not sys.platform.startswith('openbsd'): + # continue setup of shlink flags for all other POSIX systems + suffix_re = re.escape(shlib_suffix + '.' + version) + (major, age, revision) = version.split(".") + # soname will have only the major version number in it + soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major + shlink_flags += [ '-Wl,-soname=%s' % soname ] + if Verbose: + print " soname ",soname,", shlink_flags ",shlink_flags elif platform == 'cygwin': shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,--out-implib,${TARGET.base}.a' ] @@ -356,7 +364,9 @@ symlinks for the platform we are on""" print "VerShLib: made sym link of %s -> %s" % (linkname, lib_ver) return result -ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None) +# Fix http://scons.tigris.org/issues/show_bug.cgi?id=2903 : +# varlist=['$SHLINKCOM']: ensure we still depend on SCons.Defaults.ShLinkAction command line which is $SHLINKCOM +ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None, varlist=['SHLINKCOM']) def createSharedLibBuilder(env): """This is a utility function that creates the SharedLibrary diff --git a/test/Libs/SharedLibrary-update-deps.py b/test/Libs/SharedLibrary-update-deps.py new file mode 100644 index 0000000..24c5262 --- /dev/null +++ b/test/Libs/SharedLibrary-update-deps.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that SharedLibrary() updates when a different lib is linked, even if it has the same md5. +This is Tigris bug #2909. +""" + +import os.path +import TestSCons + +test = TestSCons.TestSCons() + +test.dir_fixture( "bug2909" ) + +# Build the sub-libs (don't care about details of this) +test.run(arguments='-f SConstruct-libs') +# This should build the main lib, using libfoo.so +test.run(arguments='libname=foo') +# This should rebuild the main lib, using libbar.so; +# it should NOT say it's already up to date. +test.run(arguments='libname=bar') +test.must_not_contain_any_line(test.stdout(), ["is up to date"]) +# Try it again, in reverse, to make sure: +test.run(arguments='libname=foo') +test.must_not_contain_any_line(test.stdout(), ["is up to date"]) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Libs/SharedLibrary.py b/test/Libs/SharedLibrary.py index b7d1374..eac575c 100644 --- a/test/Libs/SharedLibrary.py +++ b/test/Libs/SharedLibrary.py @@ -60,6 +60,13 @@ obj = env.SharedObject('bar', 'foo.c') Default(env.Library(target = 'foo', source = obj)) """) +test.write('SConstructBaz', """ +env=Environment() +env['SHLIBVERSION'] = '1.0.0' +obj = env.SharedObject('baz', 'foo.c') +Default(env.SharedLibrary(target = 'baz', source = obj)) +""") + test.write('foo.c', r""" #include <stdio.h> @@ -287,6 +294,12 @@ main(int argc, char *argv[]) test.run(program = test.workpath('progbar'), stdout = "f4.c\nprogbar.c\n") +if sys.platform.startswith('openbsd'): + # Make sure we don't link libraries with -Wl,-soname on OpenBSD. + test.run(arguments = '-f SConstructBaz') + for line in test.stdout().split('\n'): + test.fail_test(line.find('-Wl,-soname=libbaz.so') != -1) + test.pass_test() # Local Variables: diff --git a/test/Libs/bug2909/SConstruct b/test/Libs/bug2909/SConstruct new file mode 100644 index 0000000..2c5440b --- /dev/null +++ b/test/Libs/bug2909/SConstruct @@ -0,0 +1,3 @@ +env=Environment() +libname=ARGUMENTS.get('libname', 'foo') +env.SharedLibrary('myshared', ['main.c'], LIBS=[libname], LIBPATH='.')
\ No newline at end of file diff --git a/test/Libs/bug2909/SConstruct-libs b/test/Libs/bug2909/SConstruct-libs new file mode 100644 index 0000000..3f59f9c --- /dev/null +++ b/test/Libs/bug2909/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/bug2909/lib.c b/test/Libs/bug2909/lib.c new file mode 100644 index 0000000..048f715 --- /dev/null +++ b/test/Libs/bug2909/lib.c @@ -0,0 +1 @@ +int i; diff --git a/test/Libs/bug2909/main.c b/test/Libs/bug2909/main.c new file mode 100644 index 0000000..3fe7d49 --- /dev/null +++ b/test/Libs/bug2909/main.c @@ -0,0 +1,3 @@ +void func() +{ +} |