summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/SCons/Defaults.py15
-rw-r--r--test/long-lines.py8
2 files changed, 12 insertions, 11 deletions
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index db93a67..cb21d81 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -64,7 +64,7 @@ class SharedCmdGenerator:
self.action_static = static
self.action_shared = shared
- def __call__(self, target, source, env, shared=0, for_signature=0):
+ def __call__(self, target, source, env, shared=0, **kw):
for src in source:
try:
if src.attributes.shared != shared:
@@ -206,18 +206,21 @@ class LibAffixGenerator:
self.static_affix = static
self.shared_affix = shared
- def __call__(self, shared=0, win32=0):
+ def __call__(self, shared=0, **kw):
if shared:
return self.shared_affix
return self.static_affix
-def win32LibGenerator(target, source, env, for_signature, shared=1):
+def win32LibGenerator(target, source, env, for_signature, shared=1,
+ no_import_lib=0):
listCmd = [ "$SHLINK", "$SHLINKFLAGS" ]
for tgt in target:
ext = os.path.splitext(str(tgt))[1]
if ext == env.subst("$LIBSUFFIX"):
# Put it on the command line as an import library.
+ if no_import_lib:
+ raise SCons.Errors.UserError, "%s: You cannot specify a .lib file as a target of a shared library build if no_import_library is nonzero." % tgt
listCmd.append("${WIN32IMPLIBPREFIX}%s" % tgt)
else:
listCmd.append("${WIN32DLLPREFIX}%s" % tgt)
@@ -233,7 +236,8 @@ def win32LibGenerator(target, source, env, for_signature, shared=1):
listCmd.append(str(src))
return win32TempFileMunge(env, listCmd, for_signature)
-def win32LibEmitter(target, source, env, shared=0):
+def win32LibEmitter(target, source, env, shared=0,
+ no_import_lib=0):
if shared:
dll = None
for tgt in target:
@@ -252,7 +256,8 @@ def win32LibEmitter(target, source, env, shared=0):
# append a def file to the list of sources
source.append("%s%s" % (os.path.splitext(str(dll))[0],
env.subst("$WIN32DEFSUFFIX")))
- if not env.subst("$LIBSUFFIX") in \
+ if not no_import_lib and \
+ not env.subst("$LIBSUFFIX") in \
map(lambda x: os.path.split(str(x))[1], target):
# Append an import library to the list of targets.
target.append("%s%s%s" % (env.subst("$LIBPREFIX"),
diff --git a/test/long-lines.py b/test/long-lines.py
index 521ed2c..a199a16 100644
--- a/test/long-lines.py
+++ b/test/long-lines.py
@@ -35,12 +35,10 @@ test = TestSCons.TestSCons()
if sys.platform == 'win32':
lib_=''
_dll = '.dll'
- _export = '__declspec(dllexport) '
linkflag = '/LIBPATH:' + test.workpath()
else:
lib_='lib'
_dll='.so'
- _export=''
linkflag = '-L' + test.workpath()
test.write('SConstruct', """
@@ -50,12 +48,10 @@ while len(linkflags) <= 8100:
env = Environment(LINKFLAGS = '$LINKXXX', LINKXXX = linkflags)
env.Program(target = 'foo', source = 'foo.c')
# Library(shared=1) uses $LINKFLAGS by default.
-env.Library(target = 'bar', source = 'foo.c', shared=1)
+env.Library(target = 'bar', source = 'foo.c', shared=1, no_import_lib=1)
""" % (linkflag, linkflag))
test.write('foo.c', r"""
-%svoid foo() { }
-
int
main(int argc, char *argv[])
{
@@ -63,7 +59,7 @@ main(int argc, char *argv[])
printf("foo.c\n");
exit (0);
}
-""" % _export)
+""")
test.run(arguments = '.')