summaryrefslogtreecommitdiff
path: root/main/brotli/APKBUILD
blob: a0c09b7d1d13d8667eb82f2c7eed0764c5622aa9 (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: prspkt <prspkt@protonmail.com>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=brotli
pkgver=1.0.9
pkgrel=9
pkgdesc="Generic lossless compressor"
url="https://github.com/google/brotli"
arch="all"
license="MIT"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends_build="automake autoconf libtool"
if [ -z "$BOOTSTRAP" ]; then
	makedepends_host="python3-dev"
	python="py3-$pkgname:py3"
fi
subpackages="
	$pkgname-doc
	$pkgname-static
	$pkgname-dev
	$pkgname-libs
	$python
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/google/brotli/archive/refs/tags/v$pkgver.tar.gz
	optimize-mips-s390x.patch
	build-tool-against-shared-lib.patch
	838.patch
	0545759b2ed9b69e3f21fd0ac954bee78f3104b6.patch
	"

# secfixes:
#   1.0.9-r0:
#     - CVE-2020-8927

prepare() {
	default_prepare
	sed -i 's,/usr/bin/env bash,/bin/sh,' tests/*.sh
	sh ./bootstrap
}

build() {
	# use sysroot when cross compiling to avoid libtool pulling in host libs
	if [ "$CBUILD"  != "$CHOST" ]; then
		local cross_configure="--with-sysroot=$CBUILDROOT"
	else
		CFLAGS="$CFLAGS -flto=auto"
	fi

	CFLAGS="$CFLAGS -O2" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--target=$CTARGET \
		--prefix=/usr \
		$_cross_configure

	make

	if [ -z "$BOOTSTRAP" ]; then
		python3 setup.py build
	fi
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	local man; for man in docs/*.?; do
		install -D -m644 $man "$pkgdir"/usr/share/man/man${man##*.}/${man##*/}
	done

	if [ -z "$BOOTSTRAP" ]; then
		python3 setup.py install --skip-build --root="$pkgdir"
	fi
}

py3() {
	pkgdesc="$pkgdesc (python bindings)"

	amove usr/lib/python3*
}

sha512sums="
b8e2df955e8796ac1f022eb4ebad29532cb7e3aa6a4b6aee91dbd2c7d637eee84d9a144d3e878895bb5e62800875c2c01c8f737a1261020c54feacf9f676b5f5  brotli-1.0.9.tar.gz
59e934578ce23b703f8f25f56578f8e9fd1466a9844b6f67b542acd6496df352548e3762697dc3851cfd0f8e1bad170bfdaa3e8a87c901fe81e2f3042e3aee84  optimize-mips-s390x.patch
f4a7653a0f7ef69f059d7f744a48c7731c8e66f977ce2e66cd106f697e82aa1f005923898d216a3d8be143b2dc8db1927c09daedb981818e752640a333d75fbc  build-tool-against-shared-lib.patch
58ef677595f0db80b7d1353e42603cc30ef9b0b9530927f731ee31ac60ad9a3b2aac960a5cd100f8b10e547c9534e1ebf78c53550b52eed6fb3b7fb853317d20  838.patch
6b7953f09c7ce4219dd9411d53fcd495e0de92f210c53be43dcd235a47050b10933b347fcc8e92d7e3fd89b12375eb0deea61b01eb279902079fa7b7aca62a5a  0545759b2ed9b69e3f21fd0ac954bee78f3104b6.patch
"