#!/usr/bin/make -f

DH_GOPKG := github.com/micromdm/scep
include /usr/share/dpkg/pkg-info.mk
VERSION = $(shell echo $(DEB_VERSION) | cut -d- -f1)
LDFLAGS := -ldflags '-X "main.version=$(VERSION)"'

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

override_dh_auto_build:
	dh_auto_build -- $(LDFLAGS)

override_dh_install-indep:
	find debian/tmp/usr/share/gocode/src/$(DH_GOPKG)/scep/testdata/ \
	    -type f -exec chmod -x \{\} \;
	rm -rf debian/tmp/usr/share/gocode/src/$(DH_GOPKG)/cmd
	dh_install -i

override_dh_auto_test:
	GODEBUG=x509sha1=1 dh_auto_test
