summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-17 20:32:15 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:34 +1000
commit2b5a1cc70cbc5bafe6183300b131d95505c03b36 (patch)
treefdcb0321be5cfd39d13b0a03cfdbf4394e7ac7bc
parent635a7ce6c1dfbfa2fd9ccefa0253a0a846a29f94 (diff)
downloadsamba-2b5a1cc70cbc5bafe6183300b131d95505c03b36.tar.gz
samba-2b5a1cc70cbc5bafe6183300b131d95505c03b36.tar.bz2
samba-2b5a1cc70cbc5bafe6183300b131d95505c03b36.zip
build: added waf build rules for ldb
l---------buildtools/waf2
-rwxr-xr-xbuildtools/waf-1.5.13-fixedbin0 -> 89817 bytes
-rw-r--r--lib/replace/wafsamba.py45
-rw-r--r--lib/replace/wscript7
-rw-r--r--lib/talloc/wscript6
-rw-r--r--lib/tdb/wscript6
-rw-r--r--lib/tevent/wscript10
-rw-r--r--source4/lib/ldb/wscript34
8 files changed, 76 insertions, 34 deletions
diff --git a/buildtools/waf b/buildtools/waf
index 734fbd13a9..50ecc12ebb 120000
--- a/buildtools/waf
+++ b/buildtools/waf
@@ -1 +1 @@
-waf-1.5.13 \ No newline at end of file
+waf-1.5.13-fixed \ No newline at end of file
diff --git a/buildtools/waf-1.5.13-fixed b/buildtools/waf-1.5.13-fixed
new file mode 100755
index 0000000000..a3849535c0
--- /dev/null
+++ b/buildtools/waf-1.5.13-fixed
Binary files differ
diff --git a/lib/replace/wafsamba.py b/lib/replace/wafsamba.py
index f57ce28417..7c05aeaf9c 100644
--- a/lib/replace/wafsamba.py
+++ b/lib/replace/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
+import Build, os, Logs
from Configure import conf
@@ -45,14 +45,14 @@ def CHECK_FUNCS_IN(conf, list, library):
if conf.check(lib=library, uselib_store=library):
for f in list.split():
conf.check(function_name=f, lib=library, header_name=conf.env.hlist)
+ conf.env['LIB_' + library.upper()] = library
#################################################
# write out config.h in the right directory
@conf
def SAMBA_CONFIG_H(conf):
- import os
- if os.path.normpath(conf.curdir) == os.path.normpath(conf.srcdir):
- conf.write_config_header('config.h')
+ if os.path.normpath(conf.curdir) == os.path.normpath(os.environ.get('PWD')):
+ conf.write_config_header('config.h', top=True)
##############################################################
@@ -75,7 +75,7 @@ def set_rpath(bld):
if Options.is_install:
bld.env['RPATH'] = ['-Wl,-rpath=' + bld.env.PREFIX + '/lib']
else:
- bld.env.append_value('RPATH', '-Wl,-rpath=build/default')
+ bld.env.append_value('RPATH', '-Wl,-rpath=bin/lib')
Build.BuildContext.set_rpath = set_rpath
@@ -88,6 +88,16 @@ def SUBDIR(bld, subdir, list):
return ret
Build.BuildContext.SUBDIR = SUBDIR
+#################################################################
+# create the samba build environment
+def SAMBA_BUILD_ENV(bld):
+ bld(
+ target = 'binlib',
+ rule = 'test -d lib || mkdir -p lib && touch ${TGT}',
+ shell = True
+ )
+Build.BuildContext.SAMBA_BUILD_ENV = SAMBA_BUILD_ENV
+
################################################################
# this will contain the set of includes needed per Samba library
@@ -127,21 +137,40 @@ def SAMBA_LIBRARY(bld, libname, source_list,
features = 'cc cshlib',
source = source_list,
target=libname,
- includes='. ' + ilist,
+ includes='. ' + os.environ.get('PWD') + '/bin/default ' + ilist,
vnum=vnum)
+
+ # put a link to the library in bin/lib
+ soext=""
+ if vnum is not None:
+ soext = '.' + vnum.split('.')[0]
+ bld(
+ source = 'lib%s.so' % libname,
+ rule = 'ln -sf ../${SRC}%s lib' % soext,
+ after = 'binlib'
+ )
bld.SAMBA_LIBRARY_INCLUDES[libname] = ilist
bld.SAMBA_LIBRARY_DEPS[libname] = libdeps
Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
#################################################################
# define a Samba binary
-def SAMBA_BINARY(bld, binname, source_list, libdeps='', include_list=''):
+def SAMBA_BINARY(bld, binname, source_list, libdeps='', syslibs='', include_list=''):
+ #print('binname=%s libs=%s' % (binname, bld.SAMBA_LIBRARY_LIB_LIST(libdeps)))
bld(
features = 'cc cprogram',
source = source_list,
target = binname,
uselib_local = bld.SAMBA_LIBRARY_LIB_LIST(libdeps),
- includes = '. ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(libdeps) + include_list)
+ uselib = syslibs,
+ includes = '. ' + os.environ.get('PWD') + '/bin/default ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(libdeps) + include_list,
+ top=True)
+ # put a link to the binary in bin/
+ bld(
+ source = binname,
+ rule = 'ln -sf ${SRC} .',
+ )
+
Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
############################################################
diff --git a/lib/replace/wscript b/lib/replace/wscript
index c2e545f882..5c1975bf5f 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -1,5 +1,5 @@
-srcdir = '.'
-blddir = 'build'
+srcdir = '../..'
+blddir = 'bin'
import Options, os, wafsamba
@@ -89,6 +89,7 @@ def configure(conf):
conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs')
conf.CHECK_FUNCS_IN('dlopen dlsym dlerror dlclose', 'dl')
+ conf.CHECK_FUNCS_IN('poptGetContext', 'popt')
conf.check_cc(fragment='''
#include <stdarg.h>
@@ -153,6 +154,8 @@ def build(bld):
REPLACE_SOURCE = 'replace.c snprintf.c'
+ bld.SAMBA_BUILD_ENV()
+
bld.SAMBA_LIBRARY('replace',
REPLACE_SOURCE)
diff --git a/lib/talloc/wscript b/lib/talloc/wscript
index 989a8a8b41..ad8ef3bd45 100644
--- a/lib/talloc/wscript
+++ b/lib/talloc/wscript
@@ -1,9 +1,9 @@
VERSION = '2.0.1'
-srcdir = '.'
-blddir = 'build'
+srcdir = '../..'
+blddir = 'bin'
-LIBREPLACE_DIR='../replace'
+LIBREPLACE_DIR= srcdir + '/lib/replace'
def set_options(opt):
opt.recurse(LIBREPLACE_DIR)
diff --git a/lib/tdb/wscript b/lib/tdb/wscript
index c746af6def..d3184d4922 100644
--- a/lib/tdb/wscript
+++ b/lib/tdb/wscript
@@ -1,9 +1,9 @@
VERSION='1.2.1'
-srcdir = '.'
-blddir = 'build'
+srcdir = '../..'
+blddir = 'bin'
-LIBREPLACE_DIR='../replace'
+LIBREPLACE_DIR= srcdir + '/lib/replace'
def set_options(opt):
opt.recurse(LIBREPLACE_DIR)
diff --git a/lib/tevent/wscript b/lib/tevent/wscript
index 87d6037aea..aaa3ce7fb7 100644
--- a/lib/tevent/wscript
+++ b/lib/tevent/wscript
@@ -1,15 +1,18 @@
VERSION = '0.9.8'
-srcdir = '.'
-blddir = 'build'
+srcdir = '../..'
+blddir = 'bin'
-LIBREPLACE_DIR='../replace'
+LIBREPLACE_DIR= srcdir + '/lib/replace'
+LIBTALLOC_DIR= srcdir + '/lib/talloc'
def set_options(opt):
opt.recurse(LIBREPLACE_DIR)
+ opt.recurse(LIBTALLOC_DIR)
def configure(conf):
conf.sub_config(LIBREPLACE_DIR)
+ conf.sub_config(LIBTALLOC_DIR)
conf.CHECK_HEADERS('sys/epoll.h')
conf.CHECK_FUNCS('epoll_create')
@@ -18,6 +21,7 @@ def configure(conf):
def build(bld):
bld.add_subdirs(LIBREPLACE_DIR)
+ bld.add_subdirs(LIBTALLOC_DIR)
SRC = '''tevent.c tevent_debug.c tevent_epoll.c tevent_fd.c tevent_immediate.c
tevent_queue.c tevent_req.c tevent_select.c
diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript
index cab5388a94..1103ec6299 100644
--- a/source4/lib/ldb/wscript
+++ b/source4/lib/ldb/wscript
@@ -1,26 +1,28 @@
-srcdir = '.'
-blddir = 'build'
+VERSION = '0.9.10'
-LIBTDB_DIR='../../../lib/tdb'
-LIBTALLOC_DIR='../../../lib/talloc'
+srcdir = '../../..'
+blddir = 'bin'
+
+LIBTDB_DIR= srcdir + '/lib/tdb'
+LIBTEVENT_DIR= srcdir + '/lib/tevent'
def set_options(opt):
opt.recurse(LIBTDB_DIR)
- opt.recurse(LIBTALLOC_DIR)
+ opt.recurse(LIBTEVENT_DIR)
def configure(conf):
conf.sub_config(LIBTDB_DIR)
- conf.sub_config(LIBTALLOC_DIR)
+ conf.sub_config(LIBTEVENT_DIR)
+ conf.CONFIG_PATH('LDB_MODULESDIR', conf.env['LIBDIR'] + '/ldb')
conf.SAMBA_CONFIG_H()
def build(bld):
bld.add_subdirs(LIBTDB_DIR)
- bld.add_subdirs(LIBTALLOC_DIR)
+ bld.add_subdirs(LIBTEVENT_DIR)
LDB_TDB_SRC = bld.SUBDIR('ldb_tdb',
'''ldb_tdb.c ldb_pack.c ldb_search.c ldb_index.c
ldb_cache.c ldb_tdb_wrap.c''')
- print "LDB_TDB_SRC=%s" % LDB_TDB_SRC
LDB_MAP_SRC = bld.SUBDIR('ldb_map',
'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
@@ -35,9 +37,13 @@ def build(bld):
bld.SAMBA_LIBRARY('ldb',
LDB_TDB_SRC + ' ' + COMMON_SRC + ' ' + MODULES_SRC,
- 'tdb talloc',
- 'include')
-
- bld.SAMBA_BINARY('ldbadd',
- 'tools/ldbadd.c',
- 'ldb')
+ libdeps='tdb tevent',
+ include_list='include',
+ vnum=VERSION)
+
+ LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename ldbtest'
+ for t in LDB_TOOLS.split():
+ bld.SAMBA_BINARY(t,
+ 'tools/%s.c tools/ldbutil.c tools/cmdline.c' % t,
+ libdeps='ldb',
+ syslibs='dl popt')