#!/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
include /usr/share/GNUstep/debian/config.mk

%:
	dh $@


override_dh_auto_configure:
	dh_auto_configure -- --disable-examples

# define ADDITIONAL_OBJCFLAGS to prevent FTBFS (thanks Yavor Doganov)
override_dh_auto_build:
	dh_auto_build -- \
	    $(verbose) \
	    $(optim) \
	    doc=yes \
	    ADDITIONAL_OBJCFLAGS=-DDEBUG \
	    $(shell dpkg-buildflags --export=cmdline)

override_dh_auto_install:
	dh_auto_install -- \
	    $(verbose) \
	    doc=yes \
	    DESTDIR=$(CURDIR)/debian/tmp
	$(RM) debian/tmp/usr/lib/GNUstep/Applications/*.app/stamp.make
	$(RM) debian/tmp/usr/lib/GNUstep/Applications/*.app/Resources/*.desktop
	$(RM) debian/tmp/usr/include/GNUstep/SQLite3EOAdaptor
	$(RM) debian/tmp/usr/lib/GNUstep/Frameworks/SQLite3EOAdaptor.framework/Headers
	$(RM) -r debian/tmp/usr/lib/GNUstep/Frameworks/SQLite3EOAdaptor.framework/Versions/0/Headers
# Convert the app icon to PNG as AppStream does not recognise TIFF.
	convert DBModeler/Resources/DBModeler.tiff \
	  debian/tmp/usr/lib/GNUstep/Applications/DBModeler.app/Resources/app-icon.png

override_dh_auto_clean:
	dh_auto_clean -- \
	    $(verbose) \
	    doc=yes

# Don't add ldconfig trigger for adaptors
override_dh_makeshlibs:
	dh_makeshlibs -XEOAdaptor
	dh_makeshlibs -n -pgnustep-dl2-sqlite-adaptor
	dh_makeshlibs -n -pgnustep-dl2-postgresql-adaptor
