![Guy Harris](/assets/img/avatar_default.png)
Comments from Samba Git log: commit ee2148754e2e2604ac918343fa8769a25523eb49 Author: Stefan Metzmacher <metze@samba.org> Date: Tue Aug 26 21:33:05 2014 +0200 pidl/wscript: remove --with-perl-* options These are not needed anymore as we have useful defaults now. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> commit b537c5a340bae2accbf35a4ec5eab7074b90f0b1 Author: Michael Adam <obnox@samba.org> Date: Mon Aug 25 23:57:23 2014 +0200 pidl: fix the perl module search path (use lib ...) when installing pidl. This way, pidl can also run with modules installed under the $prefix. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Michael Adam <obnox@samba.org> commit 191fc0e541e7c9d0a1095dc287402df9947ce779 Author: Michael Adam <obnox@samba.org> Date: Thu Sep 4 01:38:14 2014 +0200 pidl/wscript: don't check for perl again. This is done at the toplevel now. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> commit 9e591e3d619d127c5ec5f6ac86326c84f59878fa Author: Andreas Schneider <asn@samba.org> Date: Fri Feb 28 15:59:45 2014 +0100 pidl-waf: Check for system perl(Parse::Yapp::Driver). Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> commit 410ada45b7041be6976fcfefadccbb99212a15a3 Author: Andreas Schneider <asn@samba.org> Date: Fri Feb 28 15:59:41 2014 +0100 pidl-waf: Add a function to check for a system perl module. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> commit 17244ef750f699b30ff7ff3a71264f4c76adad6d Author: Andreas Schneider <asn@samba.org> Date: Fri Feb 28 15:53:10 2014 +0100 pidl-waf: Install pidl modules to the perl vendorlib directory. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> commit 0bb6b0102f6fa21e6c9f8010421386a660c5a5e0 Author: Andreas Schneider <asn@samba.org> Date: Fri Feb 28 15:54:09 2014 +0100 pidl-waf: Remove unused variable pidl_src. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> commit 87976b4e45bd71b086e9201f0d0a563b9071ca4a Author: Andreas Schneider <asn@samba.org> Date: Fri Feb 28 15:46:01 2014 +0100 Revert "pidl: Install pidl files corrently." This reverts commit cee11cfa4544425099268cd32393169afb4bb107. Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> commit c2d58c3c2059ef3d43f876df547cbc7256235563 Author: Andreas Schneider <asn@samba.org> Date: Fri Feb 28 15:45:51 2014 +0100 Revert "waf: Add option to specify perl vendor dir." This reverts commit 9b200555fec2e33da9521db388d1839375aa8d83. Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> commit c46aaf1102da5e8ba53e9f89f2f756fe8dce83c5 Author: Andreas Schneider <asn@samba.org> Date: Fri Feb 28 15:45:35 2014 +0100 Revert "pidl: Make perl(Parse:Yapp:Driver) installation optional." This reverts commit f0030c619bcf22dbe9eed54b2c0dc9c61f564838. Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> commit f0030c619bcf22dbe9eed54b2c0dc9c61f564838 Author: Andreas Schneider <asn@samba.org> Date: Thu Feb 27 13:14:56 2014 +0100 pidl: Make perl(Parse:Yapp:Driver) installation optional. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Feb 27 18:47:03 CET 2014 on sn-devel-104 commit 9b200555fec2e33da9521db388d1839375aa8d83 Author: Andreas Schneider <asn@samba.org> Date: Tue Feb 25 17:16:37 2014 +0100 waf: Add option to specify perl vendor dir. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Kai Blin <kai@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Feb 27 11:48:54 CET 2014 on sn-devel-104 commit cee11cfa4544425099268cd32393169afb4bb107 Author: Andreas Schneider <asn@samba.org> Date: Tue Feb 25 16:04:24 2014 +0100 pidl: Install pidl files corrently. Globbing is a really bad idea in installtion system. One of them is if you use patch -b to create a backup, you will end up installing the backup file too! BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Kai Blin <kai@samba.org> Change-Id: I9c4491f0d74c24d7c45a59e98825c789097a0c7b Reviewed-on: https://code.wireshark.org/review/4318 Reviewed-by: Guy Harris <guy@alum.mit.edu>
107 lines
3.6 KiB
Python
Executable file
107 lines
3.6 KiB
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import os, sys, Logs
|
|
from samba_utils import MODE_755
|
|
|
|
# This function checks if a perl module is installed on the system.
|
|
def check_system_perl_module(conf, module, version=None):
|
|
bundle_name = module.replace('::', '_')
|
|
module_check = module
|
|
found = False
|
|
|
|
# Create module string with version
|
|
if version:
|
|
module_check = module + ' ' + str(version)
|
|
|
|
# Check if we have to bundle it.
|
|
if conf.LIB_MUST_BE_BUNDLED(bundle_name.lower()):
|
|
return False
|
|
|
|
# Check for system perl module
|
|
if not conf.check_perl_module(module_check):
|
|
return False
|
|
|
|
conf.define('USING_SYSTEM_%s' % bundle_name.upper(), 1)
|
|
|
|
return True
|
|
|
|
def set_options(opt):
|
|
return
|
|
|
|
def configure(conf):
|
|
# Check if perl(Parse::Yapp::Driver) is available.
|
|
check_system_perl_module(conf, "Parse::Yapp::Driver", 1.05)
|
|
|
|
# we need a recent version of MakeMaker to get the right man page names
|
|
if conf.CHECK_PERL_MANPAGE():
|
|
conf.env.PERLMAN1EXT = conf.CHECK_PERL_MANPAGE(section='1')
|
|
conf.env.PERLMAN3EXT = conf.CHECK_PERL_MANPAGE(section='3')
|
|
conf.DEFINE('HAVE_PERL_MAKEMAKER', 1)
|
|
|
|
# yapp is used for building the parser
|
|
conf.find_program('yapp', var='YAPP')
|
|
conf.find_program('pod2man', var='POD2MAN')
|
|
|
|
def build(bld):
|
|
bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=MODE_755, perl_fixup=True)
|
|
|
|
bld.RECURSE('lib')
|
|
|
|
if not bld.CONFIG_SET('HAVE_PERL_MAKEMAKER'):
|
|
return
|
|
|
|
pidl_manpages = {
|
|
'pidl': 'man1/pidl.${PERLMAN1EXT}',
|
|
'lib/Parse/Pidl/NDR.pm': 'man3/Parse::Pidl::NDR.${PERLMAN3EXT}',
|
|
'lib/Parse/Pidl/Wireshark/Conformance.pm': 'man3/Parse::Pidl::Wireshark::Conformance.${PERLMAN3EXT}',
|
|
'lib/Parse/Pidl/Dump.pm': 'man3/Parse::Pidl::Dump.${PERLMAN3EXT}',
|
|
'lib/Parse/Pidl/Util.pm': 'man3/Parse::Pidl::Util.${PERLMAN3EXT}',
|
|
'lib/Parse/Pidl/Wireshark/NDR.pm': 'man3/Parse::Pidl::Wireshark::NDR.${PERLMAN3EXT}'
|
|
}
|
|
|
|
for k, v in pidl_manpages.iteritems():
|
|
pidl_manpages[k] = bld.EXPAND_VARIABLES(v)
|
|
|
|
# use perl to build the manpages
|
|
bld.env.pidl_srcdir = os.path.join(bld.srcnode.abspath(), 'pidl')
|
|
|
|
blib_bld = os.path.join(bld.srcnode.abspath(bld.env), 'pidl/blib')
|
|
|
|
bld.SET_BUILD_GROUP('final')
|
|
if 'POD2MAN' in bld.env and bld.env['POD2MAN'] != '':
|
|
for src, manpage in pidl_manpages.iteritems():
|
|
bld(rule='${POD2MAN} -c "Samba Documentation" ${SRC} ${TGT}',
|
|
shell=True,
|
|
source=src,
|
|
install_path=os.path.dirname(bld.EXPAND_VARIABLES('${MANDIR}/'+manpage)),
|
|
target=os.path.basename(manpage))
|
|
|
|
# we want to prefer the git version of the parsers if we can.
|
|
# Only if the source has changed do we want to re-run yapp
|
|
# But we force the developer to use the pidl standalone build
|
|
# to regenerate the files.
|
|
# TODO: only warn in developer mode and if 'git diff HEAD'
|
|
# shows a difference
|
|
warn_about_grammar_changes = ('PIDL_BUILD_WARNINGS' in bld.env and (
|
|
bld.IS_NEWER('idl.yp', 'lib/Parse/Pidl/IDL.pm') or
|
|
bld.IS_NEWER('expr.yp', 'lib/Parse/Pidl/Expr.pm')))
|
|
|
|
if warn_about_grammar_changes:
|
|
Logs.warn('''
|
|
Pidl grammar files have changed. Please use the pidl standalone build
|
|
to regenerate them with yapp.
|
|
|
|
$ cd ../pidl
|
|
$ perl Makefile.PL
|
|
$ make lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
|
|
$ git add lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
|
|
$ git commit
|
|
$ cd -
|
|
|
|
If your 100% sure you haven't changed idl.yp and expr.yp
|
|
try this to avoid this message:
|
|
|
|
$ touch ../pidl/lib/Parse/Pidl/IDL.pm ../pidl/lib/Parse/Pidl/Expr.pm
|
|
''')
|
|
|