Commits

Rob Managan  committed bff4abf

Add documentation and update CHANGES.txt. Remove the Environment methods VersionedSharedLibrary and VersionSharedLibraryInstall since they are no longer needed

  • Participants
  • Parent commits e00c5c6

Comments (0)

Files changed (5)

File src/CHANGES.txt

       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
 

File src/engine/SCons/Environment.py

             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

File src/engine/SCons/Tool/__init__.xml

 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

File src/engine/SCons/Tool/install.py

     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'):

File src/engine/SCons/Tool/install.xml

 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'])