#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

TARGET  := $(CURDIR)/debian/gargoyle-free

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DBUILD_SHARED_LIBS=OFF

override_dh_auto_install:
	dh_auto_install
#	'debian/install' doesn't support renaming files:
#	(last field is always a directory, even without a trailing '/')
	(cd $(TARGET) ; mv usr/bin/gargoyle usr/games/gargoyle-free)
	(cd $(TARGET) ; mv usr/share/man/man6/gargoyle.6 usr/share/man/man6/gargoyle-free.6)
	rmdir --ignore-fail-on-non-empty $(TARGET)/usr/bin
	rm -rf $(TARGET)/usr/include
	rm -rf $(TARGET)/usr/lib
	rm -rf $(TARGET)/usr/share/icons/hicolor # bug 1019713

override_dh_install:
	dh_install
	sed -i '/^monofont/s/Gargoyle\ Mono/Go\ Mono/' $(TARGET)/etc/garglk.ini
	sed -i '/^propfont/s/Gargoyle\ Serif/Charis\ SIL/' $(TARGET)/etc/garglk.ini
