# Template file for 'packer'
pkgname=packer
version=1.2.5
revision=2
replaces="packer-bin>=0"
short_desc="Create identical multiplatform machine images from a single source"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
build_style=go
hostmakedepends="git"
license="MPL-2"
homepage="http://www.packer.io"
go_import_path="github.com/mitchellh/packer"
distfiles="https://${go_import_path}/archive/v${version}.tar.gz"
checksum=86408d212a0e0b9c7a0dc93e4835a900569ad7e7bfc45cd633d7c6560f2f8d2b

broken="_build-packer-xbps/src/github.com/mitchellh/packer/commands.go:39:12: undefined: command.PushCommand"

case "$XBPS_TARGET_MACHINE" in
	i686*|arm*) broken="https://build.voidlinux.eu/builders/i686_builder/builds/9375/steps/shell_3/logs/stdio";;
esac

post_build() {
	for F in $(find -type f -name main.go); do
		go get -x $go_import_path/${F%/*}
	done
}

do_install() {
	find "${GOPATH}/bin" -type f -executable | while read line
	do
		if [ "$(basename $line)" = packer ]; then
			vbin $line
		else
			vbin $line packer-$(basename $line)
		fi
	done
}
