s3:smb2_tcon: make use of smbd_smb2_generate_outbody()
[Samba.git] / pidl / wscript
blobc7b72c400ff9e4f394436cae65af2d96dba3e323
1 #!/usr/bin/env python
3 import os, sys, Logs, Options
4 from samba_utils import MODE_755
6 def set_options(opt):
7 opt.tool_options('perl')
9 def configure(conf):
10 conf.check_tool('perl')
11 conf.check_perl_ext_devel()
13 # we need a recent version of MakeMaker to get the right man page names
14 if conf.CHECK_PERL_MANPAGE():
15 conf.env.PERLMAN1EXT = conf.CHECK_PERL_MANPAGE(section='1')
16 conf.env.PERLMAN3EXT = conf.CHECK_PERL_MANPAGE(section='3')
17 conf.DEFINE('HAVE_PERL_MAKEMAKER', 1)
19 # yapp is used for building the parser
20 conf.find_program('yapp', var='YAPP')
21 conf.find_program('pod2man', var='POD2MAN')
23 # Check for perl(Parse::Yapp::Driver)
24 check_system_perl_module(conf, "Parse::Yapp::Driver", 1.05)
26 def build(bld):
27 bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=MODE_755)
29 bld.RECURSE('lib')
31 if not bld.CONFIG_SET('HAVE_PERL_MAKEMAKER'):
32 return
34 pidl_manpages = {
35 'pidl': 'man1/pidl.${PERLMAN1EXT}',
36 'lib/Parse/Pidl/NDR.pm': 'man3/Parse::Pidl::NDR.${PERLMAN3EXT}',
37 'lib/Parse/Pidl/Wireshark/Conformance.pm': 'man3/Parse::Pidl::Wireshark::Conformance.${PERLMAN3EXT}',
38 'lib/Parse/Pidl/Dump.pm': 'man3/Parse::Pidl::Dump.${PERLMAN3EXT}',
39 'lib/Parse/Pidl/Util.pm': 'man3/Parse::Pidl::Util.${PERLMAN3EXT}',
40 'lib/Parse/Pidl/Wireshark/NDR.pm': 'man3/Parse::Pidl::Wireshark::NDR.${PERLMAN3EXT}'
43 for k, v in pidl_manpages.iteritems():
44 pidl_manpages[k] = bld.EXPAND_VARIABLES(v)
46 # use perl to build the manpages
47 bld.env.pidl_srcdir = os.path.join(bld.srcnode.abspath(), 'pidl')
49 blib_bld = os.path.join(bld.srcnode.abspath(bld.env), 'pidl/blib')
51 bld.SET_BUILD_GROUP('final')
52 if 'POD2MAN' in bld.env and bld.env['POD2MAN'] != '':
53 for src, manpage in pidl_manpages.iteritems():
54 bld(rule='${POD2MAN} -c "Samba Documentation" ${SRC} ${TGT}',
55 shell=True,
56 source=src,
57 install_path=os.path.dirname(bld.EXPAND_VARIABLES('${MANDIR}/'+manpage)),
58 target=os.path.basename(manpage))
60 # we want to prefer the git version of the parsers if we can.
61 # Only if the source has changed do we want to re-run yapp
62 # But we force the developer to use the pidl standalone build
63 # to regenerate the files.
64 # TODO: only warn in developer mode and if 'git diff HEAD'
65 # shows a difference
66 warn_about_grammar_changes = ('PIDL_BUILD_WARNINGS' in bld.env and (
67 bld.IS_NEWER('idl.yp', 'lib/Parse/Pidl/IDL.pm') or
68 bld.IS_NEWER('expr.yp', 'lib/Parse/Pidl/Expr.pm')))
70 if warn_about_grammar_changes:
71 Logs.warn('''
72 Pidl grammar files have changed. Please use the pidl standalone build
73 to regenerate them with yapp.
75 $ cd ../pidl
76 $ perl Makefile.PL
77 $ make lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
78 $ git add lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
79 $ git commit
80 $ cd -
82 If your 100% sure you haven't changed idl.yp and expr.yp
83 try this to avoid this message:
85 $ touch ../pidl/lib/Parse/Pidl/IDL.pm ../pidl/lib/Parse/Pidl/Expr.pm
86 ''')
88 def check_system_perl_module(conf, module, version=None):
89 bundle_name = module.replace('::', '_')
90 module_check = module
91 found = False
93 # Create module string with version
94 if version:
95 module_check = module + ' ' + str(version)
97 # Check if we have to bundle it.
98 if conf.LIB_MUST_BE_BUNDLED(bundle_name.lower()):
99 return False
101 # Check for system perl module
102 if not conf.check_perl_module(module_check):
103 return False
105 conf.define('USING_SYSTEM_%s' % bundle_name.upper(), 1)
107 return True