1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

build: added waf build rules for ldb

This commit is contained in:
Andrew Tridgell 2010-03-17 20:32:15 +11:00
parent 635a7ce6c1
commit 2b5a1cc70c
8 changed files with 75 additions and 33 deletions

2
buildtools/waf vendored
View File

@ -1 +1 @@
waf-1.5.13
waf-1.5.13-fixed

BIN
buildtools/waf-1.5.13-fixed Executable file

Binary file not shown.

View File

@ -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
############################################################

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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')
libdeps='tdb tevent',
include_list='include',
vnum=VERSION)
bld.SAMBA_BINARY('ldbadd',
'tools/ldbadd.c',
'ldb')
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')