#!/usr/bin/make -f
# -*- Mode: Makefile; indent-tabs-mode: t -*-

export DH_OPTIONS
export DH_GOPKG := github.com/gosexy/gettext
export DH_GOLANG_EXCLUDES := examples

export PKD = $(abspath $(dir $(MAKEFILE_LIST)))
export PKG = $(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source)

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

override_dh_auto_test:
	# copy data files in
	cp -r examples/*/ obj-*/src/github.com/gosexy/gettext/examples/
	dh_auto_test

get-orig-source:
	rm -rf $(PKG)
	git clone https://$(DH_GOPKG) $(PKG)
	echo $(shell git -C $(PKG) log --date=short -r -1 | grep ^Date: | cut -d: -f2 | tr -d ' -')
	tar -caf "$(PKG)_0~git$(shell git -C $(PKG) log --date=short -r -1 | grep ^Date: | cut -d: -f2 | tr -d ' -').orig.tar.xz" --exclude-vcs --owner=root --group=root --mode=a+rX $(PKG)
	rm -rf $(PKG)

