summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-05-09 09:42:23 +0200
committerKarolin Seeger <kseeger@samba.org>2014-05-20 11:41:46 +0200
commit0e430f836f34a2dd7976bc46c37fbfe4d320395d (patch)
tree92d5a3e80e5cc8024a6d4acd2aed975ba30bee73
parent86830d9c31a3bc0856fe12859bb13be56077db2b (diff)
downloadsamba-0e430f836f34a2dd7976bc46c37fbfe4d320395d.tar.gz
wafsamba: Fail with error message if perl doesn't provide valid dirs.
We try harder to get valid directories, we now fallback like this: vendorarch => sitearch => archlib and vendorlib => sitelib => privlib The new options are --with-perl-arch-install-dir and --with-perl-lib-install-dir. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit 2637890ef42a238093f0f3cbdda0d621d5f9b2e2)
-rw-r--r--buildtools/wafadmin/Tools/perl.py58
1 files changed, 39 insertions, 19 deletions
diff --git a/buildtools/wafadmin/Tools/perl.py b/buildtools/wafadmin/Tools/perl.py
index e65ee5ceef6..0f34e79aa39 100644
--- a/buildtools/wafadmin/Tools/perl.py
+++ b/buildtools/wafadmin/Tools/perl.py
@@ -98,33 +98,53 @@ def check_perl_ext_devel(conf):
conf.env.EXTUTILS_TYPEMAP = read_out('print "$Config{privlib}/ExtUtils/typemap"')
conf.env.perlext_PATTERN = '%s.' + read_out('print $Config{dlext}')[0]
- if getattr(Options.options, 'perl_vendorarch_dir', None):
- conf.env.PERL_VENDORARCH_DIR = Options.options.perl_vendorarch_dir
- else:
- try:
- conf.env.PERL_VENDORARCH_DIR = read_out('print $Config{vendorarch}')[0]
- except IndexError:
- conf.env.PERL_VENDORARCH_DIR = "${DATADIR}/perl5"
-
- if getattr(Options.options, 'perl_vendorlib_dir', None):
- conf.env.PERL_VENDORLIB_DIR = Options.options.perl_vendorlib_dir
- else:
- try:
- conf.env.PERL_VENDORLIB_DIR = read_out('print $Config{vendorlib}')[0]
- except IndexError:
- conf.env.PERL_VENDORLIB_DIR = "${LIBDIR}/perl5"
+ def try_any(keys):
+ for k in keys:
+ conf.start_msg("Checking for perl $Config{%s}:" % k)
+ try:
+ v = read_out('print $Config{%s}' % k)[0]
+ conf.end_msg("'%s'" % (v), 'GREEN')
+ return v
+ except IndexError:
+ conf.end_msg(False, 'YELLOW')
+ pass
+ return None
+
+ perl_arch_install_dir = None
+ if getattr(Options.options, 'perl_arch_install_dir', None):
+ perl_arch_install_dir = Options.options.perl_arch_install_dir
+ if perl_arch_install_dir is None:
+ perl_arch_install_dir = try_any(['vendorarch', 'sitearch', 'archlib'])
+ if perl_arch_install_dir is None:
+ conf.fatal('No perl arch install directory autodetected.' +
+ 'Please define it with --with-perl-arch-install-dir.')
+ conf.start_msg("PERL_ARCH_INSTALL_DIR: ")
+ conf.end_msg("'%s'" % (perl_arch_install_dir), 'GREEN')
+ conf.env.PERL_ARCH_INSTALL_DIR = perl_arch_install_dir
+
+ perl_lib_install_dir = None
+ if getattr(Options.options, 'perl_lib_install_dir', None):
+ perl_lib_install_dir = Options.options.perl_lib_install_dir
+ if perl_lib_install_dir is None:
+ perl_lib_install_dir = try_any(['vendorlib', 'sitelib', 'privlib'])
+ if perl_lib_install_dir is None:
+ conf.fatal('No perl lib install directory autodetected. ' +
+ 'Please define it with --with-perl-lib-install-dir.')
+ conf.start_msg("PERL_LIB_INSTALL_DIR: ")
+ conf.end_msg("'%s'" % (perl_lib_install_dir), 'GREEN')
+ conf.env.PERL_LIB_INSTALL_DIR = perl_lib_install_dir
def set_options(opt):
opt.add_option("--with-perl-binary", type="string", dest="perlbinary", help = 'Specify alternate perl binary', default=None)
- opt.add_option("--with-perl-vendorarch",
+ opt.add_option("--with-perl-arch-install-dir",
type="string",
- dest="perl_vendorarch_dir",
+ dest="perl_arch_install_dir",
help = ('Specify directory where to install arch specific files'),
default=None)
- opt.add_option("--with-perl-vendorlib",
+ opt.add_option("--with-perl-lib-install-dir",
type="string",
- dest="perl_vendorlib_dir",
+ dest="perl_lib_install_dir",
help = ('Specify directory where to install vendor specific files'),
default=None)