#!/usr/bin/make -f
# -*- makefile -*-

# Regenerate publicsuffix table
export DH_GOLANG_GO_GENERATE := 1

# http2/h2i is cli tool
export DH_GOLANG_EXCLUDES := http2/h2i

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

execute_after_dh_auto_configure:
	# Remove tests that depends on non-free RFC spec.
	$(RM) -v _build/src/golang.org/x/net/http2/*_test.go
	$(RM) -v _build/src/golang.org/x/net/publicsuffix/table.go
	$(RM) -v _build/src/golang.org/x/net/publicsuffix/table_test.go

override_dh_auto_test:
	# Some tests require root, need -short to skip them for now.
	dh_auto_test -O--buildsystem=golang -- -short

override_dh_gencontrol:
	dh_gencontrol -v -- -Vmy:Built-Using="$(shell dpkg-query --show -f '$${source:Package} (=$${source:Version}),' publicsuffix)"