summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildtools/wafsamba/samba_bundled.py28
-rw-r--r--buildtools/wafsamba/wafsamba.py33
-rw-r--r--buildtools/wafsamba/wscript19
3 files changed, 65 insertions, 15 deletions
diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py
new file mode 100644
index 0000000000..75317d97ba
--- /dev/null
+++ b/buildtools/wafsamba/samba_bundled.py
@@ -0,0 +1,28 @@
+# functions to support bundled libraries
+
+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:
+ return name
+ if bundled_extension and 'BUNDLED_EXTENSION' in bld.env:
+ return name + '-' + bld.env.BUNDLED_EXTENSION
+ return name
+
+
+def BUILTIN_LIBRARY(bld, name):
+ '''return True if a library should be builtin
+ instead of being built as a shared lib'''
+ if bld.env.DISABLE_SHARED:
+ return True
+ if name in bld.env.BUILTIN_LIBRARIES:
+ return True
+ return False
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 1fc7f8ca54..df778faf5b 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -17,6 +17,7 @@ from samba_asn1 import *
from samba_autoproto import *
from samba_python import *
from samba_deps import *
+from samba_bundled import *
import samba_conftests
LIB_PATH="shared"
@@ -80,6 +81,7 @@ def SAMBA_LIBRARY(bld, libname, source,
vars=None,
install_path=None,
install=True,
+ bundled_extension=True,
enabled=True):
if not enabled:
@@ -93,7 +95,7 @@ def SAMBA_LIBRARY(bld, libname, source,
SET_TARGET_TYPE(bld, libname, 'EMPTY')
return
- if bld.env.DISABLE_SHARED:
+ if BUILTIN_LIBRARY(bld, libname):
obj_target = libname
else:
obj_target = libname + '.objlist'
@@ -114,7 +116,7 @@ def SAMBA_LIBRARY(bld, libname, source,
depends_on = depends_on,
local_include = local_include)
- if bld.env.DISABLE_SHARED:
+ if BUILTIN_LIBRARY(bld, libname):
return
if not SET_TARGET_TYPE(bld, libname, 'LIBRARY'):
@@ -125,11 +127,13 @@ def SAMBA_LIBRARY(bld, libname, source,
deps = TO_LIST(deps)
deps.append(obj_target)
+ bundled_name = BUNDLED_NAME(bld, libname, bundled_extension)
+
bld.SET_BUILD_GROUP(group)
t = bld(
features = 'cc cshlib symlink_lib',
source = [],
- target = libname,
+ target = bundled_name,
samba_cflags = CURRENT_CFLAGS(bld, libname, cflags),
depends_on = depends_on,
samba_deps = deps,
@@ -137,7 +141,8 @@ def SAMBA_LIBRARY(bld, libname, source,
local_include = local_include,
vnum = vnum,
install_path = None,
- ldflags = build_rpath(bld)
+ ldflags = build_rpath(bld),
+ name = libname
)
if install_path is None:
@@ -147,11 +152,11 @@ def SAMBA_LIBRARY(bld, libname, source,
# we don't need the double libraries if rpath is off
if (bld.env.RPATH_ON_INSTALL == False and
bld.env.RPATH_ON_BUILD == False):
- install_target = libname
+ install_target = bundled_name
else:
- install_target = libname + '.inst'
+ install_target = bundled_name + '.inst'
- if install and install_target != libname:
+ if install and install_target != bundled_name:
# create a separate install library, which may have
# different rpath settings
SET_TARGET_TYPE(bld, install_target, 'LIBRARY')
@@ -165,7 +170,7 @@ def SAMBA_LIBRARY(bld, libname, source,
samba_includes = includes,
local_include = local_include,
vnum = vnum,
- install_as = libname,
+ install_as = bundled_name,
install_path = None,
ldflags = install_rpath(bld)
)
@@ -173,14 +178,14 @@ def SAMBA_LIBRARY(bld, libname, source,
if install:
if vnum:
vnum_base = vnum.split('.')[0]
- install_name = 'lib%s.so.%s' % (libname, vnum)
- install_link = 'lib%s.so.%s' % (libname, vnum_base)
+ install_name = 'lib%s.so.%s' % (bundled_name, vnum)
+ install_link = 'lib%s.so.%s' % (bundled_name, vnum_base)
else:
- install_name = 'lib%s.so' % libname
+ install_name = 'lib%s.so' % bundled_name
install_link = None
bld.install_as(os.path.join(install_path, install_name),
- 'lib%s.inst.so' % libname)
+ 'lib%s.inst.so' % bundled_name)
if install_link:
bld.symlink_as(os.path.join(install_path, install_link), install_name)
@@ -334,7 +339,7 @@ def SAMBA_MODULE(bld, modname, source,
# all disabled
bld.ADD_INIT_FUNCTION(subsystem, modname, init_function)
- if internal_module or bld.env.DISABLE_SHARED:
+ if internal_module or BUILTIN_LIBRARY(bld, modname):
# treat internal modules as subsystems for now
SAMBA_SUBSYSTEM(bld, modname, source,
deps=deps,
@@ -574,7 +579,7 @@ def symlink_lib(self):
link_target = getattr(self, 'link_name', '')
if link_target == '':
- link_target = '%s/lib%s.so%s' % (LIB_PATH, self.sname, soext)
+ link_target = '%s/lib%s.so%s' % (LIB_PATH, self.target, soext)
link_source = os_path_relpath(self.link_task.outputs[0].abspath(self.env),
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 563aa52ee0..dbe06f2477 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -4,13 +4,25 @@
import sys, wafsamba
import Options, os, preproc
+from samba_utils import *
def set_options(opt):
opt.tool_options('compiler_cc')
opt.tool_options('gnu_dirs')
+
+ opt.add_option('--bundled-libraries',
+ help=("list of bundled libraries. Can be 'NONE' or 'ALL' [auto]"),
+ action="store", dest='BUNDLED_LIBS', default='')
+ opt.add_option('--bundled-library-extension',
+ help=("name extension for bundled libraries [auto]"),
+ action="store", dest='BUNDLED_EXTENSION', default=None)
+ opt.add_option('--builtin-libraries',
+ help=("list of libraries to build directly into binaries [none]"),
+ action="store", dest='BUILTIN_LIBRARIES', default='')
+
opt.add_option('--libdir',
- help=("object code libraries [PREFIX/lib"),
+ help=("object code libraries [PREFIX/lib]"),
action="store", dest='LIBDIR', default='${PREFIX}/lib')
opt.add_option('--bindir',
help=("user executables [PREFIX/bin]"),
@@ -73,9 +85,14 @@ def configure(conf):
conf.env.BINDIR = Options.options.BINDIR
conf.env.SBINDIR = Options.options.SBINDIR
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
+
# see if we can compile and run a simple C program
conf.CHECK_CODE('printf("hello world\\n")',
define='HAVE_SIMPLE_C_PROG',