perl: add -pie flag when compiling perl modules on arm and i686

Before, trying to compile some perl modules on arm fails with an
error like

t/01-simple.t ..... 5/7 "./add": error: Android 5.0 and later only support position-independent executables (-fPIE).

No idea why it occurs on arm but not on aarch64 or x86_64. Error
should probably be fixed properly elsewhere in perl's source code, but
let's go for this easy fix for now. Adding -pie here also introduces
warnings when building perl packages on device due to clang -E not
recognizing it, but at least they compile..

Tested on lineage-18.1 arm tablet.
This commit is contained in:
Henrik Grimler 2021-07-04 20:51:53 +02:00
parent c7443b67fe
commit 93fca0f5c3

View File

@ -85,4 +85,10 @@ termux_step_post_make_install() {
sed 's',"--sysroot=$TERMUX_STANDALONE_TOOLCHAIN"/sysroot,"-I${TERMUX_PREFIX}/include",'g' Config_heavy.pl > Config_heavy.pl.new
sed 's',"$TERMUX_STANDALONE_TOOLCHAIN"/sysroot,"-I${TERMUX_PREFIX%%/usr}",'g' Config_heavy.pl.new > Config_heavy.pl
rm Config_heavy.pl.new
# arm (and i686?) seem to explicitly need -pie set to be able
# to install some perl packages.
if [ "$TERMUX_ARCH" == "arm" ] || [ "$TERMUX_ARCH" == "i686" ]; then
sed -i "s@cc => '$ORIG_CC',@cc => '$ORIG_CC -pie',@g" Config.pm
fi
}