summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2021-05-03 01:51:07 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2021-05-03 01:51:07 (GMT)
commit75871f612051f0b12ac54e82990aea928cec5b11 (patch)
tree1e5e58211d95ff66569d6ec884a02bd28fb479dd
parent83b9b9dab10922224d64b84cc1d6c70429e93f3c (diff)
downloadSCons-75871f612051f0b12ac54e82990aea928cec5b11.zip
SCons-75871f612051f0b12ac54e82990aea928cec5b11.tar.gz
SCons-75871f612051f0b12ac54e82990aea928cec5b11.tar.bz2
Fix Issue #3933 debug output removed from SharedLibrary when SHLIBVERSION is specified. Also fixed shared library file naming, and symlink naming for applelink. Was libxyz.dylib.1.2.3 for example, is now libxyz.1.2.3.dylib
-rwxr-xr-xCHANGES.txt5
-rw-r--r--SCons/Tool/applelink.py22
-rw-r--r--SCons/Tool/linkCommon/SharedLibrary.py6
-rw-r--r--test/LINK/SHLIBVERSIONFLAGS.py4
4 files changed, 33 insertions, 4 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index d907867..782def8 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -24,6 +24,11 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
IMPLIBNOVERSIONSYMLINKS and LDMODULENOVERSIONSYMLINKS to True.
- Added --experimental flag, to enable various experimental features/tools. You can specify
'all', 'none', or any combination of available experimental features.
+ - Fix Issue #3933 - Remove unguarded print of debug information in SharedLibrary logic when
+ SHLIBVERSION is specified.
+ - Fix versioned shared library naming for MacOS platform. (Previously was libxyz.dylib.1.2.3,
+ has been fixed to libxyz.1.2.3.dylib. Additionally the sonamed symlink had the same issue,
+ that is now resolved as well)
From David H:
- Fix Issue #3906 - `IMPLICIT_COMMAND_DEPENDENCIES` was not properly disabled when
diff --git a/SCons/Tool/applelink.py b/SCons/Tool/applelink.py
index 2cdbd50..b81d2b3 100644
--- a/SCons/Tool/applelink.py
+++ b/SCons/Tool/applelink.py
@@ -36,7 +36,7 @@ selection method.
# Even though the Mac is based on the GNU toolchain, it doesn't understand
# the -rpath option, so we use the "link" tool instead of "gnulink".
from SCons.Util import CLVar
-
+from SCons.Errors import UserError
from . import link
# User programmatically describes how SHLIBVERSION maps to values for compat/current.
@@ -141,6 +141,24 @@ def _applelib_compatVersionFromSoVersion(source, target, env, for_signature):
return "-Wl,-compatibility_version,%s" % version_string
+def _applelib_soname(target, source, env, for_signature):
+ """
+ Override default _soname() function from SCons.Tools.linkCommon.SharedLibrary.
+ Apple's file naming for versioned shared libraries puts the version string before
+ the shared library suffix (.dylib), instead of after.
+ """
+ if "SONAME" in env:
+ # Now verify that SOVERSION is not also set as that is not allowed
+ if "SOVERSION" in env:
+ raise UserError(
+ "Ambiguous library .so naming, both SONAME: %s and SOVERSION: %s are defined. "
+ "Only one can be defined for a target library."
+ % (env["SONAME"], env["SOVERSION"])
+ )
+ return "$SONAME"
+ else:
+ return "$SHLIBPREFIX$_get_shlib_stem$_SHLIBSOVERSION${SHLIBSUFFIX}"
+
def generate(env):
"""Add Builders and construction variables for applelink to an
@@ -178,6 +196,8 @@ def generate(env):
env['__LDMODULEVERSIONFLAGS'] = '${__lib_either_version_flag(__env__,' \
'"LDMODULEVERSION","_APPLELINK_CURRENT_VERSION", "_LDMODULEVERSIONFLAGS")}'
+ env["_SHLIBSONAME"] = _applelib_soname
+
def exists(env):
return env['PLATFORM'] == 'darwin'
diff --git a/SCons/Tool/linkCommon/SharedLibrary.py b/SCons/Tool/linkCommon/SharedLibrary.py
index 2a079bf..6a12dd4 100644
--- a/SCons/Tool/linkCommon/SharedLibrary.py
+++ b/SCons/Tool/linkCommon/SharedLibrary.py
@@ -166,8 +166,12 @@ def _get_shlib_dir(target, source, env, for_signature: bool) -> str:
Returns:
the directory the library will be in (empty string if '.')
"""
+ verbose = False
+
if target.dir and str(target.dir) != ".":
- print("target.dir:%s" % target.dir)
+ if verbose:
+ print("_get_shlib_dir: target.dir:%s" % target.dir)
+
return "%s/" % str(target.dir)
else:
return ""
diff --git a/test/LINK/SHLIBVERSIONFLAGS.py b/test/LINK/SHLIBVERSIONFLAGS.py
index 7832862..158e82a 100644
--- a/test/LINK/SHLIBVERSIONFLAGS.py
+++ b/test/LINK/SHLIBVERSIONFLAGS.py
@@ -47,9 +47,9 @@ elif 'sunlink' in tool_list:
soname = 'libfoo.so.4'
sonameVersionFlags = r".+ -h %s( .+)+" % soname
elif 'applelink' in tool_list:
- versionflags = r" 'libfoo.1.dylib'->'libfoo.1.2.3.dylib'"
+ versionflags = r".+ -Wl,-current_version,1.2.3( .+)+"
soname = 'libfoo.4.dylib'
- sonameVersionFlags = r" '%s'->'libfoo.1.2.3.dylib'(.+)+" % soname
+ sonameVersionFlags = r".+ -Wl,-compatibility_version,1.2.0(.+)+"
else:
test.skip_test('No testable linkers found, skipping the test\n')