waf-pidl: don't need this debug ls any more
[kai/samba-autobuild/.git] / pidl / wscript
1 #!/usr/bin/env python
2
3 import os
4
5 def set_options(opt):
6     opt.tool_options('perl')
7
8 def configure(conf):
9     conf.check_tool('perl')
10     # we need a recent version of MakeMaker to get the right man page names
11     if conf.check_perl_module('ExtUtils::MakeMaker 6.42'):
12         conf.DEFINE('HAVE_PERL_MAKEMAKER', 1)
13
14 def build(bld):
15     bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=0755)
16
17     bld.BUILD_SUBDIR('lib')
18
19     if not bld.CONFIG_SET('HAVE_PERL_MAKEMAKER'):
20         return
21
22     pidl_src = ['pidl']
23     pidl_src.extend(bld.path.ant_glob('lib/**/*.pm').split())
24
25     pidl_manpages = '''blib/man1/pidl.1p blib/man3/Parse::Pidl::NDR.3pm
26                        blib/man3/Parse::Pidl::Wireshark::Conformance.3pm
27                        blib/man3/Parse::Pidl::Dump.3pm
28                        blib/man3/Parse::Pidl::Util.3pm
29                        blib/man3/Parse::Pidl::Wireshark::NDR.3pm'''.split()
30
31     # use perl to build the manpages
32     bld.env.pidl_srcdir = os.path.join(bld.srcnode.abspath(), 'pidl')
33
34     bld.SAMBA_GENERATOR('pidl_manpages',
35                         source=pidl_src,
36                         target=pidl_manpages,
37                         rule='cd ${pidl_srcdir} && ${PERL} Makefile.PL && make && rm -f Makefile Makefile.old')
38
39     for m in pidl_manpages:
40         dname=os.path.dirname(m)[5:]
41         bld.INSTALL_FILES('${MANDIR}/'+dname, m, flat=True)