aboutsummaryrefslogtreecommitdiffstats
path: root/main/icu/APKBUILD
blob: eea414410449c824dfa0a8b0f6484edf5fa0d0c6 (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
# Contributor: Sergey Lukin <sergej.lukin@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=icu
pkgver=58.2

# convert x.y.z to x_y_z
_ver=${pkgver//./_}

pkgrel=2
pkgdesc="International Components for Unicode library"
url="http://www.icu-project.org/"
arch="all"
license="custom:icu"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
depends=
makedepends=
source="http://download.icu-project.org/files/icu4c/${pkgver}/${pkgname}4c-$_ver-src.tgz
	icu-timezone.patch
	icu-58.1-iterator-reset.patch
	CVE-2017-7867-7868.patch
	"

# secfixes:
#   57.1-r1:
#     - CVE-2016-6293
#   58.1-r1:
#     - CVE-2016-7415
#   58.2-r2:
#     - CVE-2017-7867
#     - CVE-2017-7868
builddir="$srcdir"/icu/source

prepare() {
	cd "$builddir"
	update_config_sub || return 1

	# strtod_l() is not supported by musl; also xlocale.h is missing
	# It is not possible to disable its use via configure switches or env vars
	# so monkey patching is needed. Idea was stollen from openembedded
	# https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-support/icu/icu.inc#L30
	sed -i -e 's,DU_HAVE_STRTOD_L=1,DU_HAVE_STRTOD_L=0,' configure.ac
	sed -i -e 's,DU_HAVE_STRTOD_L=1,DU_HAVE_STRTOD_L=0,' configure

	local x
	# https://bugs.icu-project.org/trac/ticket/6102
	for x in ARFLAGS CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS; do
		sed -i -e "/^${x} =.*/s:@${x}@::" "config/Makefile.inc.in" \
			|| return 1
	done

	for i in $source; do
		case "$i" in
		*.patch)
			msg "Applying $i"
			patch -p1 -i "$srcdir"/$i || return 1
			;;
		esac
	done
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--with-data-packaging=library \
		--disable-samples \
		--mandir=/usr/share/man \
		|| return 1
	make || return 1
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install || return 1
	chmod +x "$pkgdir"/usr/bin/icu-config
	install -Dm644 "$srcdir"/icu/license.html \
		"$pkgdir"/usr/share/licenses/icu/license.html
}

libs() {
	default_libs
	replaces="icu"
}

sha512sums="5c21af748f48b392e6c0412bd0aee92162ea931820dcbfab4ec6e0299868504b303d88f7586cc95de55c777ac0dca3a29d6c8ca0892c646ebc864c8a5b5a162a  icu4c-58_2-src.tgz
40489c36e28e160f08e045acab6c19cdb712ad3b7f87f67099deac7d579aaf13d8841cd3278a6bb0e998b5c34a378348a13fcc8bb14c9c4eb4f6adbd10d66825  icu-timezone.patch
c97986e188bc0f3daa2d3bebed309b87704797f527197fde910794499d1079ea0ce33a75124d2f9a8fd451d91a44d8d5077fc77c1cd49aee53bdbaf61a5826d1  icu-58.1-iterator-reset.patch
4b6a6d5a2d96ca2beb400170278745871f6903ff6d0b1e83ddaae3e13dfc872e94805e16540f2e2e9f797cdf9b47d06152e728ed76c77a63c36aeeb1ad8870ad  CVE-2017-7867-7868.patch"