# Exit on error:
set -e

wget http://www.cpan.org/src/5.0/perl-5.18.1.tar.gz
tar xf perl-5.18.1.tar.gz
cd perl-5.18.1

CC=/static/bin/musl-gcc \
    LDFLAGS='-s -L/static/lib -static -static-libgcc' \
    sh Configure -ds -e -Dprefix=/static

make install
cd ..
rm -rf perl-5.18.1
rm perl-5.18.1.tar.gz

echo
echo a2p, perl and perl5.18.1 are linked dynamically under
echo /static/bin in order to be able to use Perl modules immediately
echo after install instead of having to recompile Perl first. 

exit 0
