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[:]
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')
17 f.write('#include "%s"\n' % os.path.normpath(h))
20 relpath1 = os_path_relpath(bld.srcnode.abspath(), bld.curdir)
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',
27 rule=build_test_headers,
28 source=public_headers,
29 target='test_headers.h')
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 + ' '
37 if not bld.env.USING_SYSTEM_POPT:
38 cflags += bld.env.CPPPATH_ST % '../lib/popt'
40 if bld.env.DEVELOPER_MODE:
41 bld.SAMBA_BINARY('test_headers',
42 source='test_headers.c',
43 includes="#include/public",
48 use_global_deps=False,