#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
TAG_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | tr '~' '.' | sed -e 's/+[dfsg]\+.*//')

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	find . -type f -exec sed -i '1s|^#!/usr/bin/env python|#!/usr/bin/python|' {} \;
	dh_auto_configure

override_dh_installchangelogs:
	dh_installchangelogs -k ChangeLog

get-orig-source:
	@echo downloading git tag v$(TAG_VERSION)
	git clone -b v$(TAG_VERSION) --depth 1 --recursive https://github.com/GothenburgBitFactory/timewarrior.git
	tar -cJ --wildcards --owner=root --group=root --mode=a+rX --exclude '.git*' -f timew_$(DEB_VERSION_UPSTREAM).orig.tar.xz timewarrior/
	rm -rf timewarrior/
