aboutsummaryrefslogtreecommitdiffstats
path: root/main/pcre/APKBUILD
blob: e230f3e9e2f75d742a94a0e3f5e818113b480965 (plain) (blame)
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
# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pcre
pkgver=8.43
pkgrel=1
pkgdesc="Perl-compatible regular expression library"
url="http://pcre.sourceforge.net"
arch="all"
license="BSD-3-Clause"
depends=
makedepends=""
checkdepends="paxmark"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools
	libpcrecpp libpcre16 libpcre32"
source="https://ftp.pcre.org/pub/pcre/pcre-$pkgver.tar.bz2
	CVE-2020-14155.patch
	"

# secfixes:
#   8.43-r0:
#     - CVE-2020-14155
#   8.40-r2:
#   - CVE-2017-7186
#   7.8-r0:
#   - CVE-2017-11164
#   - CVE-2017-16231

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

build() {
	cd "$builddir"

	local _enable_jit="--enable-jit"
	case "$CARCH" in
	mips64*) export CPPFLAGS="$CPPFLAGS -DSLJIT_IS_FPU_AVAILABLE=0";;
	mips*) export CPPFLAGS="$CPPFLAGS -DSLJIT_IS_FPU_AVAILABLE=0 -DSLJIT_MIPS_R1=1";;
	s390x) _enable_jit="";;
	esac

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		$_enable_jit \
		--enable-utf8 \
		--enable-unicode-properties \
		--enable-pcre8 \
		--enable-pcre16 \
		--enable-pcre32 \
		--with-match-limit-recursion=8192 \
		--htmldir=/usr/share/doc/$pkgname-$pkgver/html \
		--docdir=/usr/share/doc/$pkgname-$pkgver

	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

check() {
	cd "$builddir"

	# paxmark tests requiring JIT
	for fn in pcre_jit_test pcretest; do
		./$fn &>/dev/null < /dev/null || true
		[ -x .libs/lt-$fn ] && paxmark -m .libs/lt-$fn
	done

	# skip locale specific tests
	sed -i -e 's/do3=yes//g' RunTest

	make check
}

libpcrecpp() {
	pkgdesc="C++ bindings for PCRE"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libpcrecpp.so* "$subpkgdir"/usr/lib/
}

libpcre16() {
	pkgdesc="PCRE with 16 bit character support"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libpcre16.so* "$subpkgdir"/usr/lib/
}

libpcre32() {
	pkgdesc="PCRE with 32 bit character support"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libpcre32.so* "$subpkgdir"/usr/lib/
}

tools() {
	pkgdesc="Auxiliary utilities for PCRE"
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

sha512sums="3b4ac2c7ccd77c9575d07a33c3456f40b50731029e62d01fb8f2f5871d7118e12bc9e6bc7a8079769c765e38da5ecf98c4b261b10ff0a2f14f0881b434f67af7  pcre-8.43.tar.bz2
23baa5fbaff7b52e861a539a83ad4406937d7a8a85d2a4e2419d0bea99204659e350caab68091d6354842297df2bb3097204bc63c4e1d3d9d1b94427efc46748  CVE-2020-14155.patch"