Simplify handling of dependencies on external libraries in test_headers.
[Samba.git] / testsuite / headers / wscript_build
blobc41c384b71a2aee4acdad6a8852bd4a46562e84e
1 import os
2 from samba_utils import os_path_relpath
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')
16     for h in hlist:
17         f.write('#include "%s"\n' % os.path.normpath(h))
18     f.close()
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))
25 bld.SAMBA_GENERATOR('test_headers.h',
26                     group='main',
27                     rule=build_test_headers,
28                     source=public_headers,
29                     target='test_headers.h')
31 if bld.env.DEVELOPER_MODE:
32     bld.SAMBA_BINARY('test_headers',
33                      source='test_headers.c',
34                      includes="#include/public",
35                      pyembed=True,
36                      local_include=True,
37                      global_include=False,
38                      use_global_deps=False,
39                      install=False,
40                      deps='talloc tdb ldb tevent popt')