s4-waf: don't try to use the system lib for the library build
[sfrench/samba-autobuild/.git] / lib / talloc / wscript
1 #!/usr/bin/env python
2
3 APPNAME = 'talloc'
4 VERSION = '2.0.2'
5
6
7 blddir = 'bin'
8
9 import os, sys
10
11 # find the buildtools directory
12 srcdir = '.'
13 while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
14     srcdir = '../' + srcdir
15 sys.path.insert(0, srcdir + '/buildtools/wafsamba')
16
17 import sys
18 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
19 import wafsamba, samba_dist, Options
20
21 # setup what directories to put in a tarball
22 samba_dist.DIST_DIRS('lib/talloc:. lib/replace:lib/replace buildtools:buildtools')
23
24
25 def set_options(opt):
26     opt.BUILTIN_DEFAULT('replace')
27     opt.BUNDLED_EXTENSION_DEFAULT('talloc', noextenion='talloc')
28     opt.RECURSE('lib/replace')
29     opt.add_option('--enable-talloc-compat1',
30                    help=("Build talloc 1.x.x compat library [False]"),
31                    action="store_true", dest='TALLOC_COMPAT1', default=False)
32
33 def configure(conf):
34     conf.RECURSE('lib/replace')
35
36     conf.env.standalone_talloc = conf.IN_LAUNCH_DIR()
37
38     if not conf.env.standalone_talloc:
39         if conf.CHECK_BUNDLED_SYSTEM('talloc', minversion=VERSION,
40                                      implied_deps='replace'):
41             conf.define('USING_SYSTEM_TALLOC', 1)
42
43     conf.env.TALLOC_COMPAT1 = Options.options.TALLOC_COMPAT1
44
45     if conf.env.standalone_talloc:
46         conf.find_program('xsltproc', var='XSLTPROC')
47
48     conf.SAMBA_CONFIG_H()
49
50
51
52 def build(bld):
53     bld.RECURSE('lib/replace')
54
55     if not bld.CONFIG_SET('USING_SYSTEM_TALLOC'):
56
57         bld.SAMBA_LIBRARY('talloc',
58                           'talloc.c',
59                           deps='replace',
60                           vnum=VERSION)
61
62         # should we also install the symlink to libtalloc1.so here?
63         bld.SAMBA_LIBRARY('talloc-compat1',
64                           'compat/talloc_compat1.c',
65                           deps='talloc',
66                           enabled = bld.env.TALLOC_COMPAT1,
67                           vnum=VERSION)
68
69     if not getattr(bld.env, '_SAMBA_BUILD_', 0) == 4:
70         # s4 already has the talloc testsuite builtin to smbtorture
71         bld.SAMBA_BINARY('talloc_testsuite',
72                          'testsuite_main.c testsuite.c',
73                          deps='talloc',
74                          install=False)
75
76     if bld.env.standalone_talloc:
77         bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
78         bld.env.TALLOC_VERSION = VERSION
79         bld.PKG_CONFIG_FILES('talloc.pc', vnum=VERSION)
80         bld.INSTALL_FILES('${INCLUDEDIR}', 'talloc.h')
81
82         if bld.env.XSLTPROC:
83             bld.env.TALLOC_MAN_XSL = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
84             bld.env.TALLOC_WEB_XSL = 'http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl'
85             bld.SAMBA_GENERATOR('talloc.3',
86                                 source='talloc.3.xml',
87                                 target='talloc.3',
88                                 rule='${XSLTPROC} -o ${TGT} ${TALLOC_MAN_XSL} ${SRC}'
89                                 )
90             bld.SAMBA_GENERATOR('talloc.3.html',
91                                 source='talloc.3.xml',
92                                 target='talloc.3.html',
93                                 rule='${XSLTPROC} -o ${TGT} ${TALLOC_WEB_XSL} ${SRC}'
94                                 )
95             bld.INSTALL_FILES('${MANDIR}/man3', 'talloc.3')
96
97
98 def test(ctx):
99     '''run talloc testsuite'''
100     import Utils
101     cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite')
102     os.system(cmd)
103
104 def dist():
105     '''makes a tarball for distribution'''
106     samba_dist.dist()