# Maintainer: Natanael Copa # Contributor: Leonardo Arena # Contributor: Valery Kartel pkgname=perl pkgver=5.38.0 pkgrel=0 pkgdesc="Larry Wall's Practical Extraction and Report Language" url="https://www.perl.org/" arch="all" license="Artistic-1.0-Perl OR GPL-1.0-or-later" depends_dev="perl-utils=$pkgver-r$pkgrel" makedepends="bzip2-dev zlib-dev" subpackages="$pkgname-doc $pkgname-dev $pkgname-utils::noarch miniperl" source="https://www.cpan.org/src/5.0/perl-$pkgver.tar.xz digest-sha-cflags.patch musl-skip-dst-test.patch skip-test-due-to-busybox-ps.patch musl-stack-size.patch " # creates empty usr/local/{lib,share} for local sitedirs options="!fhs" # in perl core, removed from main/perl-scalar-list-utils provides=" perl-scalar-list-utils=$pkgver-r$pkgrel " # secfixes: # 5.34.0-r1: # - CVE-2021-36770 # 5.30.3-r0: # - CVE-2020-10543 # - CVE-2020-10878 # - CVE-2020-12723 # 5.26.3-r0: # - CVE-2018-18311 # - CVE-2018-18312 # - CVE-2018-18313 # - CVE-2018-18314 # 5.26.2-r1: # - CVE-2018-12015 # 5.26.2-r0: # - CVE-2018-6797 # - CVE-2018-6798 # - CVE-2018-6913 # 5.26.1-r0: # - CVE-2017-12837 # - CVE-2017-12883 _privlib=/usr/share/perl5/core_perl _archlib=/usr/lib/perl5/core_perl prepare() { # most sources are readonly but we patch some chmod +w "$builddir"/*.c default_prepare # Ensure that we never accidentally bundle zlib or bzip2 rm -rf cpan/Compress-Raw-Zlib/zlib-src rm -rf cpan/Compress-Raw-Bzip2/bzip2-src sed -i '/\(bzip2\|zlib\)-src/d' MANIFEST } build() { export BUILD_ZLIB=0 export BUILD_BZIP2=0 export BZIP2_LIB=/usr/lib export BZIP2_INCLUDE=/usr/include # language runtime export CFLAGS="$CFLAGS -O2 -flto=auto" ./Configure -des \ -Dcccdlflags='-fPIC' \ -Dccdlflags='-rdynamic' \ -Dprefix=/usr \ -Dprivlib=$_privlib \ -Darchlib=$_archlib \ -Dvendorprefix=/usr \ -Dvendorlib=/usr/share/perl5/vendor_perl \ -Dvendorarch=/usr/lib/perl5/vendor_perl \ -Dsiteprefix=/usr/local \ -Dsitelib=/usr/local/share/perl5/site_perl \ -Dsitearch=/usr/local/lib/perl5/site_perl \ -Dlocincpth=' ' \ -Doptimize="$CFLAGS" \ -Duselargefiles \ -Dusethreads \ -Duseshrplib \ -Dd_semctl_semun \ -Dman1dir=/usr/share/man/man1 \ -Dman3dir=/usr/share/man/man3 \ -Dinstallman1dir=/usr/share/man/man1 \ -Dinstallman3dir=/usr/share/man/man3 \ -Dman1ext='1' \ -Dman3ext='3pm' \ -Dcf_by='Alpine' \ -Ud_csh \ -Ud_fpos64_t \ -Ud_off64_t \ -Dusenm make libperl.so && make } check() { export CI=true export LC_ALL=C # Perl tests HARNESS_OPTIONS against the regex # /^j(\d*)$/, if $JOBS is unset, it defaults to 9 export HARNESS_OPTIONS=j"$JOBS" export PERL_TEST_HARNESS_ASAP=1 make test_harness_notty } package() { make DESTDIR="$pkgdir" install # omit global flto afterward # perl saves compile-time cflags and applies them to every future build sed -i \ -e "s| -flto=auto||g" \ "$pkgdir"/usr/lib/perl5/core_perl/Config_heavy.pl if [ -n "$(find "$pkgdir"/usr/local -type f)" ]; then error "files found under /usr/local" return 1 fi install -Dm755 miniperl \ -t "$pkgdir"/usr/bin/ # delete files starting with a dot, # but really just usr/lib/perl5/core_perl/.packlist find "$pkgdir" -name '.*' -delete } miniperl() { amove usr/bin/miniperl } doc() { local file; find "$pkgdir" -name "*.pod" | while read -r file; do amove "${file#"$pkgdir"}" done default_doc } dev() { amove \ $_archlib/Devel \ $_privlib/Encode \ usr/bin/h2xs \ usr/bin/perlivp \ usr/bin/enc2xs \ usr/bin/xsubpp default_dev } utils() { pkgdesc="$pkgdesc (misc utilities)" depends="$pkgname=$pkgver-r$pkgrel" amove \ usr/bin/corelist \ usr/bin/cpan \ usr/bin/encguess \ usr/bin/libnetcfg \ usr/bin/h2ph \ usr/bin/instmodsh \ usr/bin/json_pp \ usr/bin/perlbug \ usr/bin/perlthanks \ usr/bin/piconv \ usr/bin/pl2pm \ usr/bin/prove \ usr/bin/ptar \ usr/bin/ptardiff \ usr/bin/ptargrep \ usr/bin/shasum \ usr/bin/splain \ usr/bin/zipdetails } sha512sums=" 71beff7f6daa22a967972f5805daf2d4ff837a17e5ab808780f815d5914a67acf4f2e92acac0f2d8b24bdde4ceec0c2f7cb3029b5eadeeb30191f757e1bf0f9d perl-5.38.0.tar.xz 59afa4c166e4808d355e19cd70748540ffce9da5c6919c71648be7678de328409f9121ddea33415add73fc01a22e95ed9d9629f31b8ba20b3bbfc04dab926c63 digest-sha-cflags.patch 3eaec691bc38e208ba4f34130ae45e50b6c339fa50093d0b0f6d7f24cb5b7c2a3734ca714a279c4b51173f82e46a8e7a3e70bfc7d7471a18c55a2102140e4186 musl-skip-dst-test.patch ba9cb1ff4a6e8e4c31bf4ef132c071ac919ffe45842cf5e98c8ca72d78ef4803883b57a0e7b8037da0079561a6ce9e6bd8d127892ac1bcb047638cb3ba3157f6 skip-test-due-to-busybox-ps.patch c004d6612ec754e5947255a2e2d15b5581f187c32495aeeec9f4fa286919bd9f40c72b63db61e3f4004b09288af2063a6a14b67e5c289e9a8b23ebd7c216e16f musl-stack-size.patch "