From 3b380ea7ac9f33f208a9479d34bd514f8e3d5bf4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 28 Mar 2010 15:41:49 +1100 Subject: build: better control over bundled library extensions --- buildtools/wafsamba/samba_bundled.py | 32 +++++++++++++++++++++++--------- buildtools/wafsamba/wscript | 22 +++++++++++++++------- 2 files changed, 38 insertions(+), 16 deletions(-) (limited to 'buildtools/wafsamba') diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py index 75317d97ba..d4dbe221db 100644 --- a/buildtools/wafsamba/samba_bundled.py +++ b/buildtools/wafsamba/samba_bundled.py @@ -3,18 +3,15 @@ from Configure import conf from samba_utils import * -@conf -def BUNDLED_LIBRARY_EXTENSION(conf, extension): - '''set extension to add to bundled libraries''' - if not 'BUNDLED_EXTENSION' in conf.env: - conf.env.BUNDLED_EXTENSION = extension - def BUNDLED_NAME(bld, name, bundled_extension): '''possibly rename a library to include a bundled extension''' - if bld.env.DISABLE_SHARED: + if bld.env.DISABLE_SHARED or not bundled_extension: return name - if bundled_extension and 'BUNDLED_EXTENSION' in bld.env: - return name + '-' + bld.env.BUNDLED_EXTENSION + if name in bld.env.BUNDLED_EXTENSION_EXCEPTION: + return name + extension = getattr(bld.env, 'BUNDLED_EXTENSION', '') + if extension: + return name + '-' + extension return name @@ -26,3 +23,20 @@ def BUILTIN_LIBRARY(bld, name): if name in bld.env.BUILTIN_LIBRARIES: return True return False + + +def BUILTIN_DEFAULT(opt, builtins): + '''set a comma separated default list of builtin libraries for this package''' + if 'BUILTIN_LIBRARIES_DEFAULT' in Options.options: + return + Options.options['BUILTIN_LIBRARIES_DEFAULT'] = builtins +Options.Handler.BUILTIN_DEFAULT = BUILTIN_DEFAULT + + +def BUNDLED_EXTENSION_DEFAULT(opt, extension, noextenion=''): + '''set a default bundled library extension''' + if 'BUNDLED_EXTENSION_DEFAULT' in Options.options: + return + Options.options['BUNDLED_EXTENSION_DEFAULT'] = extension + Options.options['BUNDLED_EXTENSION_EXCEPTION'] = noextenion +Options.Handler.BUNDLED_EXTENSION_DEFAULT = BUNDLED_EXTENSION_DEFAULT diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index dbe06f2477..315c3e58a9 100644 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -14,12 +14,21 @@ def set_options(opt): opt.add_option('--bundled-libraries', help=("list of bundled libraries. Can be 'NONE' or 'ALL' [auto]"), action="store", dest='BUNDLED_LIBS', default='') + + extension_default = Options.options['BUNDLED_EXTENSION_DEFAULT'] opt.add_option('--bundled-library-extension', - help=("name extension for bundled libraries [auto]"), - action="store", dest='BUNDLED_EXTENSION', default=None) + help=("name extension for bundled libraries [%s]" % extension_default), + action="store", dest='BUNDLED_EXTENSION', default=extension_default) + + extension_exception = Options.options['BUNDLED_EXTENSION_EXCEPTION'] + opt.add_option('--bundled-extension-exception', + help=("list of libraries to not apply extension to [%s]" % extension_exception), + action="store", dest='BUNDLED_EXTENSION_EXCEPTION', default=extension_exception) + + builtin_defauilt = Options.options['BUILTIN_LIBRARIES_DEFAULT'] opt.add_option('--builtin-libraries', - help=("list of libraries to build directly into binaries [none]"), - action="store", dest='BUILTIN_LIBRARIES', default='') + help=("list of libraries to build directly into binaries [%s]" % builtin_defauilt), + action="store", dest='BUILTIN_LIBRARIES', default=builtin_defauilt) opt.add_option('--libdir', help=("object code libraries [PREFIX/lib]"), @@ -87,11 +96,10 @@ def configure(conf): conf.env.MODULESDIR = Options.options.MODULESDIR conf.env.BUNDLED_LIBS = Options.options.BUNDLED_LIBS.split(',') conf.env.BUILTIN_LIBRARIES = Options.options.BUILTIN_LIBRARIES.split(',') - conf.env.DISABLE_SHARED = Options.options.disable_shared - if Options.options.BUNDLED_EXTENSION: - conf.env.BUNDLED_EXTENSION = Options.options.BUNDLED_EXTENSION + conf.env.BUNDLED_EXTENSION = Options.options.BUNDLED_EXTENSION + conf.env.BUNDLED_EXTENSION_EXCEPTION = Options.options.BUNDLED_EXTENSION_EXCEPTION.split(',') # see if we can compile and run a simple C program conf.CHECK_CODE('printf("hello world\\n")', -- cgit