mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
waf: automap shared library names from .so to the right extension
this should help with MacOSX .dylib libraries
This commit is contained in:
parent
7197bcc513
commit
d485701436
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"):]
|
||||
|
||||
|
@ -280,6 +280,11 @@ 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)
|
||||
|
||||
# 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]',
|
||||
|
Loading…
Reference in New Issue
Block a user