summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_utils.py
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/samba_utils.py
parent7197bcc513e707676f10734cffd6f2f494a360c1 (diff)
downloadsamba-d48570143656d1c570c282f8e21e058508910f3c.tar.gz
waf: automap shared library names from .so to the right extension
this should help with MacOSX .dylib libraries
Diffstat (limited to 'buildtools/wafsamba/samba_utils.py')
-rw-r--r--buildtools/wafsamba/samba_utils.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 7ce9f757e95..e86056e7e80 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