#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

CONFIGURE_OPTS=-Dphoc_tests=disabled -Dsystemd=false

ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
  CONFIGURE_OPTS+=-Dgtk_doc=true
else
  CONFIGURE_OPTS+=-Dgtk_doc=false
endif

%:
	dh $@ --builddirectory=_build

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_OPTS)

override_dh_auto_build:
	dh_auto_build
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
	# https://github.com/mesonbuild/meson/pull/2862
	ninja -C _build/ phosh-doc
endif

override_dh_installsystemd:
	rm -f debian/phosh.service ; cp data/phosh.service debian/phosh.service
	dh_installsystemd --no-start --no-enable --no-restart-on-upgrade --no-restart-after-upgrade

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	LC_ALL=C.UTF-8 xvfb-run -a meson test -C _build --no-suite manual
endif

