archrelease: copy trunk to extra-x86_64
[arch-packages.git] / brotli / repos / core-x86_64 / PKGBUILD
blob14b769ab8774bb02d07b0052bd8b268378741d43
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>
7 pkgbase=brotli
8 pkgname=('brotli' 'python-brotli' 'brotli-testdata')
9 _gitcommit=e61745a6b7add50d380cfd7d3883dd6c62fc2c71
10 pkgver=1.0.9
11 pkgrel=12
12 pkgdesc='Generic-purpose lossless compression algorithm'
13 url='https://github.com/google/brotli'
14 arch=('x86_64')
15 license=('MIT')
16 makedepends=('git' 'cmake' 'python-setuptools')
17 source=(${pkgname}::"git+${url}#commit=${_gitcommit}")
18 sha512sums=('SKIP')
20 prepare() {
21   cd ${pkgbase}
22   git cherry-pick -n 09b0992b6acb7faa6fd3b23f9bc036ea117230fc # Fix broken Libs: in pc file
25 pkgver() {
26   cd ${pkgbase}
27   git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
30 build() {
31   cd ${pkgbase}
32   python setup.py build
33   cmake -S . -B build \
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
41 check() {
42   cd ${pkgbase}
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"
45   cd build
46   ctest --output-on-failure --stop-on-failure -j$(nproc)
49 package_brotli() {
50   depends=('glibc')
51   provides=(libbrotlicommon.so libbrotlidec.so libbrotlienc.so)
53   cd ${pkgbase}
54   DESTDIR="$pkgdir" cmake --install build
55   local man
56   for man in docs/*.?; do
57     install -Dm 644 "$man" "$pkgdir/usr/share/man/man${man##*.}/${man##*/}"
58   done
59   install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
62 package_python-brotli() {
63   pkgdesc+=' - python library'
64   depends=('python')
66   cd ${pkgbase}
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'
73   depends=()
75   cd ${pkgbase}
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"