pod2man is no longer needed
[amitay/samba.git] / pidl / wscript
1 #!/usr/bin/env python
2
3 import os, string
4 from samba_utils import MODE_755
5 from waflib import Logs
6
7 # This function checks if a perl module is installed on the system.
8 def check_system_perl_module(conf, module, version=None):
9     bundle_name = module.replace('::', '_')
10     module_check = module
11
12     # Create module string with version
13     if version:
14         module_check = module + ' ' + str(version)
15
16     # Check if we have to bundle it.
17     if conf.LIB_MUST_BE_BUNDLED(bundle_name.lower()):
18         return False
19
20     # Check for system perl module
21     if conf.check_perl_module(module_check) is None:
22         return False
23
24     conf.define('USING_SYSTEM_%s' % bundle_name.upper(), 1)
25
26     return True
27
28 def options(opt):
29     return
30
31 def configure(conf):
32     # Check if perl(Parse::Yapp::Driver) is available.
33     check_system_perl_module(conf, "Parse::Yapp::Driver", 1.05)
34
35     # yapp is used for building the parser
36     conf.find_program('yapp', var='YAPP')
37
38 def build(bld):
39
40     # we want to prefer the git version of the parsers if we can.
41     # Only if the source has changed do we want to re-run yapp
42     # But we force the developer to use the pidl standalone build
43     # to regenerate the files.
44     # TODO: only warn in developer mode and if 'git diff HEAD'
45     #       shows a difference
46     warn_about_grammar_changes = ('PIDL_BUILD_WARNINGS' in bld.env and (
47         bld.IS_NEWER('idl.yp', 'lib/Parse/Pidl/IDL.pm') or
48         bld.IS_NEWER('expr.yp', 'lib/Parse/Pidl/Expr.pm')))
49
50     if warn_about_grammar_changes:
51         Logs.warn('''
52 Pidl grammar files have changed. Please use the pidl standalone build
53 to regenerate them with yapp.
54
55 $ cd ../pidl
56 $ perl Makefile.PL
57 $ make lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
58 $ git add lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
59 $ git commit
60 $ cd -
61
62 If your 100% sure you haven't changed idl.yp and expr.yp
63 try this to avoid this message:
64
65 $ touch ../pidl/lib/Parse/Pidl/IDL.pm ../pidl/lib/Parse/Pidl/Expr.pm
66 ''')
67