#!/usr/bin/make -f

export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export QT_SELECT=qt5

# export information for the "About" screen
data=$(subst ., ,$(firstword $(subst +, ,$(lastword $(subst git, ,$(shell dpkg-parsechangelog -SVersion))))))
# ↑ i.e. "20170323 ec4712d"
export DEB_CXXFLAGS_MAINT_APPEND += -DGIT_EXISTS
export DEB_CXXFLAGS_MAINT_APPEND += -DGIT_CURRENT_SHA1=\"\\\"$(lastword $(data)) ($(shell dpkg-vendor --query Vendor) build)\\\"\"
export DEB_CXXFLAGS_MAINT_APPEND += -DGIT_TIMESTAMP=\\\"$(shell date +%Y-%m-%d -d "$(firstword $(data))")\\\"

%:
	dh $@

get-orig-source:
	dh_testdir
	git clone git@github.com:pencil2d/pencil.git pencil2d
	rm -rf pencil2d/util
	rm -rf pencil2d/3rdlib/zlib
	cd pencil2d && tar --exclude-vcs -cJf ../../pencil2d_0.5.4+git$$(git log -1 --format="%ci %h"|awk '{print $$1"."$$4}'|tr -d '-')+dfsg.orig.tar.xz .
	rm -rf pencil2d
