From cd7190b802b4c4c645a7973156833b2a17db1965 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 20 Oct 2010 18:17:13 +1100 Subject: waf: allows libraries to be marked as private_library=True this is for libraries where we make no promises about the API, but where we wish it to be a library to allow our binaries to use common code. These libraries always get the project suffix added to the library name, to ensure we are in a separate namespace Pair-Programmed-With: Andrew Bartlett --- buildtools/wafsamba/samba_bundled.py | 4 ++-- buildtools/wafsamba/wafsamba.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py index 822e49ce49..e5310dae3d 100644 --- a/buildtools/wafsamba/samba_bundled.py +++ b/buildtools/wafsamba/samba_bundled.py @@ -4,11 +4,11 @@ from Configure import conf import Logs from samba_utils import * -def BUNDLED_NAME(bld, name, bundled_extension): +def BUNDLED_NAME(bld, name, bundled_extension, private_library): '''possibly rename a library to include a bundled extension''' if bld.env.DISABLE_SHARED or not bundled_extension: return name - if name in bld.env.BUNDLED_EXTENSION_EXCEPTION: + if name in bld.env.BUNDLED_EXTENSION_EXCEPTION and not private_library: return name extension = getattr(bld.env, 'BUNDLED_EXTENSION', '') if extension: diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index e848d39333..42f006eaf0 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -116,6 +116,7 @@ def SAMBA_LIBRARY(bld, libname, source, hide_symbols=False, is_bundled=False, manpages=None, + private_library=False, enabled=True): '''define a Samba library''' @@ -167,13 +168,22 @@ def SAMBA_LIBRARY(bld, libname, source, realname = bld.map_shlib_extension(realname, python=(target_type=='PYTHON')) link_name = bld.map_shlib_extension(link_name, python=(target_type=='PYTHON')) + if private_library: + # private libraries always get the 'bundling' treatment with respect + # to the library name suffix + is_bundled = True + + # we don't want any public libraries without version numbers + if not private_library and vnum is None and target_type != 'PYTHON' and not realname: + raise Utils.WafError("public library '%s' must have a vnum" % libname) + if target_type == 'PYTHON' or realname or not is_bundled: # Sanitize the library name bundled_name = libname.lower().replace('_', '-') while bundled_name.startswith("lib"): bundled_name = bundled_name[3:] else: - bundled_name = BUNDLED_NAME(bld, libname, bundled_extension) + bundled_name = BUNDLED_NAME(bld, libname, bundled_extension, private_library) features = 'cc cshlib symlink_lib install_lib' if target_type == 'PYTHON': -- cgit