#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- ttf otf

override_dh_builddeb:
	dh_builddeb -- -Zxz

URL="https://googlefontdirectory.googlecode.com/hg/"
VER="1.002"
HGDIR=gfd-hg
get-orig-source:
	hg clone "$(URL)" "$(HGDIR)"
	# Get last date of commit touching play/ and use throughout
	export DATE="$$(hg log $(HGDIR)/play/ --limit 1 \
		--template "{date|isodate}\n" | cut --delimiter=' ' \
		--fields=1 | xargs date +%Y%m%d --date)" ;\
	export DIR="fonts-play-$(VER)+$$DATE.1.orig" ;\
	export TAR="fonts-play_$(VER)+$$DATE.1.orig.tar.xz" ;\
	\
	rm -rf "$$DIR" ;\
	mkdir "$$DIR" ;\
	$(: Leave hg repo as-is) \
	cp -r "$(HGDIR)/play/" "$$DIR" ;\
	rm -f "$$DIR"/play/Play* ;\
	\
	XZ="-6" tar --create --xz --owner root --group root --mode a+rX \
		-f "$$TAR" "$$DIR" ;\