# Template file for 'darch'
pkgname=darch
version=0.28.0
revision=3
archs="x86_64* ppc64le*"
build_style=go
go_import_path=github.com/godarch/darch
conf_files="/etc/darch/hooks/ssh/hook /etc/darch/hooks/hostname/hook /etc/darch/hooks/fstab/hook"
make_dirs="/var/lib/darch 0755 root root"
hostmakedepends="git"
depends="containerd"
short_desc="Tool for building/booting stateless and immutable images, bare metal"
maintainer="Paul Knopf <pauldotknopf@gmail.com>"
license="MIT"
homepage="https://godarch.com/"
broken="missing go.mod"

do_fetch() {
	mkdir -p "$(dirname ${GOSRCPATH})"
	git clone --branch "v${version}" \
		https://github.com/godarch/darch \
		${GOSRCPATH}
}

do_configure() {
	export GOBIN=${GOPATH}/bin
	export PATH=$PATH:$GOBIN
	go get github.com/LK4D4/vndr
	cd ${GOSRCPATH}
	vndr
}

do_build() {
	cd ${GOSRCPATH}
	make build TRAVIS_TAG="v${version}" GO_BUILD_FLAGS="-buildmode=pie"
}

do_install() {
	cd ${GOSRCPATH}
	make install DESTDIR=${DESTDIR}

	vlicense LICENSE
}
