#!/usr/bin/make -f

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

%:
	dh $@

override_dh_auto_build:
	mkdir -p fonts
	cd fonts/ && \
		cube2font /usr/share/fonts/truetype/play/Play-Bold.ttf \
			play 4 15 1 1 54 54 512 512 0 0 fonts/

override_dh_auto_install:
	mkdir -p debian/redeclipse-data/usr/share/games/redeclipse/data
	find data -mindepth 1 -maxdepth 1 -type d \
		-not \( -name '.git*' -or -name '.pc*' -or -name 'debian' -or -name 'fonts' \) \
		-exec cp -r '{}' debian/redeclipse-data/usr/share/games/redeclipse/data \;
	find . -mindepth 1 -maxdepth 1 -type d \
		-not \( -name '.git*' -or -name '.pc*' -or -name 'debian' -or -name 'fonts' -or -name 'data' \) \
		-exec cp -r '{}' debian/redeclipse-data/usr/share/games/redeclipse/data \;
	# Delete hidden .git directories that could not be found due to maxdepth 1
	find $(CURDIR)/debian/redeclipse-data -type d -name '.[^.]*' -prune -exec rm -rf {} \;
	find $(CURDIR)/debian/redeclipse-data/usr/share/games/redeclipse/data -name '.git*' -delete
	find $(CURDIR)/debian/redeclipse-data/usr/share/games/redeclipse/data -name 'Thumbs.db*' -delete
	find $(CURDIR)/debian/redeclipse-data/usr/share/games/redeclipse/data -iname 'license.txt' -delete

get-orig-source:
	uscan --noconf --rename --repack --compression xz --force-download --download-current-version --destdir=.
