#!/usr/bin/make -f

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

export DH_GOPKG := github.com/opencontainers/runc

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

override_dh_clean:
	dh_clean
	## Remove Files-Excluded (when built from checkout or non-DFSG tarball):
	$(RM) -rv `perl -0nE 'say $$1 if m{^Files\-Excluded\:\s*(.*?)(?:\n\n|Files:|Comment:)}sm;' debian/copyright`

override_dh_auto_configure:
	$(MAKE) -C libcontainer/criurpc
	dh_auto_configure
	ln -svrf Godeps/_workspace/src/github.com/opencontainers/specs  _build/src/github.com/opencontainers/

override_dh_auto_test: _build/runc.1
	## Ignoring errors (some tests need network):
	-dh_auto_test

_build/runc.1:
	help2man --no-info _build/bin/runc >"$@"
	[ -s "$@" ] || $(RM) -v "$@"
