#!/usr/bin/make -f

# The repack keeps only the v2 module (in v2/), which installs at its module
# path github.com/google/licenseclassifier/v2. tools/ holds main programs.
export DH_GOLANG_EXCLUDES := tools
# The licence corpus is embedded with go:embed; the tests read scenarios/.
export DH_GOLANG_INSTALL_EXTRA := v2/assets v2/scenarios
# 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 it into go.work
# under autopkgtest, and go refuses it.
export DH_GOLANG_BUILDPKG := github.com/google/licenseclassifier/v2/...

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

execute_after_dh_install:
	# One corpus text carries an executable bit upstream.
	find debian/golang-github-google-licenseclassifier-v2-dev/usr/share/gocode -name '*.txt' -exec chmod a-x {} +
