summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiko Tyni <ntyni@debian.org>2019-10-15 16:51:47 +0300
committerNiko Tyni <ntyni@debian.org>2019-10-18 17:52:44 +0100
commit07f286f700cb41e06a6cc48b8ae7064e37b4f408 (patch)
tree1cb325e55a6a018b60441bd2715ce85b2aeb68fa
parenta82feac6005523974f31fc24670f41be97ce5a2d (diff)
downloaddebhelper-07f286f700cb41e06a6cc48b8ae7064e37b4f408.tar.gz
perl_makemaker: support cross building XS modules
When cross building, run Makefile.PL with host arch Config.pm (provided by the perl-xs-dev package since perl/5.30.0-7) first on @INC. This is an initial implementation that seems to work for a majority of simple XS module packages. It's possible that it will need tuning in the future to accommodate more complex packages. In particular: - setting PERL5LIB instead of adding the -I option might be needed to propagate the modified search path to child processes of Makefile.PL - the 'make' phase may need modifications to the search path as well
-rw-r--r--lib/Debian/Debhelper/Buildsystem/perl_makemaker.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Debian/Debhelper/Buildsystem/perl_makemaker.pm b/lib/Debian/Debhelper/Buildsystem/perl_makemaker.pm
index 6a6f452e..1d73685a 100644
--- a/lib/Debian/Debhelper/Buildsystem/perl_makemaker.pm
+++ b/lib/Debian/Debhelper/Buildsystem/perl_makemaker.pm
@@ -8,7 +8,7 @@ package Debian::Debhelper::Buildsystem::perl_makemaker;
use strict;
use warnings;
-use Debian::Debhelper::Dh_Lib qw(compat);
+use Debian::Debhelper::Dh_Lib qw(compat is_cross_compiling perl_cross_incdir);
use parent qw(Debian::Debhelper::Buildsystem::makefile);
use Config;
@@ -51,12 +51,23 @@ sub configure {
if ($ENV{CFLAGS} && ! compat(8)) {
push @flags, "OPTIMIZE=$ENV{CFLAGS} $ENV{CPPFLAGS}";
}
+ my $cross_flag;
+ if (is_cross_compiling()) {
+ my $incdir = perl_cross_incdir();
+ $cross_flag = "-I$incdir" if defined $incdir;
+ }
if ($ENV{LDFLAGS} && ! compat(8)) {
- push @flags, "LD=$Config{ld} $ENV{CFLAGS} $ENV{LDFLAGS}";
+ my $ld = $Config{ld};
+ $ld = qx/perl $cross_flag -MConfig -e 'print \$Config{ld}'/
+ if is_cross_compiling() and defined $cross_flag;
+ push @flags, "LD=$ld $ENV{CFLAGS} $ENV{LDFLAGS}";
}
push(@perl_flags, '-I.') if compat(10);
+ push @perl_flags, $cross_flag
+ if is_cross_compiling() and defined $cross_flag;
+
$this->doit_in_sourcedir("perl", @perl_flags, "Makefile.PL", "INSTALLDIRS=vendor",
# if perl_build is not tested first, need to pass packlist
# option to handle fallthrough case