s4-waf: allow standalone tarball build of libraries
[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 def set_options(opt):
24     opt.BUILTIN_DEFAULT('replace')
25     opt.BUNDLED_EXTENSION_DEFAULT('talloc', noextenion='talloc')
26     opt.recurse(LIBREPLACE_DIR)
27
28 def configure(conf):
29     conf.DIST_DIRS('lib/talloc:. lib/replace:lib/replace buildtools:buildtools')
30     conf.sub_config(LIBREPLACE_DIR)
31
32     if conf.CHECK_BUNDLED_SYSTEM('talloc', minversion=VERSION,
33                                  implied_deps='replace'):
34         conf.define('USING_SYSTEM_TALLOC', 1)
35
36     conf.env.standalone_talloc = conf.IN_LAUNCH_DIR()
37
38     conf.SAMBA_CONFIG_H()
39
40
41
42 def build(bld):
43     bld.BUILD_SUBDIR(LIBREPLACE_DIR)
44
45     if not bld.CONFIG_SET('USING_SYSTEM_TALLOC'):
46         bld.SAMBA_LIBRARY('talloc',
47                           'talloc.c',
48                           deps='replace',
49                           vnum=VERSION)
50
51     if not getattr(bld.env, '_SAMBA_BUILD_', 0) == 4:
52         # s4 already has the talloc testsuite builtin to smbtorture
53         bld.SAMBA_BINARY('talloc_testsuite',
54                          'testsuite_main.c testsuite.c',
55                          deps='talloc',
56                          install=False)
57
58     if bld.env.standalone_talloc:
59         bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
60         bld.env.TALLOC_VERSION = VERSION
61         bld.PKG_CONFIG_FILES('talloc.pc', vnum=VERSION)
62
63
64 def dist():
65     '''makes a tarball for distribution'''
66     samba_dist.dist()
67