#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DH_GOPKG := github.com/opencontainers/runc
TAGS=apparmor seccomp selinux ambient
VERSION=$(shell dpkg-parsechangelog -SVersion)

# Build with Golang 1.18
export PATH := /usr/lib/go-1.18/bin:$(PATH)

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

override_dh_auto_configure:
	cd man && ./md2man-all.sh
	dh_auto_configure
	## Remove extra license files:
	$(RM) -v \
            _build/src/$(DH_GOPKG)/vendor/github.com/docker/docker/*/*/LICENSE* \
        ;

override_dh_auto_build:
	dh_auto_build -- -tags "$(TAGS)" -ldflags "-X main.version=$(VERSION)"

override_dh_auto_test:
	DH_GOLANG_EXCLUDES="libcontainer/integration" \
        dh_auto_test -- -tags "$(TAGS)"
