#!/usr/bin/make -f

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

execute_after_dh_auto_install:
	# The test suite compiles testdata/lzo-tool.cpp against liblzo2 and caches
	# the fixtures it compresses with it. Upstream lists the lot in
	# testdata/.gitignore -- cache/, crash/, bin/, cache.fingerprint -- so they
	# are build artefacts by upstream's own reckoning and have no business in
	# the package. The .gitignore goes too; lintian counts it as a VCS control
	# file.
	cd debian/golang-github-anchore-go-lzo-dev/usr/share/gocode/src/github.com/anchore/go-lzo/testdata \
	  && rm -rf cache crash bin cache.fingerprint .gitignore
	# .make is upstream's build tooling as a nested Go module. Its module path
	# ends in /.make, and a path component starting with a dot is not valid in a
	# go.work replace directive, so dh-go generates a go.work that Go refuses to
	# parse for anything build-depending on this package. It also requires
	# anchore/go-make, which is not in Debian. None of it is library code.
	rm -rf debian/golang-github-anchore-go-lzo-dev/usr/share/gocode/src/github.com/anchore/go-lzo/.make
	# The python helper is data for the test suite, not a program users run.
	chmod -x debian/golang-github-anchore-go-lzo-dev/usr/share/gocode/src/github.com/anchore/go-lzo/testdata/lzo-tool.py
