# Contributor: Bart Ribbers <bribbers@disroot.org>
maintainer=""
pkgname=apx
pkgver=2.4.4
pkgrel=6
pkgdesc="A package manager that can install packages from multiple sources without altering the root filesystem"
url="https://github.com/Vanilla-OS/apx"
license="GPL-3.0-only"
# s390x, riscv64, armv7, armhf and x86 blocked by podman -> distrobox
arch="x86_64 aarch64 ppc64le"
depends="distrobox"
makedepends="go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Vanilla-OS/apx/archive/refs/tags/v$pkgver.tar.gz
	config.json
	"
# net required to download go modules
# no tests
options="net !check"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -trimpath -v -o apx
}

package() {
	install -Dm755 apx "$pkgdir"/usr/bin/apx
	install -Dm644 "$srcdir"/config.json "$pkgdir"/usr/share/apx/config.json

	install -Dm755 man/man1/apx.1 "$pkgdir"/usr/share/man/man1/apx.1
}

sha512sums="
95bcc57599268fe64b8eda0e17dcb186e0ff761e8862b28220530c69c08059cc88de7efcb4436f552fd01fcdfac0f35b18ff64e21f5ce5e05dc757441cb3f9cf  apx-2.4.4.tar.gz
0d0e999b5b2e714bcd63e69357740a805cf3670c2e9d03c36700de17aec0445e56cb1da27b1b192fe11287beb98833d616fcc51937872b845bdb693ea9901929  config.json
"
