# Contributor: NekoCWD <nekodevelopper@gmail.com>
# Maintainer: NekoCWD <nekodevelopper@gmail.com>
pkgname=fragments
pkgver=3.0.0
pkgrel=1
pkgdesc="A BitTorrent Client"
url="https://gitlab.gnome.org/World/Fragments"
# s390x fails to build
# riscv64: rust broken
# loongarch64: fails to build nix crate
arch="all !s390x !riscv64 !loongarch64"
license="GPL-3.0-or-later"
depends="transmission-daemon"
makedepends="
	cargo
	cargo-auditable
	dbus-dev
	desktop-file-utils
	libadwaita-dev
	openssl-dev
	m4
	meson
	"
subpackages="$pkgname-lang"
source="
	https://gitlab.gnome.org/World/Fragments/-/archive/$pkgver/Fragments-$pkgver.tar.gz
	0001-Use-cargo-auditable-build-instead-of-cargo-build.patch
	0002-Remove-cargo-home.patch
	"
options="net" # needed for downloading dependencies
builddir="$srcdir/Fragments-$pkgver" # Name starts with capital letter

prepare() {
	default_prepare

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

build() {
	# without buildtype=release it builds debug
	abuild-meson \
		--buildtype=release \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
bb0f30249bcba9c8bec2245443faf91acccca47af755383e339d9e22b2a4e8ea4173b3596c7c202226724dfefb806ec125e5b74903041aa599507bdaac5e0060  Fragments-3.0.0.tar.gz
56d76e2d50a20472e26aed22db48b9bcf5ea001e237976dd9b39900e409591a085fae8205162ed0f1cc63f9c37b59bf7af10a156755a0c067d42fcaab8e3c589  0001-Use-cargo-auditable-build-instead-of-cargo-build.patch
c79144a2139129a8b67838d308c7fb552fe56baa3c63ee0fcdaa95dd9bdeca76089a66e7c8b584848b3bb6b2dc1394ea7123ab8e2412bd3f389819ae6fdd9924  0002-Remove-cargo-home.patch
"
