mirror of
https://abf.rosa.ru/djam/samba.git
synced 2025-02-24 09:32:49 +00:00
83 lines
4.4 KiB
Diff
83 lines
4.4 KiB
Diff
From 43b6d6207d68aa8f884d551324554d05281dbde6 Mon Sep 17 00:00:00 2001
|
|
From: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
|
Date: Thu, 24 Jan 2019 02:25:23 +0300
|
|
Subject: [PATCH] Follow shared libs policy
|
|
|
|
Based on https://bugzilla.samba.org/show_bug.cgi?id=9774
|
|
|
|
"On OpenBSD, shared libraries (not "plugins", but those who get linked in) should have the following name scheme:
|
|
libNAME.so.MAJOR.MINOR
|
|
It's also permitted, but highly discouraged to have libNAME.so links pointing to the "versioned" file.
|
|
There was done a lot of work on autotools to fix this. And now Samba4 is using WAF, which does not respect those requirements. Also, new build system does not allow for packager to control shared object's version. Yes, WAF tries to do it's best to control ABI... but it is a must to have such control anyway. On OpenBSD the convention is to use environment variables like LIBfoo_VERSION=MAJOR.MINOR to set SO version to 0.0 for library "foo", and therefore result in libfoo.so.0.0.
|
|
Of course, I do not want to force Samba project doing that work, but I'm just asking, what could be tuned to change the scheme? I grepped different things in buildtools/ directory for a few hours but still did not get where does versioning happen."
|
|
---
|
|
buildtools/wafsamba/samba_install.py | 6 +++---
|
|
buildtools/wafsamba/wafsamba.py | 12 ++++++++++--
|
|
2 files changed, 13 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py
|
|
index 21035bf29db..45a73fa525c 100644
|
|
--- a/buildtools/wafsamba/samba_install.py
|
|
+++ b/buildtools/wafsamba/samba_install.py
|
|
@@ -117,11 +117,15 @@ def install_library(self):
|
|
else:
|
|
inst_name = bld.make_libname(t.target)
|
|
elif self.vnum:
|
|
+ import sys
|
|
vnum_base = self.vnum.split('.')[0]
|
|
install_name = bld.make_libname(target_name, version=self.vnum)
|
|
- install_link = bld.make_libname(target_name, version=vnum_base)
|
|
- inst_name = bld.make_libname(t.target)
|
|
- if not self.private_library:
|
|
+ if sys.platform.startswith('linux'):
|
|
+ install_link = install_name
|
|
+ else:
|
|
+ install_link = bld.make_libname(target_name, version=vnum_base)
|
|
+ inst_name = bld.make_libname(t.target, version=self.vnum)
|
|
+ if not self.private_library and not sys.platform.startswith('linux'):
|
|
# only generate the dev link for non-bundled libs
|
|
dev_link = bld.make_libname(target_name)
|
|
elif getattr(self, 'soname', ''):
|
|
@@ -171,7 +175,7 @@ def apply_vscript(self):
|
|
'''add version-script arguments to library build'''
|
|
|
|
if self.env.HAVE_LD_VERSION_SCRIPT and getattr(self, 'version_script', ''):
|
|
- self.env.append_value('LINKFLAGS', "-Wl,--version-script=%s" %
|
|
+ self.env.append_unique('LINKFLAGS', "-Wl,--version-script=%s" %
|
|
self.version_script)
|
|
self.version_script = None
|
|
|
|
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
|
|
index 12d5421c4a6..56b7e2aace7 100644
|
|
--- a/buildtools/wafsamba/wafsamba.py
|
|
+++ b/buildtools/wafsamba/wafsamba.py
|
|
@@ -219,6 +219,14 @@ def SAMBA_LIBRARY(bld, libname, source,
|
|
deps = TO_LIST(deps)
|
|
deps.append(obj_target)
|
|
|
|
+ saved_lib_version = vnum
|
|
+ osvnum = os.getenv('LIB' + libname.replace('-', '_') + '_VERSION')
|
|
+ if osvnum:
|
|
+ vnum = osvnum
|
|
+ if realname: realname = re.sub(r'(\.[0-9]+)+$', '.' + osvnum, realname)
|
|
+ if link_name: link_name = re.sub(r'(\.[0-9]+)+$', '.' + osvnum, link_name)
|
|
+ if soname: soname = re.sub(r'(\.[0-9]+)+$', '.' + osvnum, soname)
|
|
+
|
|
realname = bld.map_shlib_extension(realname, python=(target_type=='PYTHON'))
|
|
link_name = bld.map_shlib_extension(link_name, python=(target_type=='PYTHON'))
|
|
|
|
@@ -331,9 +339,9 @@ def SAMBA_LIBRARY(bld, libname, source,
|
|
|
|
if pc_files is not None and not private_library:
|
|
if pyembed and bld.env['IS_EXTRA_PYTHON']:
|
|
- bld.PKG_CONFIG_FILES(pc_files, vnum=vnum, extra_name=bld.env['PYTHON_SO_ABI_FLAG'])
|
|
+ bld.PKG_CONFIG_FILES(pc_files, vnum=saved_lib_version, extra_name=bld.env['PYTHON_SO_ABI_FLAG'])
|
|
else:
|
|
- bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
|
|
+ bld.PKG_CONFIG_FILES(pc_files, vnum=saved_lib_version)
|
|
|
|
if (manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and
|
|
bld.env['XSLTPROC_MANPAGES']):
|
|
--
|
|
2.17.1
|
|
|