From 6dbf576e819d32d2a25e7e1fa7ac50d5764db966 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 1 Apr 2010 12:30:56 +1100 Subject: build: only link install targets at install time --- buildtools/wafsamba/samba_deps.py | 17 +++++++++++------ buildtools/wafsamba/samba_python.py | 23 ++++++++++++----------- buildtools/wafsamba/wafsamba.py | 16 ++++++++-------- 3 files changed, 31 insertions(+), 25 deletions(-) (limited to 'buildtools') diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py index 19cd451161..3c5c327c1d 100644 --- a/buildtools/wafsamba/samba_deps.py +++ b/buildtools/wafsamba/samba_deps.py @@ -311,7 +311,7 @@ def add_samba_attributes(bld, tgt_list): t.samba_includes_extended = TO_LIST(t.samba_includes)[:] t.ccflags = getattr(t, 'samba_cflags', '') install_target = getattr(t, 'install_target', None) - if install_target: + if Options.is_install and install_target: t2 = bld.name_to_obj(install_target, bld.env) t2.sname = install_target t2.samba_type = t.samba_type @@ -663,6 +663,7 @@ def calculate_final_deps(bld, tgt_list, loops): # remove objects that are also available in linked libs reduce_objects(bld, tgt_list) + reduce_objects(bld, tgt_list) # add in any syslib dependencies for t in tgt_list: @@ -784,11 +785,12 @@ def load_samba_deps(bld, tgt_list): return False tgt_list_extended = tgt_list[:] - for t in tgt_list: - install_target = getattr(t, 'install_target', None) - if install_target: - t2 = bld.name_to_obj(install_target, bld.env) - tgt_list_extended.append(t2) + if Options.is_install: + for t in tgt_list: + install_target = getattr(t, 'install_target', None) + if install_target: + t2 = bld.name_to_obj(install_target, bld.env) + tgt_list_extended.append(t2) # put outputs in place for t in tgt_list_extended: @@ -815,6 +817,9 @@ def add_install_deps(bld, tgt_list): This ensures that all the install targets have identical dependencies to the build targets. ''' + if not Options.is_install: + return + for t in tgt_list[:]: install_target = getattr(t, 'install_target', None) if install_target: diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py index e9fa88c6ec..46e6657ce3 100644 --- a/buildtools/wafsamba/samba_python.py +++ b/buildtools/wafsamba/samba_python.py @@ -27,17 +27,18 @@ def SAMBA_PYTHON(bld, name, if realname is None: # a SAMBA_PYTHON target without a realname is just a - # subsystem with needs_python=True - return bld.SAMBA_SUBSYSTEM(name, - source=source, - deps=deps, - public_deps=public_deps, - cflags=cflags, - includes=includes, - init_function_sentinal=init_function_sentinal, - local_include=local_include, - needs_python=True, - enabled=enabled) + # library with needs_python=True + bld.SAMBA_LIBRARY(name, + source=source, + deps=deps, + public_deps=public_deps, + includes=includes, + cflags=cflags, + local_include=local_include, + vars=vars, + needs_python=True, + enabled=enabled) + return link_name = 'python/%s' % realname diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index a7258d3e9e..ecb044b5a1 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -137,14 +137,16 @@ def SAMBA_LIBRARY(bld, libname, source, deps = TO_LIST(deps) deps.append(obj_target) - if needs_python: + if target_type == 'PYTHON': bundled_name = libname else: bundled_name = BUNDLED_NAME(bld, libname, bundled_extension) features = 'cc cshlib' - if needs_python: + if target_type == 'PYTHON': features += ' pyext' + elif needs_python: + features += ' pyembed' bld.SET_BUILD_GROUP(group) t = bld( @@ -178,10 +180,9 @@ def SAMBA_LIBRARY(bld, libname, source, install_path = '${LIBDIR}' install_path = SUBST_VARS_RECURSIVE(install_path, bld.env) - if install and install_target != bundled_name: + if Options.is_install and install and install_target != bundled_name: # create a separate install library, which may have # different rpath settings - SET_TARGET_TYPE(bld, install_target, target_type) t = bld( features = features, source = [], @@ -197,7 +198,7 @@ def SAMBA_LIBRARY(bld, libname, source, ldflags = install_rpath(bld) ) - if install: + if Options.is_install and install: if realname: install_name = realname install_link = None @@ -310,10 +311,9 @@ def SAMBA_BINARY(bld, binname, source, if install: t.install_target = install_target - if install and install_target != binname: + if Options.is_install and install and install_target != binname: # we create a separate 'install' binary, which # will have different rpath settings - SET_TARGET_TYPE(bld, install_target, 'BINARY') t = bld( features = features, source = [], @@ -329,7 +329,7 @@ def SAMBA_BINARY(bld, binname, source, ldflags = install_rpath(bld) ) - if install: + if Options.is_install and install: bld.install_as(os.path.join(install_path, binname), install_target, chmod=0755) -- cgit