aboutsummaryrefslogtreecommitdiffstats
path: root/main/perl/APKBUILD
blob: 49d12fb66b9c6b65d0eeed80717ca423dc17bca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
pkgname=perl
pkgver=5.34.2
pkgrel=0
pkgdesc="Larry Wall's Practical Extraction and Report Language"
url="https://www.perl.org/"
arch="all"
license="Artistic-Perl OR GPL-1.0-or-later"
options="!fhs"
depends_dev="perl-utils"
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.gz
	musl-locale.patch
	musl-skip-dst-test.patch
	skip-test-due-to-busybox-ps.patch
	musl-stack-size.patch
	zlib-test.patch
	release_status.patch
	"
# Tests too slow, and some failures on mips64.
[ "$CARCH" = "mips64" ] && options="$options !check"

# secfixes:
#   5.34.2-r0:
#     - CVE-2023-47038
#   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() {
	chmod +w "$builddir"/*.c
	default_prepare
	sed	-e 's/less -R/less/g' \
		-e 's/libswanted="\(.*\) nsl\(.*\)"/libswanted="\1\2"/g' \
		-i ./Configure

	# 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() {
	BUILD_ZLIB=0
	BUILD_BZIP2=0
	BZIP2_LIB=/usr/lib
	BZIP2_INCLUDE=/usr/include

	export BUILD_ZLIB BUILD_BZIP2 BZIP2_LIB BZIP2_INCLUDE
	./Configure -des \
		-Dcccdlflags='-fPIC' \
		-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 \
		-Dusenm
	make libperl.so && make
}

check() {
	export CI=true
	export LC_ALL=C
	make test-notty
}

package() {
	make DESTDIR="$pkgdir" install
	if [ -n "$(find $pkgdir/usr/local -type f)" ]; then
		error "files found under /usr/local"
		return 1
	fi
	find "$pkgdir" -name '.*' -delete
}

miniperl() {
	install -Dm755 "$builddir"/$subpkgname \
		"$subpkgdir"/usr/bin/$subpkgname
}

doc() {
	default_doc
	local file; for file in $(find "$pkgdir" -name "*.pod"); do
		file=${file#$pkgdir/}
		mkdir -p "$subpkgdir"/${file%/*}
		mv "$pkgdir"/$file "$subpkgdir"/$file
	done
}

dev() {
	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/$_archlib "$subpkgdir"/$_privlib
	mv "$pkgdir"/$_archlib/Devel "$subpkgdir"/$_archlib/
	mv "$pkgdir"/$_privlib/Encode "$subpkgdir"/$_privlib/

	mv "$pkgdir"/usr/bin/h2xs \
		"$pkgdir"/usr/bin/perlivp \
		"$pkgdir"/usr/bin/enc2xs \
		"$pkgdir"/usr/bin/xsubpp \
		"$subpkgdir"/usr/bin/

	default_dev
}

utils() {
	pkgdesc="$pkgdesc (misc utilities)"
	depends="$pkgname"
	mkdir -p "$subpkgdir"/usr/bin
	local file
	for file in \
		corelist \
		cpan \
		encguess \
		libnetcfg \
		h2ph \
		instmodsh \
		json_pp \
		perlbug \
		perlthanks \
		piconv \
		pl2pm \
		prove \
		ptar \
		ptardiff \
		ptargrep \
		shasum \
		splain \
		zipdetails
	do
		mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/
	done
}

sha512sums="
c8c68f581215162939b37430708132d64abd251cce785bd7aba45f923424e912d54fbce6fcf7da42d49ec434b100c6c23477290dd248c03d763d1b83d072ba6a  perl-5.34.2.tar.gz
a78b5fb1a2b6f60b401329cfd2d8349d4fdcc19628cde0e9b840b82e1a02e705f7d7413fe206aa13ed714ab93a65b62ac3d85dfd526ca8048621d5d89b22f0ef  musl-locale.patch
3eaec691bc38e208ba4f34130ae45e50b6c339fa50093d0b0f6d7f24cb5b7c2a3734ca714a279c4b51173f82e46a8e7a3e70bfc7d7471a18c55a2102140e4186  musl-skip-dst-test.patch
ba9cb1ff4a6e8e4c31bf4ef132c071ac919ffe45842cf5e98c8ca72d78ef4803883b57a0e7b8037da0079561a6ce9e6bd8d127892ac1bcb047638cb3ba3157f6  skip-test-due-to-busybox-ps.patch
c004d6612ec754e5947255a2e2d15b5581f187c32495aeeec9f4fa286919bd9f40c72b63db61e3f4004b09288af2063a6a14b67e5c289e9a8b23ebd7c216e16f  musl-stack-size.patch
bbb2beb49604982c42c833b229852bc8bca4e3498f97fcfbb3bf7de10dddbef3b21c917f333958c64feb99a65f4093773e33018ae0e91dadeecdf985ab0ed3a2  zlib-test.patch
78d0f7a23526973eb1d67c0a7cc7304670d846b69151de4bed9dda6b5f9fffd575a564f982a152111886572e521a063d8b08647f7df223ca9f7493050cd26a5a  release_status.patch
"