#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --buildsystem=lua --with lua

override_dh_auto_configure:
	make -C lgi version.lua VERSION=$(DEB_VERSION_UPSTREAM)
	if [ ! -e /usr/share/gobject-introspection-1.0/tests/config.h ]; then\
		touch config.h;\
	fi
	dh_auto_configure

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	make -C tests all
	unset DBUS_SESSION_BUS_ADDRESS && GI_TYPELIB_PATH=tests LD_LIBRARY_PATH=tests xvfb-run dh_auto_test
endif

override_dh_compress:
	dh_compress -X.ui -X.md -X.lua

override_dh_auto_clean:
	rm -f lgi/version.lua
	make -C tests clean
	dh_auto_clean

override_dh_strip:
	dh_strip --dbgsym-migration='lua-lgi-dbg (<< 0.9.2-1~)'
