# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=desync
pkgver=0.9.5
pkgrel=8
pkgdesc="Alternative casync implementation"
url="https://github.com/folbricht/desync"
arch="all"
license="BSD-3-Clause"
makedepends="go"
depends="fuse"
source="$pkgname-$pkgver.tar.gz::https://github.com/folbricht/desync/archive/refs/tags/v$pkgver.tar.gz"

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

build() {
	export GOFLAGS="$GOFLAGS -trimpath -mod=readonly -modcacherw"
	mkdir build
	go build -o build ./cmd/desync
}

check() {
	# this test requires the fuse module to be loaded
	if ! grep -Fxq "^fuse " /proc/modules; then
		rm -rf mount-index_linux_test.go
	fi
	go test ./...
}

package() {
	install -Dm755 ./build/desync -t "$pkgdir"/usr/bin
}

sha512sums="
650b397e218d852ceb8e0df5ebc2c8177f607f6e52017d075e746c358e0a1d110cfb0e893760eb86fdf72f428ea12a1cd5cc3843e6569e1f078a139e08d07543  desync-0.9.5.tar.gz
"
