# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=tectonic
pkgver=0.15.0
pkgrel=0
pkgdesc="Tectonic is a modernized, complete, self-contained TeX/LaTeX engine"
url="https://tectonic-typesetting.github.io"
# s390x, riscv64: rust
# loongarch64: blocked by nix crate
# 32-bit: SIGSEGVs in tests
arch="all !s390x !armhf !armv7 !x86 !riscv64 !loongarch64"
license="MIT"
# needed for font things
depends="icu-data-full"
makedepends="
	cargo
	cargo-auditable
	curl-dev
	fontconfig-dev
	harfbuzz-dev
	openssl-dev>3
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/tectonic-typesetting/tectonic/archive/tectonic@$pkgver.tar.gz"
builddir="$srcdir/tectonic-tectonic-$pkgver"
options="net !check" # needs unpackages ubuntu mono font

_features="--no-default-features --features=external-harfbuzz,geturl-curl"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen $_features
}

check() {
	cargo test --frozen $_features
}

package() {
	install -Dm755 target/release/tectonic "$pkgdir"/usr/bin/tectonic
}

sha512sums="
82ccaf68ddfb864ae439b2698a518ce77b000044b74d7752e9a45fa200c95d3a08cbdda14c2d253b4c78824e061bd2721f26fa2cac2ace9d60684cb330d1f3be  tectonic-0.15.0.tar.gz
"
