void-packages/srcpkgs/python3-adblock/template

45 lines
1.5 KiB
Bash

# Template file for 'python3-adblock'
pkgname=python3-adblock
version=0.5.2
revision=1
wrksrc="${pkgname#python3-}-${version}"
build_style=python3-pep517
build_helper="rust"
#XXX: Does statically link against openssl
hostmakedepends="maturin pkg-config cargo openssl-devel"
makedepends="openssl-devel python3-devel"
depends="python3"
checkdepends="python3-pytest"
short_desc="Brave's adblock library in Python"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="Apache-2.0, MIT"
homepage="https://github.com/ArniDagur/python-adblock"
changelog="https://raw.githubusercontent.com/ArniDagur/python-adblock/master/CHANGELOG.md"
distfiles="${PYPI_SITE}/a/adblock/adblock-${version}.tar.gz"
checksum=449d4724769d4a8bc96bf0256b40e57eafe91d69e24503c27ceb9de0e5e5fe03
if [ "$CROSS_BUILD" ]; then
makedepends+=" rust-std"
export PYO3_CROSS_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib"
export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
fi
do_build() {
maturin build -o . --release --target "${RUST_TARGET}" --manylinux off
# Drop platform specifiers from the wheel; pip will refuse to install,
# e.g., an armv7l wheel on an aarch64 system even if the masterdir is
# armv7l. The wheel is correct; no need for name compatibility checks.
mv adblock-${version}-*.whl adblock-${version}-py3-none-any.whl
}
pre_check() {
# Tests require the compiled extension
cp target/${RUST_TARGET}/release/libadblock.so adblock/adblock.so
}
post_install() {
vlicense LICENSE-MIT
chmod 755 ${DESTDIR}/${py3_sitelib}/adblock/*.so
}