summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-08-18 17:34:09 +0200
committerStefan Metzmacher <metze@samba.org>2021-11-30 15:53:34 +0000
commitf168f548784e643335cf0351a5f506dbc087f65f (patch)
tree872776bebef5f50c4ccfdd8644ea35bd6026402a /buildtools
parent38d37d4a53285f08ce805f28b0659456c197f023 (diff)
downloadsamba-f168f548784e643335cf0351a5f506dbc087f65f.tar.gz
wafsamba: allow SAMBA_LIBRARY() to get and use original 'version-script.map' for private libraries
We'll soon use this for the internal Heimdal build and take the raw version-script.map files in order to create our own .vscript file with our private version suffix. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14780 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_abi.py56
-rw-r--r--buildtools/wafsamba/wafsamba.py19
2 files changed, 73 insertions, 2 deletions
diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index 725f6ddd06e..80643aa28d7 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -157,6 +157,46 @@ def abi_process_file(fname, version, symmap):
if not symname in symmap:
symmap[symname] = version
+def version_script_map_process_file(fname, version, abi_match):
+ '''process one standard version_script file, adding the symbols to the
+ abi_match'''
+ in_section = False
+ in_global = False
+ in_local = False
+ for _line in Utils.readf(fname).splitlines():
+ line = _line.strip()
+ if line == "":
+ continue
+ if line.startswith("#"):
+ continue
+ if line.endswith(" {"):
+ in_section = True
+ continue
+ if line == "};":
+ assert in_section
+ in_section = False
+ in_global = False
+ in_local = False
+ continue
+ if not in_section:
+ continue
+ if line == "global:":
+ in_global = True
+ in_local = False
+ continue
+ if line == "local:":
+ in_global = False
+ in_local = True
+ continue
+
+ symname = line.split(";")[0]
+ assert symname != ""
+ if in_local:
+ if symname == "*":
+ continue
+ symname = "!%s" % symname
+ if not symname in abi_match:
+ abi_match.append(symname)
def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match):
"""Write a vscript file for a library in --version-script format.
@@ -223,6 +263,9 @@ def abi_build_vscript(task):
versions.append(version)
abi_process_file(fname, version, symmap)
continue
+ if basename == "version-script.map":
+ version_script_map_process_file(fname, task.env.VERSION, abi_match)
+ continue
raise Errors.WafError('Unsupported input "%s"' % fname)
if task.env.PRIVATE_LIBRARY:
# For private libraries we need to inject
@@ -241,6 +284,19 @@ def abi_build_vscript(task):
finally:
f.close()
+def VSCRIPT_MAP_PRIVATE(bld, libname, orig_vscript, version, private_vscript):
+ version = version.replace("-", "_").replace("+","_").upper()
+ t = bld.SAMBA_GENERATOR(private_vscript,
+ rule=abi_build_vscript,
+ source=orig_vscript,
+ group='vscripts',
+ target=private_vscript)
+ t.env.ABI_MATCH = []
+ t.env.VERSION = version
+ t.env.LIBNAME = libname
+ t.env.PRIVATE_LIBRARY = True
+ t.vars = ['LIBNAME', 'VERSION', 'ABI_MATCH', 'PRIVATE_LIBRARY']
+Build.BuildContext.VSCRIPT_MAP_PRIVATE = VSCRIPT_MAP_PRIVATE
def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None, private_library=False):
'''generate a vscript file for our public libraries'''
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index b0fd817410f..185ef3b73a2 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -127,6 +127,7 @@ def SAMBA_LIBRARY(bld, libname, source,
link_name=None,
abi_directory=None,
abi_match=None,
+ orig_vscript_map=None,
hide_symbols=False,
manpages=None,
private_library=False,
@@ -160,6 +161,17 @@ def SAMBA_LIBRARY(bld, libname, source,
raise Errors.WafError("private library '%s' must not have public header files" %
libname)
+ if orig_vscript_map and not private_library:
+ raise Errors.WafError("public library '%s' must not have orig_vscript_map" %
+ libname)
+
+ if orig_vscript_map and abi_directory:
+ raise Errors.WafError("private library '%s' with orig_vscript_map must not have abi_directory" %
+ libname)
+ if orig_vscript_map and abi_match:
+ raise Errors.WafError("private library '%s' with orig_vscript_map must not have abi_match" %
+ libname)
+
if LIB_MUST_BE_PRIVATE(bld, libname) and target_type not in ['PLUGIN']:
private_library = True
@@ -327,8 +339,11 @@ def SAMBA_LIBRARY(bld, libname, source,
version = None
if version:
vscript = "%s.vscript" % libname
- bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript,
- abi_match, private_library)
+ if orig_vscript_map:
+ bld.VSCRIPT_MAP_PRIVATE(version_libname, orig_vscript_map, version, vscript)
+ else:
+ bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript,
+ abi_match, private_library)
fullname = apply_pattern(bundled_name, bld.env.cshlib_PATTERN)
fullpath = bld.path.find_or_declare(fullname)
vscriptpath = bld.path.find_or_declare(vscript)