summaryrefslogtreecommitdiffstats
path: root/buildtools
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-08-26 01:29:57 +0200
committerStefan Metzmacher <metze@samba.org>2014-09-05 19:47:06 +0200
commit75c3e240e0703be8c86596e689e466b4dee5e85e (patch)
tree48c6e7ed35131ad78c4dfa107c93b8c82652cb17 /buildtools
parent6ad678166c85f0eb90b76ccf842d1aa8dcb6b41a (diff)
downloadsamba-75c3e240e0703be8c86596e689e466b4dee5e85e.tar.gz
samba-75c3e240e0703be8c86596e689e466b4dee5e85e.tar.xz
samba-75c3e240e0703be8c86596e689e466b4dee5e85e.zip
wafsamba: add samba_perl.py with SAMBA_CHECK_PERL() higher level check.
This checks for the perl binary, sets PERL and PERL_SPECIFIED as well es the PERL_ARCH_INSTALL_DIR and PERL_LIB_INSTALL_DIR. We want to avoid installing the perl modules outside the prefix. I.e. generally,the perl modules should be installed under "$prefix/share/perl5". This improves the fixes for bug #10472. The new strategy for automatically setting the paths is this: - if the prefix equals perl's vendorprefix, then - PERL_LIB_INSTALL_DIR is set to perl's vendorlib dir - PERL_ARCH_INSTALL_DIR is set to perl's vendorarch dir - otherwise: - PERL_LIB_INSTALL_DIR is set to ${DATADIR}/perl5 (usually ${PREFIX}/share/perl5) - PERL_ARCH_INSTALL_DIR is set to ${LIBDIR}/perl5 (usually ${PREFIX}/lib/perl5) 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>
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_perl.py62
-rw-r--r--buildtools/wafsamba/wafsamba.py1
2 files changed, 63 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_perl.py b/buildtools/wafsamba/samba_perl.py
new file mode 100644
index 0000000000..3909aba2ee
--- /dev/null
+++ b/buildtools/wafsamba/samba_perl.py
@@ -0,0 +1,62 @@
+import Build
+from samba_utils import *
+from Configure import conf
+
+done = {}
+
+@conf
+def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)):
+ #
+ # TODO: use the @runonce mechanism for this.
+ # The problem is that @runonce currently does
+ # not seem to work together with @conf...
+ # So @runonce (and/or) @conf needs fixing.
+ #
+ if "done" in done:
+ return
+ done["done"] = True
+ conf.find_program('perl', var='PERL', mandatory=mandatory)
+ conf.check_tool('perl')
+ path_perl = conf.find_program('perl')
+ conf.env.PERL_SPECIFIED = (conf.env.PERL != path_perl)
+ conf.check_perl_version(version)
+
+ def read_perl_config_var(cmd):
+ return Utils.to_list(Utils.cmd_output([conf.env.PERL, '-MConfig', '-e', cmd]))
+
+ def check_perl_config_var(var):
+ conf.start_msg("Checking for perl $Config{%s}:" % var)
+ try:
+ v = read_perl_config_var('print $Config{%s}' % var)[0]
+ conf.end_msg("'%s'" % (v), 'GREEN')
+ return v
+ except IndexError:
+ conf.end_msg(False, 'YELLOW')
+ pass
+ return None
+
+ vendor_prefix = check_perl_config_var('vendorprefix')
+
+ perl_arch_install_dir = None
+ if vendor_prefix == conf.env.PREFIX:
+ perl_arch_install_dir = check_perl_config_var('vendorarch');
+ if perl_arch_install_dir is None:
+ perl_arch_install_dir = "${LIBDIR}/perl5";
+ 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 vendor_prefix == conf.env.PREFIX:
+ perl_lib_install_dir = check_perl_config_var('vendorlib');
+ if perl_lib_install_dir is None:
+ perl_lib_install_dir = "${DATADIR}/perl5";
+ 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
+
+ perl_inc = read_perl_config_var('print "@INC"')
+ perl_inc.remove('.')
+ conf.start_msg("PERL_INC: ")
+ conf.end_msg("%s" % (perl_inc), 'GREEN')
+ conf.env.PERL_INC = perl_inc
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index a884d6dfec..bb06541a5c 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -16,6 +16,7 @@ from samba_patterns import *
from samba_pidl import *
from samba_autoproto import *
from samba_python import *
+from samba_perl import *
from samba_deps import *
from samba_bundled import *
from samba_third_party import *