#!/usr/bin/make -f

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

ifeq ($(findstring mips,$(DEB_BUILD_ARCH)),mips)
BUILDTAGS := $(DEB_BUILD_ARCH:el=le)

# retry to get rid of https://bugs.debian.org/867358

# gccgo has different arch name on mips, https://bugs.debian.org/876639
# so pass the correct name via -tags

# these workarounds are from foka in hugo package

override_dh_auto_build:
	dh_auto_build -- -tags $(BUILDTAGS) || \
	dh_auto_build -- -tags $(BUILDTAGS) || \
	dh_auto_build -- -tags $(BUILDTAGS) || \
	dh_auto_build -- -tags $(BUILDTAGS) || \
	dh_auto_build -- -tags $(BUILDTAGS) || \
	dh_auto_build -- -tags $(BUILDTAGS) || \
	dh_auto_build -- -tags $(BUILDTAGS)

override_dh_auto_test:
	dh_auto_test -- -tags $(BUILDTAGS) || \
	dh_auto_test -- -tags $(BUILDTAGS) || \
	dh_auto_test -- -tags $(BUILDTAGS) || \
	dh_auto_test -- -tags $(BUILDTAGS) || \
	dh_auto_test -- -tags $(BUILDTAGS) || \
	dh_auto_test -- -tags $(BUILDTAGS) || \
	dh_auto_test -- -tags $(BUILDTAGS)
endif

override_dh_auto_install:
	dh_auto_install -- --no-source
