#!/usr/bin/make -f
export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/default.mk  # provides DEB_VERSION

%:
	dh $@

override_dh_auto_clean:
	rm -rf debian/build

override_dh_auto_configure:
	mkdir -p debian/build
	cd debian/build && meson --prefix=/usr ../..

override_dh_auto_build:
	cd debian/build && ninja -v

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd debian/build && ninja test
endif

override_dh_auto_install:
	cd debian/build && DESTDIR=${CURDIR}/debian/tootle ninja install
	mv debian/tootle/usr/bin/com.github.bleakgrey.tootle debian/tootle/usr/bin/tootle
	sed -i 's/^Exec=.*/Exec=tootle/' debian/tootle/usr/share/applications/com.github.bleakgrey.tootle.desktop

override_dh_installman:
	dh_installman ./debian/tootle.1
