aboutsummaryrefslogtreecommitdiffstats
path: root/main/perl/APKBUILD
blob: 316430908d2d651cf8c7e2daac5171cbaaff4a6e (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
pkgname=perl
pkgver=5.24.4
pkgrel=2
pkgdesc="Larry Wall's Practical Extraction and Report Language"
url="http://www.perl.org/"
arch="all"
license="Artistic GPL2"
options="!fhs"
depends=""
depends_dev="perl-utils"
makedepends="bzip2-dev zlib-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-utils::noarch miniperl"
source="http://www.cpan.org/src/5.0/perl-$pkgver.tar.gz
	CVE-2018-12015.patch
	CVE-2018-18311.patch
	CVE-2018-18312.patch
	CVE-2018-18313.patch
	CVE-2018-18314.patch
	"

# secfixes:
#   5.24.4-r2:
#     - CVE-2018-18311
#     - CVE-2018-18312
#     - CVE-2018-18313
#     - CVE-2018-18314
#   5.24.4-r1:
#     - CVE-2018-12015
#   5.24.3-r0:
#     - CVE-2017-12837
#     - CVE-2017-12883
#   5.24.3-r1:
#     - CVE-2016-9843
#     - CVE-2016-9841
#     - CVE-2016-9840
#     - CVE-2016-9842
#   5.24.4-r0:
#     - CVE-2018-6797
#     - CVE-2018-6798
#     - CVE-2018-6913

builddir="$srcdir/$pkgname-$pkgver"

_privlib=/usr/share/perl5/core_perl
_archlib=/usr/lib/perl5/core_perl

prepare() {
	default_prepare || return 1
	cd "$builddir"
	sed	-e 's/less -R/less/g' \
		-e 's/libswanted="\(.*\) nsl\(.*\)"/libswanted="\1\2"/g' \
		-i ./Configure || return 1

	# 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() {
	cd "$builddir"
	BUILD_ZLIB=0
	BUILD_BZIP2=0
	BZIP2_LIB=/usr/lib
	BZIP2_INCLUDE=/usr/inculde

	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 \
		|| return 1
	make libperl.so && make || return 1
}

package() {
	cd "$builddir"
	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 || return 1
}

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

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

	rm "$pkgdir"/usr/bin/pstruct "$pkgdir"/usr/bin/perlbug
	ln -sf /usr/bin/c2ph "$subpkgdir"/usr/bin/pstruct
	ln -sf /usr/bin/perlthanks "$subpkgdir"/usr/bin/perlbug
	default_dev
}

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

sha512sums="796d92f47860ac0e3a22d85eb129549c4251445b3cfa8687e305c95f6205ad32a670e0d680e20245e47f0c6567b313748bce1db04208b21ff10595196e37a40b  perl-5.24.4.tar.gz
feda381bd3230443341b99135bac4d6010e9d28b619d9fb57f2dda2c29b8877f012f76d31631e5227ef79e73e0b2b162548fa24704752e61f10c05d015c68916  CVE-2018-12015.patch
c1af39d5f293cb83b5ce8cea0835a52470cc2aa67cf541bfc20fd25c815cd9124cb6d91df979235868223ba2244ceed1336e304e10df74b40b706268ffc2b8c1  CVE-2018-18311.patch
f785a9b94311a4a8dfdf811006c8eb540808d75922d7d5c48e567c949ebf0dc4fe2641163e1220db3a29d650c2d35ed278bb3867f8ebe626faad05bf75d32ad1  CVE-2018-18312.patch
bcc8438fc8bceef83b23dac2e788ceb5d70f645054b5d04c555004ccfe2f85a83f835b387ee318e1ca8668afb7601eeacfc4355e8a70e98549c15b1521555318  CVE-2018-18313.patch
df59c1cb4ca8d651d544524ae01c092f0451ec27f7d821bc7e61e1b7385161e241797e84ae85782b3869d432bca72a93bfe71590a1cf879f7c5a11b780d3c4dd  CVE-2018-18314.patch"