1 # Maintainer: Felix Yan <felixonmars@archlinux.org>
2 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
3 # Contributor: Lex Black <autumn-wind at web dot de>
4 # Contributor: TingPing <tingping@tingping.se>
5 # Contributor: Guillaume Horel <guillaume.horel@gmail.com>
8 pkgname=('brotli' 'python-brotli' 'brotli-testdata')
9 _gitcommit=e61745a6b7add50d380cfd7d3883dd6c62fc2c71
12 pkgdesc='Generic-purpose lossless compression algorithm'
13 url='https://github.com/google/brotli'
16 makedepends=('git' 'cmake' 'python-setuptools')
17 source=(${pkgname}::"git+${url}#commit=${_gitcommit}")
22 git cherry-pick -n 09b0992b6acb7faa6fd3b23f9bc036ea117230fc # Fix broken Libs: in pc file
27 git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
34 -DCMAKE_BUILD_TYPE=Release \
35 -DCMAKE_INSTALL_PREFIX=/usr \
36 -DBUILD_SHARED_LIBS=True \
37 -DCMAKE_C_FLAGS="$CFLAGS -ffat-lto-objects"
38 cmake --build build -v
43 local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
44 PYTHONPATH="$PWD/bin/lib.linux-$CARCH-cpython-${python_version}" python -m unittest discover python "*_test.py"
46 ctest --output-on-failure --stop-on-failure -j$(nproc)
51 provides=(libbrotlicommon.so libbrotlidec.so libbrotlienc.so)
54 DESTDIR="$pkgdir" cmake --install build
56 for man in docs/*.?; do
57 install -Dm 644 "$man" "$pkgdir/usr/share/man/man${man##*.}/${man##*/}"
59 install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
62 package_python-brotli() {
63 pkgdesc+=' - python library'
67 python setup.py install --skip-build -O1 --root="$pkgdir"
68 install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
71 package_brotli-testdata() {
72 pkgdesc+=' - test data'
76 install -dm755 "$pkgdir"/usr/share/brotli
77 cp -a tests/testdata "$pkgdir"/usr/share/brotli/
78 install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"