Rob Managan avatar Rob Managan committed 63fa27e

add support for darwin

Comments (0)

Files changed (3)

src/engine/SCons/Environment.py

             (major, age, revision) = version.split(".")
             soname = "lib" + libname + shlib_suffix + "." + major
             shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,-soname=%s' % soname ]
-            print "ilib_suffix ",ilib_suffix,", soname ",soname,", shlink_flags ",shlink_flags
         elif platform == 'cygwin':
             ilib_suffix = shlib_suffix
             shlink_flags += [ '-Wl,-Bsymbolic',

src/engine/SCons/Tool/__init__.py

             if Verbose:
                 print "ilib_suffix ",ilib_suffix,", soname ",soname,", shlink_flags ",shlink_flags
         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' ]
             if version.count(".") != 2:
                 # We need a library name in libfoo.x.y.z.dylib form to proceed
                 raise ValueError
-            lib = libname + '.dylib'
-            lib_no_ver = libname + '.dylib'
-            suffix_re = '%s\\.[0-9\\.]*$' % re.escape(shlib_suffix)
-            lib_no_ver = re.sub(suffix_re, shlib_suffix, lib)
+            # regex to find version+.dylib in the target name
+            suffix_re = '[\\.0-9]*%s$' % re.escape(shlib_suffix)
+            # remove the version string from libname so we can make a symlink
+            lib_no_ver = re.sub(suffix_re, shlib_suffix, libname)
+            os.symlink(libname,lib_no_ver)
         elif platform == 'posix':
             if version.count(".") != 2:
                 # We need a library name in libfoo.so.x.y.z form to proceed

src/engine/SCons/Tool/link.py

 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
+import re
+
 import SCons.Defaults
 import SCons.Tool
 import SCons.Util
     return '$CC'
 
 def shlib_emitter(target, source, env):
+    platform = env.subst('$PLATFORM')
     for tgt in target:
         tgt.attributes.shared = 1
     try:
         # target[0] comes in as libtest.so. Add the version extensions
         version = env.subst('$SHLIBVERSION')
         if version:
-            versionparts = version.split('.')
-            name = str(target[0])
-            for ver in versionparts:
-                name = name + '.' + ver
+            if platform == 'posix':
+                versionparts = version.split('.')
+                name = str(target[0])
+                for ver in versionparts:
+                    name = name + '.' + ver
+                    target.insert(0, env.fs.File(name))
+            elif platform == 'darwin':
+                shlib_suffix = env.subst('$SHLIBSUFFIX')
+                name = str(target[0])
+                name = re.sub(shlib_suffix+"$",'.'+version+shlib_suffix,name)
                 target.insert(0, env.fs.File(name))
     except KeyError:
         version = None
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.