From 5e6ed15aa9d80ff832532fd7896120d42e9332c4 Mon Sep 17 00:00:00 2001 From: newbluemoon Date: Tue, 21 Aug 2018 23:52:58 +0200 Subject: [PATCH] build-style/perl-ModuleBuild.sh: fix cross --- common/build-style/perl-ModuleBuild.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/common/build-style/perl-ModuleBuild.sh b/common/build-style/perl-ModuleBuild.sh index b5f7ea8c2ff..cf990482d6c 100644 --- a/common/build-style/perl-ModuleBuild.sh +++ b/common/build-style/perl-ModuleBuild.sh @@ -8,10 +8,21 @@ # do_configure() { if [ -f Build.PL ]; then + # When cross compiling Module::Build reads in the build flags from the host perl, not the target: + # extract the target specific flags (the ones also set in perl’s template) from + # the target perl configuration and use them to override Module::Build’s default + _conf="${XBPS_CROSS_BASE}/usr/lib/perl5/core_perl/Config_heavy.pl" + _optimize=$(sed -n "s;^optimize='\(.*\)';\1;p" $_conf) + _ccflags=$(sed -n "s;^ccflags='\(.*\)';\1;p" $_conf) + _lddlflags=$(sed -n "s;^lddlflags='\(.*\)';\1;p" $_conf) + _ldflags=$(sed -n "s;^ldflags='\(.*\)';\1;p" $_conf) + PERL_MM_USE_DEFAULT=1 PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$DESTDIR'" \ PERL_MB_OPT="--installdirs vendor --destdir '$DESTDIR'" \ LD="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \ - perl Build.PL ${configure_args} INSTALLDIRS=vendor + perl Build.PL --config optimize="$_optimize" --config ccflags="$_ccflags" \ + --config lddlflags="$_lddlflags" --config ldflags="$_ldflags" \ + ${configure_args} INSTALLDIRS=vendor else msg_error "$pkgver: cannot find Build.PL for perl module!\n" fi