#!/usr/bin/make -f

# The repack keeps only the v2 module (in v2/), which installs at its module
# path github.com/josephburnett/jd/v2. v2/jd (the command) and v2/web (the
# web UI) are main programs.
export DH_GOLANG_EXCLUDES := v2/jd v2/web
# Name the v2 module as the build target. With only the top-level import path
# as target, dh-go 1.69 writes both a use and a replace for jd/v2 into go.work
# under autopkgtest, and go refuses it.
export DH_GOLANG_BUILDPKG := github.com/josephburnett/jd/v2/...

%:
	dh $@ --builddirectory=debian/_build --buildsystem=golang --with=golang

include /usr/share/dpkg/architecture.mk

override_dh_auto_test:
ifeq ($(DEB_HOST_ARCH_BITS),32)
	# TestContextCancel builds an input of about 4 GB and runs out of address
	# space on 32-bit architectures.
	dh_auto_test -- -skip 'TestContextCancel'
else
	dh_auto_test
endif
