APP=perl
VERSION=5.24.3
BUILD=1sml
HOMEPAGE='https://www.perl.org/'
DOWNLOAD='https://www.cpan.org/src/5.0/perl-5.24.3.tar.xz'
REQUIRES="db"

build() {
  mkandenterbuilddir
  rm -rf $APP-$VERSION

  tar xf $SRCDIR/$APP-$VERSION.tar.?z*
  cd $APP-$VERSION
  fixbuilddirpermissions

  sed '1i#define PERL_BUILD_DATE "01.01.18 00:00:00"' -i perl.c

  sed -e 's;myuname=`$u;myuname="linux host" #`$u;' \
    -e 's;cf_time=`;cf_time="01.01.18 00:00:00" #`;' \
    -e 's;cf_by=`;cf_by=user #`;' \
    -e "s;^myhostname='';myhostname=host;" \
    -e "s;^phostname='';phostname=host;" \
  -i Configure

  sed -i 's,-fstack-protector,-fnostack-protector,g' ./Configure

  ./Configure -des \
    -Accflags='$CFLAGS -D_BSD_SOURCE' \
    -Dprefix="/" \
    -Dvendorprefix="/" \
    -Dsitelib="/lib/perl5/site_perl" \
    -Dsitearch="/lib/perl5/site_perl" \
    -Darchlib="/lib/perl5/core_perl" \
    -Dprivlib="/lib/perl5/core_perl" \
    -Dvendorlib="/lib/perl5/vendor_perl" \
    -Dvendorarch="/lib/perl5/vendor_perl" \
    -Dscriptdir='/bin' \
    -Dbin='/bin' \
    -Duseshrplib \
    -Dusethreads \
    -Ubincompat5005 \
    -Uversiononly \
    -Dcc="$CC" 

  make
  make install DESTDIR=$PKG

  rm -f $PKG/*.0 

  cp Artistic $PKGDOCS/

  mkfinalpkg
}

SHA512SUMS="
330bbcd4bc8fc25dd84f9170f8b56450fa3ab4cdd6f39ab85fbfc4b9b8b47c130f312839189f45e6e2d7ca557524a3ee2cbd06f4aeb3ac96b4dd4f70b466cec6  perl-5.24.3.tar.lz
"
