#!/usr/bin/make -f
#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 -Wl,--as-needed
export LINKSQLCLIENT := 1

sover := 1.8

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- $(optim) messages=yes \
	  $(shell dpkg-buildflags --export=cmdline)

override_dh_clean:
	$(RM) -r Bundles
	dh_clean test test.conf

override_dh_auto_test:
# Test at least the SQLite bundle; the others require a server running.
	echo "GNUSTEP_SYSTEM_LIBRARY=$(CURDIR)" > test.conf
	chmod 0644 test.conf
	mkdir -p Bundles/SQLClient$(sover)
	cp -a SQLite.bundle Bundles/SQLClient$(sover)
	LD_LIBRARY_PATH=$(CURDIR)/obj:$$LD_LIBRARY_PATH \
	  GNUSTEP_CONFIG_FILE=$(CURDIR)/test.conf ./obj/testSQLite

override_dh_strip:
	dh_strip --dbgsym-migration='libsqlclient$(sover)-dbg (<< 1.8.1-2~)'
