#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk # DEB_VERSION

export DH_GOLANG_INSTALL_EXTRA := \
	.bingo/Variables.mk \
	Makefile \
	builtin/help/cmd.tmpl \
	# EOF

%:
	dh $@ --builddirectory=_build --buildsystem=golang

execute_before_dh_auto_install:
	rm -fv _build/src/github.com/bwplotka/bingo/.bin/bingo
	rm -fv _build/src/github.com/bwplotka/bingo/testdata/testproject_with_bingo_v0_?/.bingo/.gitignore

# requires Internet to download Go code
SKIP='TestCompatibilityCurrentVersionCreate|TestGet_ModuleCases|TestGetList|TestCompatibility'
override_dh_auto_test:
	dh_auto_test -- -skip=$(SKIP)
	-dh_auto_test -- -run=$(SKIP)

B = $(CURDIR)/debian/tmp/usr/bin
M = $(CURDIR)/debian/tmp/usr/share/man/man1

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
execute_before_dh_installman-arch:
	mkdir -pv $(M)
	env PATH=$(PATH):$(B) \
	help2man --version-string="$(DEB_VERSION)" \
		--no-info \
		--name="Like 'go get' but for Go tools" \
		--output $(M)/bingo.1 \
		bingo
endif
