summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-29 15:19:13 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:15 +1000
commitd87b77e649bee4e4acbc0ab1d2d462673b541e7a (patch)
tree52e197f635a800146a6d67da89685792ecff3b90 /buildtools
parent02f9364bbcafb440be01c733dab49bee2a5138f4 (diff)
downloadsamba-d87b77e649bee4e4acbc0ab1d2d462673b541e7a.tar.gz
samba-d87b77e649bee4e4acbc0ab1d2d462673b541e7a.tar.bz2
samba-d87b77e649bee4e4acbc0ab1d2d462673b541e7a.zip
build: reuse SAMBA_LIBRARY() to build python modules
This allows the rpath logic to be shared, and simplifies the install logic
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_python.py45
-rw-r--r--buildtools/wafsamba/wafsamba.py44
2 files changed, 47 insertions, 42 deletions
diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index cb3df95207..e9fa88c6ec 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
@@ -39,38 +39,21 @@ def SAMBA_PYTHON(bld, name,
needs_python=True,
enabled=enabled)
- if not enabled:
- SET_TARGET_TYPE(bld, name, 'DISABLED')
- return
-
- if not SET_TARGET_TYPE(bld, name, 'PYTHON'):
- return
-
- deps += ' ' + public_deps
-
- if realname is None:
- realname = '%s.so' % name
link_name = 'python/%s' % realname
- bld.SET_BUILD_GROUP('main')
-
- t = bld(
- features = 'cc cshlib pyext symlink_lib',
- source = source,
- target = name,
- samba_cflags = CURRENT_CFLAGS(bld, name, cflags),
- samba_includes = includes,
- local_include = local_include,
- samba_deps = TO_LIST(deps),
- link_name = link_name,
- name = name,
- install_path = None
- )
-
- destdir='${PYTHONDIR}'
- dname=os.path.dirname(realname)
- if dname:
- destdir += '/' + dname
- bld.INSTALL_FILES(destdir, name + '.so', destname=os.path.basename(realname))
+ bld.SAMBA_LIBRARY(name,
+ source=source,
+ deps=deps,
+ public_deps=public_deps,
+ includes=includes,
+ cflags=cflags,
+ realname=realname,
+ local_include=local_include,
+ vars=vars,
+ link_name=link_name,
+ needs_python=True,
+ target_type='PYTHON',
+ install_path='${PYTHONDIR}',
+ enabled=enabled)
Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 1abe94c42c..291d8acb4b 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -1,7 +1,7 @@
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
-import Build, os, Options, Task, Utils, cc, TaskGen, fnmatch, re
+import Build, os, Options, Task, Utils, cc, TaskGen, fnmatch, re, shutil
from Configure import conf
from Logs import debug
from samba_utils import SUBST_VARS_RECURSIVE
@@ -42,8 +42,11 @@ def SAMBA_BUILD_ENV(conf):
blib_src = os.path.join(conf.srcdir, 'pidl/blib')
mkdir_p(blib_bld + '/man1')
mkdir_p(blib_bld + '/man3')
- if not os.path.lexists(blib_src):
- os.symlink(blib_bld, blib_src)
+ if os.path.islink(blib_src):
+ os.unlink(blib_src)
+ else:
+ shutil.rmtree(blib_src)
+ os.symlink(blib_bld, blib_src)
@@ -79,7 +82,10 @@ def SAMBA_LIBRARY(bld, libname, source,
vars=None,
install_path=None,
install=True,
+ needs_python=False,
+ target_type='LIBRARY',
bundled_extension=True,
+ link_name=None,
enabled=True):
'''define a Samba library'''
@@ -113,12 +119,13 @@ def SAMBA_LIBRARY(bld, libname, source,
group = group,
autoproto = autoproto,
depends_on = depends_on,
+ needs_python = needs_python,
local_include = local_include)
if BUILTIN_LIBRARY(bld, libname):
return
- if not SET_TARGET_TYPE(bld, libname, 'LIBRARY'):
+ if not SET_TARGET_TYPE(bld, libname, target_type):
return
# the library itself will depend on that object target
@@ -126,11 +133,18 @@ def SAMBA_LIBRARY(bld, libname, source,
deps = TO_LIST(deps)
deps.append(obj_target)
- bundled_name = BUNDLED_NAME(bld, libname, bundled_extension)
+ if needs_python:
+ bundled_name = libname
+ else:
+ bundled_name = BUNDLED_NAME(bld, libname, bundled_extension)
+
+ features = 'cc cshlib'
+ if needs_python:
+ features += ' pyext'
bld.SET_BUILD_GROUP(group)
t = bld(
- features = 'cc cshlib symlink_lib',
+ features = features + ' symlink_lib',
source = [],
target = bundled_name,
samba_cflags = CURRENT_CFLAGS(bld, libname, cflags),
@@ -144,6 +158,9 @@ def SAMBA_LIBRARY(bld, libname, source,
name = libname
)
+ if link_name:
+ t.link_name = link_name
+
if install_path is None:
install_path = '${LIBDIR}'
install_path = SUBST_VARS_RECURSIVE(install_path, bld.env)
@@ -158,9 +175,9 @@ def SAMBA_LIBRARY(bld, libname, source,
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')
+ SET_TARGET_TYPE(bld, install_target, target_type)
t = bld(
- features = 'cc cshlib',
+ features = features,
source = [],
target = install_target,
samba_cflags = CURRENT_CFLAGS(bld, libname, cflags),
@@ -175,16 +192,21 @@ def SAMBA_LIBRARY(bld, libname, source,
)
if install:
- if vnum:
+ if realname:
+ install_name = realname
+ install_link = None
+ inst_name = libname + '.inst.so'
+ elif vnum:
vnum_base = vnum.split('.')[0]
install_name = 'lib%s.so.%s' % (bundled_name, vnum)
install_link = 'lib%s.so.%s' % (bundled_name, vnum_base)
+ inst_name = 'lib%s.inst.so' % bundled_name
else:
install_name = 'lib%s.so' % bundled_name
install_link = None
+ inst_name = 'lib%s.inst.so' % bundled_name
- bld.install_as(os.path.join(install_path, install_name),
- 'lib%s.inst.so' % bundled_name)
+ bld.install_as(os.path.join(install_path, install_name), inst_name)
if install_link:
bld.symlink_as(os.path.join(install_path, install_link), install_name)