aports/community/maturin/APKBUILD
2025-05-04 21:47:03 +00:00

106 lines
2.4 KiB
Text

# Contributor: omni <omni+alpine@hack.org>
# Maintainer: messense <messense@icloud.com>
pkgname=maturin
pkgver=1.8.3
pkgrel=0
pkgdesc="Build and publish crates with pyo3, rust-cpython and cffi bindings"
url="https://github.com/PyO3/maturin"
arch="all"
license="Apache-2.0 OR MIT"
makedepends="
bzip2-dev
cargo
dbus-dev
openssl-dev
py3-gpep517
py3-setuptools
py3-setuptools-rust
py3-wheel
"
checkdepends="
cargo-nextest
libffi-dev
patchelf
py3-cffi
py3-pyo
py3-virtualenv
python3-dev
"
subpackages="
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
py3-$pkgname-pyc
py3-$pkgname:py3:noarch
"
source="$pkgname-$pkgver.tar.gz::https://github.com/PyO3/maturin/archive/v$pkgver.tar.gz
"
options="net"
_features="--features=full,native-tls,password-storage"
# these only work in a git checkout
_test_filter='!test(~git_sdist_generator) & !test(~pyo3_mixed_include_exclude)'
case "$CARCH" in
s390x|ppc64le|loongarch64)
# cargo-nextest not available
options="$options !check"
;;
armhf|armv7|riscv64)
# skip uv related tests
_test_filter="$_test_filter & !test(/^develop_[a-z0-9_]+::case_2$/)"
# no idea why this fails
_test_filter="$_test_filter & !test(~test_macosx_deployment_target)"
;;
esac
prepare() {
default_prepare
cargo fetch --target="$CTARGET" --locked
}
build() {
export OPENSSL_NO_VENDOR=1
export MATURIN_SETUP_ARGS="--no-default-features $_features"
gpep517 build-wheel \
--wheel-dir .dist \
--output-fd 3 3>&1 >&2
./target/release/maturin completions bash > $pkgname.bash
./target/release/maturin completions fish > $pkgname.fish
./target/release/maturin completions zsh > $pkgname.zsh
}
check() {
export OPENSSL_NO_VENDOR=1
cargo nextest run \
--frozen \
--no-default-features "$_features" \
--no-fail-fast \
-E "$_test_filter"
}
package() {
install -Dm644 $pkgname.bash "$pkgdir"/usr/share/bash-completion/completions/$pkgname
install -Dm644 $pkgname.fish "$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
install -Dm644 $pkgname.zsh "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
python3 -m installer -d "$pkgdir" \
.dist/maturin*.whl
}
py3() {
pkgdesc="$pkgdesc (python module)"
depends="$pkgname=$pkgver-r$pkgrel"
amove usr/lib/python3*
}
sha512sums="
b4f79df7b099777d6068d2705fd6ca6a79c0a96c77530dcca26fef5d09b39a57feabab9d3871fc5b4760df234955329222dc29a86df5404d880140f1a3736431 maturin-1.8.3.tar.gz
"