1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

build: better control over bundled library extensions

This commit is contained in:
Andrew Tridgell 2010-03-28 15:41:49 +11:00
parent 28a05bc1b0
commit 3b380ea7ac
2 changed files with 38 additions and 16 deletions

View File

@ -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

View File

@ -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_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")',