#!/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/textedit.app

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- $(optim) $(verbose) \
	  $(shell dpkg-buildflags --export=cmdline)
# Extract a .png icon for the .desktop file (GNUstep GUI will load the
# .icns directly).  The file is actually of larger size because there
# are no 48x48 and 64x64 icons, but at least GNOME/MATE will scale and
# display it properly.
	icns2png --extract --size 128 accessories-text-editor.icns

override_dh_link:
	gsdh_gnustep
	dh_installdirs usr/share/GNUstep
	rm $(d_app)$(GNUSTEP_SYSTEM_APPS)/*.app/Resources/*.desktop
	mv $(d_app)$(GNUSTEP_SYSTEM_APPS)/TextEdit.app/Resources \
	  $(d_app)/usr/share/GNUstep/TextEdit.app
	dh_link /usr/share/GNUstep/TextEdit.app \
	  $(GNUSTEP_SYSTEM_APPS)/TextEdit.app/Resources
