#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,-z,defs
export DPKG_GENSYMBOLS_CHECK_LEVEL = 4

ifeq ($(filter gnome-online-accounts,$(shell dh_listpackages)),)
  GTK4 = -Dgoabackend=false
endif

ifneq (,$(filter $(DEB_HOST_ARCH), x32))
  KERBEROS += -Dkerberos=false
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-Ddocumentation=$(if $(filter %-doc,$(shell dh_listpackages)),true,false) \
		$(GTK4) \
		$(KERBEROS)

# evolution-ews is in Ubuntu "universe"
override_dh_gencontrol:
ifeq ($(shell dpkg-vendor --query vendor),Ubuntu)
	dh_gencontrol
else
	dh_gencontrol -- \
		-Vews:Recommends='evolution-ews-core'
endif

# We only use dh_gnome to automatically run dh_translations in Ubuntu
override_dh_gnome:
