From 3ae58880afed04e7f78eba782de51ece79f06812 Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Fri, 9 Nov 2012 13:50:42 -0800 Subject: Add documentation and update CHANGES.txt. Remove the Environment methods VersionedSharedLibrary and VersionSharedLibraryInstall since they are no longer needed --- src/CHANGES.txt | 4 +++ src/engine/SCons/Environment.py | 71 -------------------------------------- src/engine/SCons/Tool/__init__.xml | 13 +++++++ src/engine/SCons/Tool/install.py | 2 +- src/engine/SCons/Tool/install.xml | 5 ++- 5 files changed, 22 insertions(+), 73 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 2c89d8d..33fa239 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -42,6 +42,10 @@ RELEASE 2.X.X - in LaTeX's glossaries package and the files it creates. - Improve support for new versions of biblatex in the TeX builder so biber is called automatically if biblatex requires it. + - Add SHLIBVERSION as an option that tells SharedLibrary to build + a versioned shared library and create the required symlinks. + Update Install to create the required symlinks when installing + a versioned shared library. RELEASE 2.2.0 - Mon, 05 Aug 2012 15:37:48 +0000 diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 7d56487..8cc033e 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -2247,77 +2247,6 @@ class Base(SubstitutionEnvironment): install._UNIQUE_INSTALLED_FILES = SCons.Util.uniquer_hashables(install._INSTALLED_FILES) return install._UNIQUE_INSTALLED_FILES - def VersionedSharedLibrary(self, libname, version, lib_objs=[],parse_flags=[]): - platform = self.subst('$PLATFORM') - shlib_suffix = self.subst('$SHLIBSUFFIX') - shlink_flags = SCons.Util.CLVar(self.subst('$SHLINKFLAGS')) - - if platform == 'posix': - ilib_suffix = shlib_suffix + '.' + version - (major, age, revision) = version.split(".") - soname = "lib" + libname + shlib_suffix + "." + major - shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,-soname=%s' % soname ] - elif platform == 'cygwin': - ilib_suffix = shlib_suffix - shlink_flags += [ '-Wl,-Bsymbolic', - '-Wl,--out-implib,${TARGET.base}.a' ] - elif platform == 'darwin': - ilib_suffix = '.' + version + shlib_suffix - shlink_flags += [ '-current_version', '%s' % version, - '-compatibility_version', '%s' % version, - '-undefined', 'dynamic_lookup' ] - - ilib = self.SharedLibrary(libname,lib_objs, - SHLIBSUFFIX=ilib_suffix, - SHLINKFLAGS=shlink_flags, - parse_flags=parse_flags) - - if platform == 'darwin': - if version.count(".") != 2: - # We need a library name in libfoo.x.y.z.dylib form to proceed - raise ValueError - lib = 'lib' + libname + '.' + version + '.dylib' - lib_no_ver = 'lib' + libname + '.dylib' - # Link libfoo.x.y.z.dylib to libfoo.dylib - self.AddPostAction(ilib, 'rm -f %s; ln -s %s %s' % ( - lib_no_ver, lib, lib_no_ver)) - self.Clean(lib, lib_no_ver) - elif platform == 'posix': - if version.count(".") != 2: - # We need a library name in libfoo.so.x.y.z form to proceed - raise ValueError - lib = "lib" + libname + ".so." + version - suffix_re = '%s\\.[0-9\\.]*$' % re.escape(shlib_suffix) - # For libfoo.so.x.y.z, links libfoo.so libfoo.so.x.y libfoo.so.x - major_name = shlib_suffix + "." + lib.split(".")[2] - minor_name = major_name + "." + lib.split(".")[3] - for linksuffix in [shlib_suffix, major_name, minor_name]: - linkname = re.sub(suffix_re, linksuffix, lib) - self.AddPostAction(ilib, 'rm -f %s; ln -s %s %s' % ( - linkname, lib, linkname)) - self.Clean(lib, linkname) - - return ilib - - def VersionedSharedLibraryInstall(self, destination, libs): - platform = self.subst('$PLATFORM') - shlib_suffix = self.subst('$SHLIBSUFFIX') - ilibs = self.Install(destination, libs) - if platform == 'posix': - suffix_re = '%s\\.[0-9\\.]*$' % re.escape(shlib_suffix) - for lib in map(str, libs): - if lib.count(".") != 4: - # We need a library name in libfoo.so.x.y.z form to proceed - raise ValueError - # For libfoo.so.x.y.z, links libfoo.so libfoo.so.x.y libfoo.so.x - major_name = shlib_suffix + "." + lib.split(".")[2] - minor_name = major_name + "." + lib.split(".")[3] - for linksuffix in [shlib_suffix, major_name, minor_name]: - linkname = re.sub(suffix_re, linksuffix, lib) - self.AddPostAction(ilibs, 'cd %s; rm -f %s; ln -s %s %s' % (destination, linkname, lib, linkname)) - self.Clean(lib, linkname) - return ilibs - class OverrideEnvironment(Base): """A proxy that overrides variables in a wrapped construction diff --git a/src/engine/SCons/Tool/__init__.xml b/src/engine/SCons/Tool/__init__.xml index d274a95..38a4ba6 100644 --- a/src/engine/SCons/Tool/__init__.xml +++ b/src/engine/SCons/Tool/__init__.xml @@ -146,6 +146,19 @@ On some platforms, there is a distinction between a shared library and a loadable module (explicitly loaded by user action). For maximum portability, use the &b-LoadableModule; builder for the latter. +When the &cv-link-SHLIBVERSION; construction variable is defined a versioned +shared library is created. This modifies the &cv-link-SHLINKFLAGS; as required. +adds the version number to the library name, and creates the symlinks that +are needed. &cv-link-SHLIBVERSION; needs to be of the form X.Y.Z, where X +and Y are numbers, and Z is a number but can also contain letters to designate +alpha, beta, or release candidate patch levels. + +This builder may create multiple links to the library. On a POSIX system, +for the shared library libbar.so.2.3.1, the links created would be +libbar.so, libbar.so.2, and libbar.so.2.3; on a Darwin (OSX) system +the library would be libbar.2.3.1.dylib and the link would be +libbar.dylib. + On Windows systems, specifying register=1 will cause the .dll to be diff --git a/src/engine/SCons/Tool/install.py b/src/engine/SCons/Tool/install.py index 50a96a9..eb50405 100644 --- a/src/engine/SCons/Tool/install.py +++ b/src/engine/SCons/Tool/install.py @@ -124,7 +124,7 @@ def copyFunc(dest, source, env): return 0 def versionedLibVersion(dest, env): - """Check if dest is a version shared library name. Return version libname if it is.""" + """Check if dest is a version shared library name. Return version, libname, & install_dir if it is.""" Verbose = False platform = env.subst('$PLATFORM') if not (platform == 'posix' or platform == 'darwin'): diff --git a/src/engine/SCons/Tool/install.xml b/src/engine/SCons/Tool/install.xml index 4b57a68..b83bb60 100644 --- a/src/engine/SCons/Tool/install.xml +++ b/src/engine/SCons/Tool/install.xml @@ -22,7 +22,10 @@ Installs one or more source files or directories in the specified target, which must be a directory. The names of the specified source files or directories -remain the same within the destination directory. +remain the same within the destination directory. The +sources may be given as a string or as a node returned by +a builder. If the source is a versioned shared library +the appropriate symlinks to it will be generated. env.Install('/usr/local/bin', source = ['foo', 'bar']) -- cgit v0.12