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

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

# GOPKG is the upstream path which you would normally “go get”.
# Using it allows us to build applications without patching locations.
export DH_GOPKG := gopkg.in/mgo.v2
export DH_GOLANG_INSTALL_ALL := 1

TMP     = $(CURDIR)/debian/$(PACKAGE)

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

override_dh_auto_test:
	#$(TMP)/../testdb/setup.sh start
	#dh_auto_test -- -timeout 12000s
	#$(TMP)/../testdb/setup.sh stop
	# Tests must be ran from the source directory
	# Tests require newer mongodb features such as --sslMode preferSSL

override_dh_auto_install:
	dh_auto_install
	rm $(TMP)/*/usr/share/gocode/src/gopkg.in/mgo.v2/LICENSE
	rm $(TMP)/*/usr/share/gocode/src/gopkg.in/mgo.v2/bson/LICENSE
	chmod +x $(TMP)/*/usr/share/gocode/src/gopkg.in/mgo.v2/testdb/setup.sh
