#!/usr/bin/make -f

%:
	dh $@

override_dh_fixperms:
	dh_fixperms
	find debian/googlefontdirectory-tools -name "*.ff" -exec chmod 755 {} +
	find debian/googlefontdirectory-tools -name "*.sh" -exec chmod 755 {} +

override_dh_builddeb:
	dh_builddeb -- -Zxz

URL="https://googlefontdirectory.googlecode.com/hg/"
# Can't get date of last hg commit easily, use current date as fallback
DATE=$(shell date +%Y%m%d)
# This needs changing in case of an actual version bump
DIR=googlefontdirectory-tools-$(DATE).1.orig
TAR=googlefontdirectory-tools_$(DATE).1.orig.tar.bz2
get-orig-source:
	hg clone $(URL) $(DIR)
	find $(DIR) -mindepth 1 -not -wholename "$(DIR)/tools/*" \
				-not -wholename "$(DIR)/tools" \
				-delete
	rm -rf $(DIR)/tools/ttfautohint/
	BZIP2="-9" tar -cj --owner root --group root --mode a+rX \
							-f $(TAR) $(DIR)
