s4-waf: use a common pattern for finding buildtools and libs
[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 import os, sys
9
10 # find the buildtools directory
11 srcdir = '.'
12 while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
13     srcdir = '../' + srcdir
14 sys.path.insert(0, srcdir + '/buildtools/wafsamba')
15
16 import sys
17 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
18 import wafsamba, samba_dist
19
20 # setup what directories to put in a tarball
21 samba_dist.DIST_DIRS('lib/talloc:. lib/replace:lib/replace buildtools:buildtools')
22
23
24 def set_options(opt):
25     opt.BUILTIN_DEFAULT('replace')
26     opt.BUNDLED_EXTENSION_DEFAULT('talloc', noextenion='talloc')
27     opt.RECURSE('lib/replace')
28
29 def configure(conf):
30     conf.RECURSE('lib/replace')
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.RECURSE('lib/replace')
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