Name brotli
Description Generic-purpose lossless compression algorithm
Version 1.2.0-1
Package Base brotli
Homepage https://github.com/google/brotli
Maintainers ['Felix Yan <felixonmars@archlinux.org>', 'Levente Polyak <anthraxx[at]archlinux[dot]org>']
Contributors ['Guillaume Horel <guillaume.horel@gmail.com>', 'Lex Black <autumn-wind@web.de>', 'TingPing <tingping@tingping.se>']
Distro-repo https://gitlab.archlinux.org/archlinux/packaging/packages/brotli
Sources ['brotli::git+https://github.com/google/brotli#tag=v1.2.0']
Dependencies ['glibc']
Optional-Dependencies []
Build-Dependencies ['git', 'cmake', 'python-setuptools', 'python-build', 'python-installer', 'python-wheel', 'python-pkgconfig']
Provides ['libbrotlicommon.so', 'libbrotlidec.so', 'libbrotlienc.so']
Builddate 03-01-2026 19:30:15
Architecture x86_64
Distro-Version
Licenses ['MIT']
Hash 4a0c95d5967476d0efdaf76d344b61e3eee02cd7920a315e457f3fd96311b7ec
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Lex Black <autumn-wind at web dot de>
# Contributor: TingPing <tingping@tingping.se>
# Contributor: Guillaume Horel <guillaume.horel@gmail.com>

pkgbase=brotli
pkgname=('brotli' 'python-brotli' 'brotli-testdata')
pkgver=1.2.0
pkgrel=1
pkgdesc='Generic-purpose lossless compression algorithm'
url='https://github.com/google/brotli'
arch=('x86_64')
license=('MIT')
makedepends=(
  git
  cmake
  python-setuptools
  python-build
  python-installer
  python-wheel
  python-pkgconfig
)
source=(${pkgname}::"git+${url}#tag=v${pkgver}")
sha512sums=('36b8fadb3e5de540746eea19c758234095fafc0a4a687bd70fc70b0f74036c03cf9c70a7339aa1626f1197b5ac707bf5b01e393f6cd26c90b78519529724871a')

pkgver() {
  cd ${pkgbase}
  git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd ${pkgbase}
  python -m build --wheel --no-isolation
  cmake -S . -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=True \
    -DCMAKE_C_FLAGS="$CFLAGS -ffat-lto-objects"
  cmake --build build -v
}

check() {
  cd ${pkgbase}
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/bin/lib.linux-$CARCH-cpython-${python_version}" python -m unittest discover python "*_test.py"
  cd build
  ctest --output-on-failure --stop-on-failure -j$(nproc)
}

package_brotli() {
  depends=('glibc')
  provides=(libbrotlicommon.so libbrotlidec.so libbrotlienc.so)

  cd ${pkgbase}
  DESTDIR="$pkgdir" cmake --install build
  local man
  for man in docs/*.?; do
    install -Dm 644 "$man" "$pkgdir/usr/share/man/man${man##*.}/${man##*/}"
  done
  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}

package_python-brotli() {
  pkgdesc+=' - python library'
  depends=('python')

  cd ${pkgbase}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}

package_brotli-testdata() {
  pkgdesc+=' - test data'
  depends=()

  cd ${pkgbase}
  install -dm755 "$pkgdir"/usr/share/brotli
  cp -a tests/testdata "$pkgdir"/usr/share/brotli/
  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}

# vim:set ts=2 sw=2 et: