From ad6ecaeb85fdbd2d9ed7115b86169d1692b9cba7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 15 Apr 2014 10:24:24 +0200 Subject: [PATCH 1/4] wafsamba: If perl can't provide defaults, define them. This should fix the installation on FreeBSD. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Andreas Schneider Reviewed-by: Alexander Bokovoy Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Thu May 8 13:55:50 CEST 2014 on sn-devel-104 (cherry picked from commit 0ba276ebad57d75a769e22414f94acbe8c177d97) --- buildtools/wafadmin/Tools/perl.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/buildtools/wafadmin/Tools/perl.py b/buildtools/wafadmin/Tools/perl.py index 8f13e28..e65ee5c 100644 --- a/buildtools/wafadmin/Tools/perl.py +++ b/buildtools/wafadmin/Tools/perl.py @@ -101,12 +101,18 @@ def check_perl_ext_devel(conf): if getattr(Options.options, 'perl_vendorarch_dir', None): conf.env.PERL_VENDORARCH_DIR = Options.options.perl_vendorarch_dir else: - conf.env.PERL_VENDORARCH_DIR = read_out('print $Config{vendorarch}')[0] + 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: - conf.env.PERL_VENDORLIB_DIR = read_out('print $Config{vendorlib}')[0] + try: + conf.env.PERL_VENDORLIB_DIR = read_out('print $Config{vendorlib}')[0] + except IndexError: + conf.env.PERL_VENDORLIB_DIR = "${LIBDIR}/perl5" def set_options(opt): opt.add_option("--with-perl-binary", type="string", dest="perlbinary", help = 'Specify alternate perl binary', default=None) -- 1.7.9.5 From 718f73113f7679dd62b1e57d59c4286393acb420 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 May 2014 09:42:23 +0200 Subject: [PATCH 2/4] 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 Reviewed-by: Andreas Schneider (cherry picked from commit 2637890ef42a238093f0f3cbdda0d621d5f9b2e2) --- buildtools/wafadmin/Tools/perl.py | 58 +++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/buildtools/wafadmin/Tools/perl.py b/buildtools/wafadmin/Tools/perl.py index e65ee5c..0f34e79 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) -- 1.7.9.5 From e5c24056f64146989c65c6ee85f5031b43947337 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 May 2014 11:48:26 +0200 Subject: [PATCH 3/4] script/autobuild: make use of --with-perl-{arch,lib}-install-dir Bug: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider (cherry picked from commit d18ee9e4b6f4c9a24b555c111e08396012c1755a) --- script/autobuild.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/autobuild.py b/script/autobuild.py index cb822ff..76e777c 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -232,7 +232,9 @@ class builder(object): self.cmd = self.cmd.replace("${PYTHON_PREFIX}", get_python_lib(standard_lib=1, prefix=self.prefix)) self.cmd = self.cmd.replace("${PREFIX}", "--prefix=%s" % self.prefix) self.cmd = self.cmd.replace("${PREFIX_DIR}", "%s" % self.prefix) - self.cmd = self.cmd.replace("${PERL_VENDOR_LIB}", "--with-perl-vendorlib=%s/share/perl5" % self.prefix) + perl_vendor_lib = "--with-perl-arch-install-dir=%s/share/perl5 " % self.prefix + perl_vendor_lib += "--with-perl-lib-install-dir=%s/lib/perl5" % self.prefix + self.cmd = self.cmd.replace("${PERL_VENDOR_LIB}", perl_vendor_lib) # if self.output_mime_type == "text/x-subunit": # self.cmd += " | %s --immediate" % (os.path.join(os.path.dirname(__file__), "selftest/format-subunit")) print '%s: [%s] Running %s' % (self.name, self.stage, self.cmd) -- 1.7.9.5 From 8d661c0fd3ddc7612e399b2deab2cdc7046c6bf2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 May 2014 11:49:10 +0200 Subject: [PATCH 4/4] pidl/lib/wscript_build: make use of PERL_LIB_INSTALL_DIR Bug: https://bugzilla.samba.org/show_bug.cgi?id=10472 Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Sat May 10 01:37:33 CEST 2014 on sn-devel-104 (cherry picked from commit cf75ef9f73f2cdbf2a039bbc9468f5da6a14834e) --- pidl/lib/wscript_build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidl/lib/wscript_build b/pidl/lib/wscript_build index 5023e07..54b3170 100644 --- a/pidl/lib/wscript_build +++ b/pidl/lib/wscript_build @@ -1,7 +1,7 @@ #!/usr/bin/env python # install the pidl modules -bld.INSTALL_FILES(bld.env.PERL_VENDORLIB_DIR, +bld.INSTALL_FILES(bld.env.PERL_LIB_INSTALL_DIR, ''' Parse/Pidl.pm Parse/Pidl/Samba4.pm @@ -32,6 +32,6 @@ bld.INSTALL_FILES(bld.env.PERL_VENDORLIB_DIR, flat=False) if not bld.CONFIG_SET('USING_SYSTEM_PARSE_YAPP_DRIVER'): - bld.INSTALL_FILES(bld.env.PERL_VENDORLIB_DIR, + bld.INSTALL_FILES(bld.env.PERL_LIB_INSTALL_DIR, 'Parse/Yapp/Driver.pm', flat=False) -- 1.7.9.5