#!/usr/bin/make -f

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

export DH_GOLANG_INSTALL_EXTRA := test

%:
	dh $@ --buildsystem=golang

# fixes autopkgtest. The foo.tar.gz must not be altered because the
# tests compare expected checksums in generated jwt tokens
override_dh_strip_nondeterminism:
	dh_strip_nondeterminism -Xfoo.tar.gz

SKIP="TestRecordArtifactWithBlobs/test_binary_blob_with_windows-like_line_breaks_as_byte_segments"
override_dh_auto_test:
	-dh_auto_test $(DH_BUILD_OPTS) -- -run $(SKIP)
	dh_auto_test $(DH_BUILD_OPTS) -- -skip $(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)
	help2man --version-string="$(DEB_VERSION)" \
		--no-info \
		--name="secure the integrity of software supply chains" \
		--output $(M)/in-toto-golang.1 \
		$(B)/in-toto-golang
endif
