#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# phoc prints warnings as there's no dmabuf support so skip the tests
SKIP_TESTS_ARCHES=ppc64el riscv64

ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
  MESON_OPTS+=-Dman=true
else
  MESON_OPTS+=-Dman=false
endif

%:
	dh $@ --builddirectory=_build

override_dh_auto_configure:
	dh_auto_configure -- $(MESON_OPTS)

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp

ifneq (,$(filter $(DEB_HOST_ARCH), $(SKIP_TESTS_ARCHES)))
override_dh_auto_test:
else
override_dh_auto_test:
	XDG_RUNTIME_DIR=. HOME=. xvfb-run -s -noreset -a dbus-run-session dh_auto_test
endif
