summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-10-17 21:58:22 +1100
committerAndrew Tridgell <tridge@samba.org>2010-10-19 11:22:35 +1100
commitd48570143656d1c570c282f8e21e058508910f3c (patch)
tree0bedcceedc12f361b91d33d2f407671b561af5be /buildtools/wafsamba
parent7197bcc513e707676f10734cffd6f2f494a360c1 (diff)
downloadsamba-d48570143656d1c570c282f8e21e058508910f3c.tar.gz
samba-d48570143656d1c570c282f8e21e058508910f3c.tar.bz2
samba-d48570143656d1c570c282f8e21e058508910f3c.zip
waf: automap shared library names from .so to the right extension
this should help with MacOSX .dylib libraries
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_install.py18
-rw-r--r--buildtools/wafsamba/samba_utils.py39
-rw-r--r--buildtools/wafsamba/wafsamba.py5
-rw-r--r--buildtools/wafsamba/wscript7
4 files changed, 58 insertions, 11 deletions
diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py
index dda44cd012..eaeaff3af7 100644
--- a/buildtools/wafsamba/samba_install.py
+++ b/buildtools/wafsamba/samba_install.py
@@ -87,21 +87,21 @@ def install_library(self):
install_name = self.samba_realname
install_link = None
if getattr(self, 'samba_type', None) == 'PYTHON':
- inst_name = '%s.so' % t.target
+ inst_name = bld.make_libname(t.target, nolibprefix=True, python=True)
else:
- inst_name = 'lib%s.so' % t.target
+ inst_name = bld.make_libname(t.target)
elif self.vnum:
vnum_base = self.vnum.split('.')[0]
- install_name = 'lib%s.so.%s' % (self.target, self.vnum)
- install_link = 'lib%s.so.%s' % (self.target, vnum_base)
- inst_name = 'lib%s.so' % t.target
+ install_name = bld.make_libname(self.target, version=self.vnum)
+ install_link = bld.make_libname(self.target, version=vnum_base)
+ inst_name = bld.make_libname(t.target)
if not self.is_bundled:
# only generate the dev link for non-bundled libs
- dev_link = 'lib%s.so' % self.target
+ dev_link = bld.make_libname(self.target)
else:
- install_name = 'lib%s.so' % self.target
+ install_name = bld.make_libname(self.target)
install_link = None
- inst_name = 'lib%s.so' % t.target
+ inst_name = bld.make_libname(t.target)
if t.env.SONAME_ST and install_link:
t.env.append_value('LINKFLAGS', t.env.SONAME_ST % install_link)
@@ -142,7 +142,7 @@ def symlink_lib(self):
link_target = getattr(self, 'link_name', '')
if link_target == '':
- link_target = '%s/lib%s.so%s' % (LIB_PATH, self.target, soext)
+ link_target = '%s/%s' % (LIB_PATH, self.bld.make_libname(self.target, version=soext))
link_target = os.path.join(blddir, link_target)
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 7ce9f757e9..e86056e7e8 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -527,3 +527,42 @@ def reconfigure(ctx):
bld = samba_wildcard.fake_build_environment()
Configure.autoconfig = True
Scripting.check_configured(bld)
+
+
+def map_shlib_extension(ctx, name, python=False):
+ '''map a filename with a shared library extension of .so to the real shlib name'''
+ if name is None:
+ return None
+ (root1, ext1) = os.path.splitext(name)
+ if python:
+ (root2, ext2) = os.path.splitext(ctx.env.pyext_PATTERN)
+ else:
+ (root2, ext2) = os.path.splitext(ctx.env.shlib_PATTERN)
+ return root1+ext2
+Build.BuildContext.map_shlib_extension = map_shlib_extension
+
+
+def make_libname(ctx, name, nolibprefix=False, version=None, python=False):
+ """make a library filename
+ Options:
+ nolibprefix: don't include the lib prefix
+ version : add a version number
+ python : if we should use python module name conventions"""
+
+ if python:
+ libname = ctx.env.pyext_PATTERN % name
+ else:
+ libname = ctx.env.shlib_PATTERN % name
+ if nolibprefix and libname[0:3] == 'lib':
+ libname = libname[3:]
+ if version:
+ if version[0] == '.':
+ version = version[1:]
+ (root, ext) = os.path.splitext(libname)
+ if ext == ".dylib":
+ # special case - version goes before the prefix
+ libname = "%s.%s%s" % (root, version, ext)
+ else:
+ libname = "%s%s.%s" % (root, ext, version)
+ return libname
+Build.BuildContext.make_libname = make_libname
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 2f5d7869f3..02dc44a139 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -164,6 +164,9 @@ def SAMBA_LIBRARY(bld, libname, source,
deps = TO_LIST(deps)
deps.append(obj_target)
+ realname = bld.map_shlib_extension(realname, python=(target_type=='PYTHON'))
+ link_name = bld.map_shlib_extension(link_name, python=(target_type=='PYTHON'))
+
if target_type == 'PYTHON' or realname or not is_bundled:
# Sanitize the library name
bundled_name = libname.lower().replace('_', '-')
@@ -363,7 +366,7 @@ def SAMBA_MODULE(bld, modname, source,
while realname.startswith(subsystem+"_"):
realname = realname[len(subsystem+"_"):]
- realname = bld.env.shlib_PATTERN % realname
+ realname = bld.make_libname(realname)
while realname.startswith("lib"):
realname = realname[len("lib"):]
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index e2b1a278dd..c46c486c12 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -280,7 +280,12 @@ def configure(conf):
if 'HAVE_SYS_TIME_H' in conf.env and 'HAVE_TIME_H' in conf.env:
conf.DEFINE('TIME_WITH_SYS_TIME', 1)
- conf.define('SHLIBEXT', "so", quote=True)
+ # cope with different extensions for libraries
+ (root, ext) = os.path.splitext(conf.env.shlib_PATTERN)
+ if ext[0] == '.':
+ conf.define('SHLIBEXT', ext[1:], quote=True)
+ else:
+ conf.define('SHLIBEXT', "so", quote=True)
conf.CHECK_CODE('long one = 1; return ((char *)(&one))[0]',
execute=True,