# Template file for 'fs-repo-migrations'
pkgname=fs-repo-migrations
version=2.0.2+13~14+v1.0.0
revision=2
_version=${version##*+}
_path="fs-repo-${version#*+}"
_path="${_path%+*}"
_path="${_path/"~"/-to-}"
build_style=go
# go_import_path="github.com/ipfs/fs-repo-migrations/fs-repo-migrations"
hostmakedepends="git"
short_desc="Tool to upgrade the IPFS filesystem repository"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://github.com/ipfs/fs-repo-migrations"
distfiles="https://github.com/ipfs/fs-repo-migrations/archive/${_path}/${_version}.tar.gz>${_path}-${_version}.tar.gz"
checksum=17396914690c74527e365a4bfffcd1097aeef7772a7e3fa5d9b42af1a0f5c294

# fix: collect2: fatal error: cannot find 'ld'
export LDFLAGS="-fuse-ld=bfd"
# export GOTOOLCHAIN=go1.20

go_import_path="github.com/ipfs/fs-repo-migrations/fs-repo-0-to-1"
for _v in $(seq 2 "${_path##*-}"); do
	go_import_path+=" github.com/ipfs/fs-repo-migrations/fs-repo-$((_v - 1))-to-${_v}"
done
unset _v

do_configure() {
	GOSRCPATH="${GOPATH}/src/github.com/ipfs/fs-repo-migrations"
	mkdir -p ${GOSRCPATH%/*}/
	ln -rfs "$PWD" "${GOSRCPATH}"
}

pre_build() {
	GOSRCPATH="${GOPATH}/src/github.com/ipfs/fs-repo-migrations"
}

pre_install() {
	GOSRCPATH="${GOPATH}/src/github.com/ipfs/fs-repo-migrations"
}

post_install() {
	vlicense LICENSE
	vdoc README.md
	vdoc run.md
}
