third_party/popt: Initial support for popt.
[nivanova/samba-autobuild/.git] / testsuite / headers / wscript_build
1 import os
2 from samba_utils import os_path_relpath
3
4 def build_test_headers(task):
5     '''symlink a header in the build tree'''
6     tgt = task.outputs[0].bldpath(task.env)
7     f = open(tgt, mode='w')
8     f.write('/* generated header test */\n')
9     hlist = task.env.public_headers_list[:]
10     hlist.sort()
11     # We need to include tdb.h before ntdb.h.  It's the rules!
12     if 'tdb.h' in hlist and 'ntdb.h' in hlist:
13         hlist.remove('ntdb.h')
14         hlist.append('ntdb.h')
15
16     for h in hlist:
17         f.write('#include "%s"\n' % os.path.normpath(h))
18     f.close()
19
20 relpath1 = os_path_relpath(bld.srcnode.abspath(), bld.curdir)
21 public_headers = []
22 for h in bld.env.public_headers_list:
23     public_headers.append(os.path.join(relpath1, bld.env.build_public_headers, h))
24
25 bld.SAMBA_GENERATOR('test_headers.h',
26                     group='main',
27                     rule=build_test_headers,
28                     source=public_headers,
29                     target='test_headers.h')
30
31 cflags=''
32 for lib in ['talloc', 'tevent', 'tdb', 'ldb', 'popt' ]:
33     ename = 'CPPPATH_%s' % lib.upper()
34     for p in bld.env[ename]:
35         cflags += bld.env.CPPPATH_ST % p + ' '
36
37 if not bld.env.USING_SYSTEM_POPT:
38     cflags += bld.env.CPPPATH_ST % '../third_party/popt'
39
40 if bld.env.DEVELOPER_MODE:
41     bld.SAMBA_BINARY('test_headers',
42                      source='test_headers.c',
43                      includes="#include/public",
44                      pyembed=True,
45                      cflags=cflags,
46                      local_include=True,
47                      global_include=False,
48                      use_global_deps=False,
49                      install=False)