summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-29 22:27:17 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:17 +1000
commit874e39cbf00325cb379ddea274ae4288e32f8f72 (patch)
tree249dfe4463f3c302f8a1737b43c129b893d76fa0
parented5522adf24903a500e3565ea5eb443ed28440cc (diff)
downloadsamba-874e39cbf00325cb379ddea274ae4288e32f8f72.tar.gz
samba-874e39cbf00325cb379ddea274ae4288e32f8f72.tar.bz2
samba-874e39cbf00325cb379ddea274ae4288e32f8f72.zip
s4-waf: added implied_deps for system libraries
when we use a system version of a library such as talloc, then we no longer get the automtica dependency propogation of talloc implying libreplace. That means we don't get the includes for libreplace, which means things can fail to build. To fix this this change adds an implied_deps option to CHECK_BUNDLED_SYSTEM(), which tells the samba_deps module to add an implied dependency on the listed targets if the system library is chosen.
-rw-r--r--buildtools/wafsamba/samba_bundled.py7
-rw-r--r--buildtools/wafsamba/samba_deps.py14
-rw-r--r--lib/talloc/wscript3
-rw-r--r--lib/tdb/wscript3
-rw-r--r--lib/tevent/wscript3
-rw-r--r--source4/lib/ldb/wscript3
6 files changed, 27 insertions, 6 deletions
diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py
index b2d1b0ef14..28116fcd69 100644
--- a/buildtools/wafsamba/samba_bundled.py
+++ b/buildtools/wafsamba/samba_bundled.py
@@ -46,7 +46,8 @@ Options.Handler.BUNDLED_EXTENSION_DEFAULT = BUNDLED_EXTENSION_DEFAULT
@runonce
@conf
def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
- checkfunctions=None, headers=None, onlyif=None):
+ checkfunctions=None, headers=None,
+ onlyif=None, implied_deps=None):
'''check if a library is available as a system library.
this first tries via pkg-config, then if that fails
tries by testing for a specified function in the specified lib
@@ -76,10 +77,14 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
msg='Checking for system %s >= %s' % (libname, minversion)):
conf.SET_TARGET_TYPE(libname, 'SYSLIB')
conf.env[found] = True
+ if implied_deps:
+ conf.SET_SYSLIB_DEPS(libname, implied_deps)
return True
if checkfunctions is not None:
if conf.CHECK_FUNCS_IN(checkfunctions, libname, headers=headers, empty_decl=False):
conf.env[found] = True
+ if implied_deps:
+ conf.SET_SYSLIB_DEPS(libname, implied_deps)
return True
conf.env[found] = False
if 'NONE' in conf.env.BUNDLED_LIBS or '!'+libname in conf.env.BUNDLED_LIBS:
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index 02d4c421d5..bc9325f214 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -22,6 +22,13 @@ def TARGET_ALIAS(bld, target, alias):
Build.BuildContext.TARGET_ALIAS = TARGET_ALIAS
+@conf
+def SET_SYSLIB_DEPS(conf, target, deps):
+ '''setup some implied dependencies for a SYSLIB'''
+ cache = LOCAL_CACHE(conf, 'SYSLIB_DEPS')
+ cache[target] = deps
+
+
def EXPAND_ALIAS(bld, target):
'''expand a target name via an alias'''
aliases = LOCAL_CACHE(bld, 'TARGET_ALIAS')
@@ -308,6 +315,7 @@ def build_direct_deps(bld, tgt_list):
'''build the direct_objects and direct_libs sets for each target'''
targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
+ syslib_deps = LOCAL_CACHE(bld, 'SYSLIB_DEPS')
global_deps = bld.env.GLOBAL_DEPENDENCIES
for t in tgt_list:
@@ -326,6 +334,10 @@ def build_direct_deps(bld, tgt_list):
continue
if targets[d] == 'SYSLIB':
t.direct_syslibs.add(d)
+ if d in syslib_deps:
+ for implied in TO_LIST(syslib_deps[d]):
+ print("Adding implied lib %s to %s" % (implied, t.sname))
+ t.direct_libs.add(implied)
continue
t2 = bld.name_to_obj(d, bld.env)
if t2 is None:
@@ -622,7 +634,7 @@ savedeps_version = 3
savedeps_inputs = ['samba_deps', 'samba_includes', 'local_include', 'local_include_first', 'samba_cflags', 'source']
savedeps_outputs = ['uselib', 'uselib_local', 'add_objects', 'includes', 'ccflags']
savedeps_outenv = ['INC_PATHS']
-savedeps_caches = ['GLOBAL_DEPENDENCIES', 'TARGET_ALIAS', 'TARGET_TYPE', 'INIT_FUNCTIONS']
+savedeps_caches = ['GLOBAL_DEPENDENCIES', 'TARGET_ALIAS', 'TARGET_TYPE', 'INIT_FUNCTIONS', 'SYSLIB_DEPS']
savedeps_files = ['buildtools/wafsamba/samba_deps.py']
def save_samba_deps(bld, tgt_list):
diff --git a/lib/talloc/wscript b/lib/talloc/wscript
index e8aa1774e4..3526d5a730 100644
--- a/lib/talloc/wscript
+++ b/lib/talloc/wscript
@@ -19,7 +19,8 @@ def set_options(opt):
def configure(conf):
conf.sub_config(LIBREPLACE_DIR)
- if conf.CHECK_BUNDLED_SYSTEM('talloc', minversion=VERSION):
+ if conf.CHECK_BUNDLED_SYSTEM('talloc', minversion=VERSION,
+ implied_deps='replace'):
conf.define('USING_SYSTEM_TALLOC', 1)
conf.SAMBA_CONFIG_H()
diff --git a/lib/tdb/wscript b/lib/tdb/wscript
index 365c384201..d16516b8b5 100644
--- a/lib/tdb/wscript
+++ b/lib/tdb/wscript
@@ -20,7 +20,8 @@ def set_options(opt):
def configure(conf):
conf.sub_config(LIBREPLACE_DIR)
- if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION):
+ if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
+ implied_deps='replace'):
conf.define('USING_SYSTEM_TDB', 1)
conf.SAMBA_CONFIG_H()
diff --git a/lib/tevent/wscript b/lib/tevent/wscript
index a84dad663c..30db216de1 100644
--- a/lib/tevent/wscript
+++ b/lib/tevent/wscript
@@ -22,7 +22,8 @@ def configure(conf):
conf.sub_config(LIBREPLACE_DIR)
conf.sub_config(LIBTALLOC_DIR)
- if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION, onlyif='talloc'):
+ if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION,
+ onlyif='talloc', implied_deps='replace talloc'):
conf.define('USING_SYSTEM_TEVENT', 1)
if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript
index a7419e1981..18a9f4c271 100644
--- a/source4/lib/ldb/wscript
+++ b/source4/lib/ldb/wscript
@@ -32,7 +32,8 @@ def configure(conf):
if not s4_build:
if conf.CHECK_BUNDLED_SYSTEM('ldb', minversion=VERSION,
- onlyif='talloc tdb tevent'):
+ onlyif='talloc tdb tevent',
+ implied_deps='replace talloc tdb tevent'):
conf.define('USING_SYSTEM_LDB', 1)
# we need this for the ldap backend
conf.CHECK_FUNCS_IN('ber_flush ldap_open', 'lber ldap', headers='lber.h ldap.h', mandatory=True)