perl: Link against libper.so in modules
[termux-packages] / packages / perl / build.sh
CommitLineData
59f0d218
FF
1# This port uses perl-cross: http://arsv.github.io/perl-cross/index.html
2TERMUX_PKG_HOMEPAGE=http://www.perl.org/
3TERMUX_PKG_DESCRIPTION="Capable, feature-rich programming language"
aba4a7e0
FF
4# cpan modules will require make:
5TERMUX_PKG_DEPENDS="make"
704e64f2 6TERMUX_PKG_VERSION=5.22.1
a02b0383 7TERMUX_PKG_BUILD_REVISION=4
59f0d218
FF
8TERMUX_PKG_SRCURL=http://www.cpan.org/src/5.0/perl-${TERMUX_PKG_VERSION}.tar.gz
9# Does not work with parallell builds:
10TERMUX_MAKE_PROCESSES=1
11TERMUX_PKG_RM_AFTER_INSTALL="bin/perl${TERMUX_PKG_VERSION}"
aba4a7e0 12TERMUX_PKG_BUILD_IN_SRC="yes"
a3462cd1 13TERMUX_PKG_NO_DEVELSPLIT=yes
59f0d218
FF
14
15termux_step_post_extract_package () {
704e64f2 16 PERLCROSS_VERSION=1.0.2
59f0d218
FF
17 PERLCROSS_FILE=perl-${TERMUX_PKG_VERSION}-cross-${PERLCROSS_VERSION}.tar.gz
18 PERLCROSS_TAR=$TERMUX_PKG_CACHEDIR/$PERLCROSS_FILE
704e64f2 19 test ! -f $PERLCROSS_TAR && curl -o $PERLCROSS_TAR -L https://github.com/arsv/perl-cross/releases/download/$PERLCROSS_VERSION/$PERLCROSS_FILE
59f0d218
FF
20 cd $TERMUX_PKG_SRCDIR
21 tar xf $PERLCROSS_TAR
22 cd perl-${TERMUX_PKG_VERSION}
23 cp -Rf * ../
24
25 # Remove old installation to force fresh:
26 rm -rf $TERMUX_PREFIX/lib/perl5
a02b0383
FF
27
28 # Remove patch from perl-cross for file we patch ourselves:
29 rm $TERMUX_PKG_SRCDIR/cnf/diffs/liblist.patch
30 # Export variable used by Kid.pm.patch:
31 export TERMUX_PKG_SRCDIR
59f0d218
FF
32}
33
34termux_step_configure () {
35 export PATH=$PATH:$TERMUX_STANDALONE_TOOLCHAIN/bin
36
37 ORIG_AR=$AR; unset AR
38 ORIG_AS=$AS; unset AS
39 ORIG_CC=$CC; unset CC
40 ORIG_CXX=$CXX; unset CXX
41 ORIG_CPP=$CPP; unset CPP
42 ORIG_CFLAGS=$CFLAGS; unset CFLAGS
43 ORIG_CPPFLAGS=$CPPFLAGS; unset CPPFLAGS
44 ORIG_CXXFLAGS=$CXXFLAGS; unset CXXFLAGS
45 ORIG_LDFLAGS=$LDFLAGS; unset LDFLAGS
46 ORIG_RANLIB=$RANLIB; unset RANLIB
47 ORIG_LD=$LD; unset LD
48
aba4a7e0
FF
49 # Since we specify $TERMUX_PREFIX/bin/sh below for the shell
50 # it will be run during the build, so temporarily (removed in
51 # termux_step_post_make_install below) setup symlink:
52 rm -f $TERMUX_PREFIX/bin/sh
53 ln -s /bin/sh $TERMUX_PREFIX/bin/sh
54
59f0d218
FF
55 cd $TERMUX_PKG_BUILDDIR
56 $TERMUX_PKG_SRCDIR/configure \
57 --target=$TERMUX_HOST_PLATFORM \
58 -Dsysroot=$TERMUX_STANDALONE_TOOLCHAIN/sysroot \
59 -Dprefix=$TERMUX_PREFIX \
aba4a7e0 60 -Dsh=$TERMUX_PREFIX/bin/sh \
a3462cd1 61 -Duseshrplib \
59f0d218
FF
62 -A ccflags="-specs=$TERMUX_SCRIPTDIR/termux.spec" \
63 -A ldflags="-specs=$TERMUX_SCRIPTDIR/termux.spec"
64}
9a9aaa90
FF
65
66termux_step_post_make_install () {
67 # Replace hardlinks with symlinks:
68 cd $TERMUX_PREFIX/share/man/man1
37128d28 69 rm {perlbug.1,c2ph.1}
9a9aaa90 70 ln -s perlthanks.1 perlbug.1
9a9aaa90 71 ln -s pstruct.1 c2ph.1
aba4a7e0
FF
72
73 # Fix reference to termux.spec used only when cross compiling:
74 perl -p -i -e 's@-specs=/home/fornwall/dc/termux.spec@@g' $TERMUX_PREFIX/lib/perl5/*/*-linux/Config_heavy.pl
75
76 # lib/perl5/5.22.0/arm-linux/Config_heavy.pl
77 # Cleanup:
78 rm $TERMUX_PREFIX/bin/sh
a3462cd1
FF
79
80 cd $TERMUX_PREFIX/lib
81 ln -f -s perl5/${TERMUX_PKG_VERSION}/${TERMUX_ARCH}-linux/CORE/libperl.so libperl.so
82
83 cd $TERMUX_PREFIX/include
84 ln -f -s ../lib/perl5/${TERMUX_PKG_VERSION}/${TERMUX_ARCH}-linux/CORE perl
9a9aaa90 85}