summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Managan <managan1@llnl.gov>2012-11-09 13:50:42 -0800
committerRobert Managan <managan1@llnl.gov>2012-11-09 13:50:42 -0800
commit8e37c8dd1027ec48c8ceb88396b1d941a3ba9e39 (patch)
treec3077eb8ed9edc3d56897af6b7b321672fd047c2
parent45352eb319207d1608d8799eb944aa936e7b34a0 (diff)
downloadscons-8e37c8dd1027ec48c8ceb88396b1d941a3ba9e39.tar.gz
Add documentation and update CHANGES.txt. Remove the Environment methods VersionedSharedLibrary and VersionSharedLibraryInstall since they are no longer needed
-rw-r--r--src/CHANGES.txt4
-rw-r--r--src/engine/SCons/Environment.py71
-rw-r--r--src/engine/SCons/Tool/__init__.xml13
-rw-r--r--src/engine/SCons/Tool/install.py2
-rw-r--r--src/engine/SCons/Tool/install.xml5
5 files changed, 22 insertions, 73 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 2c89d8df..33fa239f 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 7d56487a..8cc033eb 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 d274a953..38a4ba6c 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
<literal>register=1</literal>
will cause the <filename>.dll</filename> to be
diff --git a/src/engine/SCons/Tool/install.py b/src/engine/SCons/Tool/install.py
index 50a96a97..eb504058 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 4b57a688..b83bb609 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.
<example>
env.Install('/usr/local/bin', source = ['foo', 'bar'])