#!/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 $@ --buildsystem=meson --builddirectory=debian/build


override_dh_auto_clean:
	rm -rf debian/build

override_dh_auto_configure:
	dh_auto_configure -- -Dclapper=true

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd debian/build && LC_ALL=C.UTF-8 ninja test
endif

override_dh_auto_install:
	cd debian/build && DESTDIR=${CURDIR}/debian/tuba ninja install
	mv debian/tuba/usr/bin/dev.geopjr.Tuba debian/tuba/usr/bin/tuba
	mv debian/tuba/usr/share/man/man1/dev.geopjr.Tuba.1 debian/tuba/usr/share/man/man1/tuba.1
	sed -i 's/^Exec=.*\s\(.*\)/Exec=tuba \1/' debian/tuba/usr/share/applications/dev.geopjr.Tuba.desktop