summaryrefslogtreecommitdiff
path: root/buildtools
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:42:09 +0200
commita76395b3198f2393963f2a8c5e37b6179fef5abe (patch)
treee0eccddda00c36180d348f0ec269b91a3ee8b194 /buildtools
parent992e6933ca6a65a4f5f94cb4162c87c532d175be (diff)
downloadsamba-a76395b3198f2393963f2a8c5e37b6179fef5abe.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)
Diffstat (limited to 'buildtools')
-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 e65ee5ceef..0f34e79aa3 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)