s4-waf: move to a universal method of recursing into subdirs
[nivanova/samba-autobuild/.git] / lib / talloc / wscript
1 #!/usr/bin/env python
2
3 APPNAME = 'talloc'
4 VERSION = '2.0.2'
5
6 blddir = 'bin'
7
8 import os, sys
9
10 # find the buildtools directory
11 buildtools = 'buildtools'
12 while not os.path.exists(buildtools) and len(buildtools.split('/')) < 5:
13     buildtools = '../' + buildtools
14 srcdir = os.path.dirname(buildtools) or '.'
15
16 sys.path.insert(0, buildtools + "/wafsamba")
17
18
19 LIBREPLACE_DIR= '../replace'
20
21 import sys
22 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
23 import wafsamba, samba_dist
24
25 # setup what directories to put in a tarball
26 samba_dist.DIST_DIRS('lib/talloc:. lib/replace:lib/replace buildtools:buildtools')
27
28
29 def set_options(opt):
30     opt.BUILTIN_DEFAULT('replace')
31     opt.BUNDLED_EXTENSION_DEFAULT('talloc', noextenion='talloc')
32     opt.RECURSE(LIBREPLACE_DIR)
33
34 def configure(conf):
35     conf.RECURSE(LIBREPLACE_DIR)
36
37     if conf.CHECK_BUNDLED_SYSTEM('talloc', minversion=VERSION,
38                                  implied_deps='replace'):
39         conf.define('USING_SYSTEM_TALLOC', 1)
40
41     conf.env.standalone_talloc = conf.IN_LAUNCH_DIR()
42
43     conf.SAMBA_CONFIG_H()
44
45
46
47 def build(bld):
48     bld.RECURSE(LIBREPLACE_DIR)
49
50     if not bld.CONFIG_SET('USING_SYSTEM_TALLOC'):
51         bld.SAMBA_LIBRARY('talloc',
52                           'talloc.c',
53                           deps='replace',
54                           vnum=VERSION)
55
56     if not getattr(bld.env, '_SAMBA_BUILD_', 0) == 4:
57         # s4 already has the talloc testsuite builtin to smbtorture
58         bld.SAMBA_BINARY('talloc_testsuite',
59                          'testsuite_main.c testsuite.c',
60                          deps='talloc',
61                          install=False)
62
63     if bld.env.standalone_talloc:
64         bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
65         bld.env.TALLOC_VERSION = VERSION
66         bld.PKG_CONFIG_FILES('talloc.pc', vnum=VERSION)
67
68
69 def dist():
70     '''makes a tarball for distribution'''
71     samba_dist.dist()
72