#!/usr/bin/make -f
# -*- makefile -*-

export DH_VERBOSE := 1

# Exclude "cover" and "vet" since they're included in core as of Go 1.5+
export DH_GOLANG_EXCLUDES := \
	golang.org/x/tools/cmd/cover \
	golang.org/x/tools/cmd/vet

export DH_GOLANG_INSTALL_EXTRA := cmd/present/templates cmd/present/static \
    cmd/bundle/testdata cmd/heapview/client cmd/goyacc/testdata \
    cmd/guru/testdata container/intsets refactor/eg/testdata oracle/testdata \
    godoc/static go/gcimporter15/testdata

override_dh_auto_install:
	dh_auto_install
	# Rename “eg” to “golang-eg” (#753978)
	mv debian/tmp/usr/bin/eg debian/tmp/usr/bin/golang-eg
	# Rename “stress” to “golang-stress” (#793693)
	mv debian/tmp/usr/bin/stress debian/tmp/usr/bin/golang-stress
	# Rename “bundle” to “golang-bundle” (#818551)
	mv debian/tmp/usr/bin/bundle debian/tmp/usr/bin/golang-bundle
	# Replace embedded copies of jquery and jquery-ui with a symlink.
	rm debian/tmp/usr/share/gocode/src/golang.org/x/tools/godoc/static/jquery.js && \
		ln -s \
			/usr/share/javascript/jquery/jquery.min.js \
			debian/tmp/usr/share/gocode/src/golang.org/x/tools/godoc/static/jquery.js
	rm debian/tmp/usr/share/gocode/src/golang.org/x/tools/cmd/present/static/jquery-ui.js && \
		ln -s \
			/usr/share/javascript/jquery-ui/jquery-ui.min.js \
			debian/tmp/usr/share/gocode/src/golang.org/x/tools/cmd/present/static/jquery-ui.js

override_dh_auto_test:
	# use short tests where possible (especially to skip tests like
	# TestWebIndex which are very slow)
	dh_auto_test -- -test.short

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