#!/usr/bin/make -f

export DH_VERBOSE = 1
include /usr/share/dpkg/architecture.mk
export PATH:= $(CURDIR)/debian/go/bin:$(PATH)


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

execute_after_dh_auto_configure:
	rm -rf $(CURDIR)/_build/src/github.com/marten-seemann
	rm -rf $(CURDIR)/_build/src/github.com/lucas-clemente
	cp -r $(CURDIR)/debian/vendor/* $(CURDIR)/_build/src/

	# create go/bin dir to use an old version of go
	mkdir -p $(CURDIR)/debian/go/bin
	ln -sf /usr/lib/go-1.19/bin/go $(CURDIR)/debian/go/bin/go

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs/ build/html

override_dh_auto_test:
ifeq ($(DEB_HOST_ARCH),armel)
	echo "Do not run test on armel"
else ifeq ($(DEB_HOST_ARCH), armhf)
	echo "Do no run test on armhf"
else
	dh_auto_test
endif
