#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/GNUstep/debian/config.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--no-undefined
d_app := $(CURDIR)/debian/chess.app

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- $(optim) $(verbose) \
	  $(shell dpkg-buildflags --export=cmdline)
	icns2png --extract --size 128 --depth 32 chess.icns

execute_before_dh_link:
	gsdh_gnustep --app --game
# Fixes lintian W: national-encoding.
	file=English.lproj/Localizable.strings; \
	  iconv --from-code=UTF-16BE --to-code=UTF-8 < $$file > \
	  $(d_app)/usr/share/GNUstep/Chess.app/$$file
# Install icon for the .desktop file.
	mv chess_128x128x32.png $(d_app)/usr/share/GNUstep/Chess.app
