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