#!/usr/bin/make -f

# get './pkg/config/containers.conf' installed
export DH_GOLANG_INSTALL_ALL := 1

# disable LTO, cf. https://wiki.debian.org/ToolChain/LTO
export DEB_BUILD_MAINT_OPTIONS := optimize=-lto

BUILDTAGS := containers_image_openpgp,systemd

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

override_dh_auto_build:
	dh_auto_build -v  --builddirectory=_build -- -tags "$(BUILDTAGS)"

override_dh_auto_install:
	dh_auto_install --builddirectory=_build --buildsystem=golang
	make -C docs docs GOMD2MAN=go-md2man
	make -C docs install install DESTDIR=$(CURDIR)/debian/golang-github-containers-common PREFIX=/usr

override_dh_auto_test:
	DH_GOLANG_EXCLUDES="pkg/cgroupv2 pkg/config libimage pkg/secrets/passdriver" \
	dh_auto_test
