jobcore/brotli/PKGBUILD

95 lines
2.8 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=brotli
pkgname=('brotli' 'python-brotli' 'brotli-testdata')
pkgver=1.1.0
pkgrel=01
pkgdesc='Generic-purpose lossless compression algorithm'
url='https://github.com/google/brotli'
makedepends=(git cmake python-setuptools python-build python-installer python-wheel)
# options=('debug') ## uncomment this to produce the debug pkg
_gitcommit=ed738e842d2fbdf2d6459e39267a633c4a9b2f5d
source=(${pkgname}::"git+${url}#commit=${_gitcommit}")
#prepare() {
# cd ${pkgbase}
# git cherry-pick -n 09b0992b6acb7faa6fd3b23f9bc036ea117230fc # Fix broken Libs: in pc file
#}
pkgver() {
cd ${pkgbase}
git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
build() {
cd ${pkgbase}
# python setup.py build
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"
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('MIT')
sha256sums=(SKIP)
## 648dbfe4d27a9c761b019c2032b1e793866b939d668429d842a7ba0a14127b44 brotli-1.1.0-01-x86_64.pkg.tar.lz
## 562dbea12821909d64daeb6a77002e189f8f9a0c6c46f07d56b5730539f01d96 brotli-testdata-1.1.0-01-x86_64.pkg.tar.lz
## 66ca1fd711a3b6a83bfe6233cd2c24aa1c980d97b879db4db054f2794ff9bca8 python-brotli-1.1.0-01-x86_64.pkg.tar.lz