#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DH_GOLANG_INSTALL_EXTRA := \
	tpm2/test/testvectors/ecc_labeled_encaps.json \
	tpm2/test/testvectors/rsa_labeled_encaps.json

export DH_GOLANG_EXCLUDES := \
	examples \

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

override_dh_auto_configure:
# Workaound for FTBFS with error "Unsupported" from upstream
ifeq ($(DEB_HOST_ARCH),loong64)
	@echo "Notice: Skipping build until upstream supported on long64."
else
	dh_auto_configure
endif

override_dh_auto_build:
ifeq ($(DEB_HOST_ARCH),loong64)
	@echo "Notice: Skipping build until upstream supported on long64."
else
	dh_auto_build
endif

override_dh_auto_test:
ifeq ($(DEB_HOST_ARCH),loong64)
	@echo "Notice: Skipping test until upstream supported on long64."
else
	DH_GOLANG_EXCLUDES="$(DH_GOLANG_EXCLUDES) tpm2/test" \
		dh_auto_test $(DH_BUILD_OPTS)
endif
