#!/usr/bin/make -f

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

export PROG_UNZIP = bunzip2

%:
	dh $@

configure_flags = \
	-Dgir=true \
	-Dvapi=true \
	-Ducd_path=/usr/share/unicode/ \
	$(NULL)

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
configure_flags += -Ddocs=true
else
configure_flags += -Ddocs=false
endif

override_dh_auto_configure:
	dh_auto_configure -- $(configure_flags)

execute_after_dh_auto_install:
ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
	# Make sure these directories exist even with nodoc, so that we don't
	# need to use dh-exec in d/*-dev.install
	install -d debian/tmp/usr/share/gtk-doc
	install -d debian/tmp/usr/share/help
endif

override_dh_gencontrol:
	dh_gencontrol -- -VBuilt-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W unicode-data)"
