termux-packages/packages/perl/build.sh

85 lines
2.8 KiB
Bash
Raw Normal View History

2015-06-13 01:03:31 +02:00
# This port uses perl-cross: http://arsv.github.io/perl-cross/index.html
TERMUX_PKG_HOMEPAGE=http://www.perl.org/
TERMUX_PKG_DESCRIPTION="Capable, feature-rich programming language"
2015-08-31 02:35:01 +02:00
# cpan modules will require make:
2016-07-04 23:25:50 +02:00
TERMUX_PKG_VERSION=5.24.0
2015-06-13 01:03:31 +02:00
TERMUX_PKG_SRCURL=http://www.cpan.org/src/5.0/perl-${TERMUX_PKG_VERSION}.tar.gz
# Does not work with parallell builds:
TERMUX_MAKE_PROCESSES=1
TERMUX_PKG_RM_AFTER_INSTALL="bin/perl${TERMUX_PKG_VERSION}"
2015-08-31 02:35:01 +02:00
TERMUX_PKG_BUILD_IN_SRC="yes"
2016-04-22 09:25:16 +02:00
TERMUX_PKG_NO_DEVELSPLIT=yes
2015-06-13 01:03:31 +02:00
termux_step_post_extract_package () {
2016-07-04 23:25:50 +02:00
PERLCROSS_VERSION=1.0.3
PERLCROSS_PERL_VERSION=5.24.0
PERLCROSS_FILE=perl-${PERLCROSS_PERL_VERSION}-cross-${PERLCROSS_VERSION}.tar.gz
2015-06-13 01:03:31 +02:00
PERLCROSS_TAR=$TERMUX_PKG_CACHEDIR/$PERLCROSS_FILE
2015-12-15 14:55:07 +01:00
test ! -f $PERLCROSS_TAR && curl -o $PERLCROSS_TAR -L https://github.com/arsv/perl-cross/releases/download/$PERLCROSS_VERSION/$PERLCROSS_FILE
2015-06-13 01:03:31 +02:00
cd $TERMUX_PKG_SRCDIR
tar xf $PERLCROSS_TAR
cd perl-${PERLCROSS_PERL_VERSION}
2015-06-13 01:03:31 +02:00
cp -Rf * ../
# Remove old installation to force fresh:
rm -rf $TERMUX_PREFIX/lib/perl5
# Remove patch from perl-cross for file we patch ourselves:
rm $TERMUX_PKG_SRCDIR/cnf/diffs/liblist.patch
# Export variable used by Kid.pm.patch:
export TERMUX_PKG_SRCDIR
2015-06-13 01:03:31 +02:00
}
termux_step_configure () {
export PATH=$PATH:$TERMUX_STANDALONE_TOOLCHAIN/bin
ORIG_AR=$AR; unset AR
ORIG_AS=$AS; unset AS
ORIG_CC=$CC; unset CC
ORIG_CXX=$CXX; unset CXX
ORIG_CPP=$CPP; unset CPP
ORIG_CFLAGS=$CFLAGS; unset CFLAGS
ORIG_CPPFLAGS=$CPPFLAGS; unset CPPFLAGS
ORIG_CXXFLAGS=$CXXFLAGS; unset CXXFLAGS
ORIG_LDFLAGS=$LDFLAGS; unset LDFLAGS
ORIG_RANLIB=$RANLIB; unset RANLIB
ORIG_LD=$LD; unset LD
2015-08-31 02:35:01 +02:00
# Since we specify $TERMUX_PREFIX/bin/sh below for the shell
# it will be run during the build, so temporarily (removed in
# termux_step_post_make_install below) setup symlink:
rm -f $TERMUX_PREFIX/bin/sh
ln -s /bin/sh $TERMUX_PREFIX/bin/sh
2015-06-13 01:03:31 +02:00
cd $TERMUX_PKG_BUILDDIR
$TERMUX_PKG_SRCDIR/configure \
--target=$TERMUX_HOST_PLATFORM \
-Dsysroot=$TERMUX_STANDALONE_TOOLCHAIN/sysroot \
-Dprefix=$TERMUX_PREFIX \
2015-08-31 02:35:01 +02:00
-Dsh=$TERMUX_PREFIX/bin/sh \
2016-04-22 09:25:16 +02:00
-Duseshrplib \
2015-06-13 01:03:31 +02:00
-A ccflags="-specs=$TERMUX_SCRIPTDIR/termux.spec" \
-A ldflags="-specs=$TERMUX_SCRIPTDIR/termux.spec"
}
2015-07-09 03:21:45 +02:00
termux_step_post_make_install () {
# Replace hardlinks with symlinks:
cd $TERMUX_PREFIX/share/man/man1
2015-09-07 18:00:57 +02:00
rm {perlbug.1,c2ph.1}
2015-07-09 03:21:45 +02:00
ln -s perlthanks.1 perlbug.1
ln -s pstruct.1 c2ph.1
2015-08-31 02:35:01 +02:00
# Fix reference to termux.spec used only when cross compiling:
perl -p -i -e 's@-specs=/home/fornwall/dc/termux.spec@@g' $TERMUX_PREFIX/lib/perl5/*/*-linux/Config_heavy.pl
# lib/perl5/5.22.0/arm-linux/Config_heavy.pl
# Cleanup:
rm $TERMUX_PREFIX/bin/sh
2016-04-22 09:25:16 +02:00
cd $TERMUX_PREFIX/lib
ln -f -s perl5/${TERMUX_PKG_VERSION}/${TERMUX_ARCH}-linux/CORE/libperl.so libperl.so
cd $TERMUX_PREFIX/include
ln -f -s ../lib/perl5/${TERMUX_PKG_VERSION}/${TERMUX_ARCH}-linux/CORE perl
2015-07-09 03:21:45 +02:00
}