#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DH_GOPKG := github.com/docker/buildx
LDFLAGS := -X $(DH_GOPKG)/version.Version=$(DEB_VERSION_UPSTREAM)
LDFLAGS += -X $(DH_GOPKG)/version.Revision=$(DEB_VERSION)
LDFLAGS += -X $(DH_GOPKG)/version.Package=$(DH_GOPKG)

export DH_GOLANG_INSTALL_EXTRA := driver/kubernetes/context/fixtures

# The integration tests depend on a "registry" binary, unavailable in Debian
export SKIP_INTEGRATION_TESTS=1

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

override_dh_auto_build:
	dh_auto_build --builddirectory=_build --buildsystem=golang -- -ldflags '$(LDFLAGS)'
	# Generate the manual pages
	_build/bin/docs --formats=man --source=docs/reference

# Install binaries manually, using the install file, as the executable need to
# be in a specific directory.
override_dh_auto_install:
	dh_auto_install -- --no-binaries
