#!/usr/bin/make -f

export DH_OPTIONS
export DH_GOPKG := github.com/twstrike/coyim

%:
	dh $@ --buildsystem=golang --with=golang --builddirectory=mybuild

override_dh_auto_clean:
	rm -rf debian/coyim.1 debian/coyim.1.html
	dh_auto_clean --

override_dh_auto_test:
	find ./config/importer -type d -name '*test_data' | xargs cp -rv -t /tmp ./config/importer/xmpp_client_test_conf.json
	# Skip tests requiring internet access
	DH_GOLANG_EXCLUDES="github.com/twstrike/coyim/xmpp" dh_auto_test --

override_dh_auto_build:
	dh_auto_build --
	find mybuild/src -type f | xargs chmod a-x

override_dh_installman:
	asciidoctor -a docdate='' -b manpage debian/coyim.1.adoc
	dh_installman --

override_dh_fixperms:
	dh_fixperms
	find debian -name "*.go" | xargs -r chmod a-x
	find debian -name "*.xml" | xargs -r chmod a-x