#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

libproxy := $(shell sed -nr 's/^Package:[[:space:]]*(libproxy[0-9]+(v5)?)[[:space:]]*$$/\1/p' debian/control)

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

DO_PACKAGES = $(shell dh_listpackages)

CONFIGURE_FLAGS = -Dconfig-osx=false \
		-Dconfig-windows=false \
		-Ddocs=false \
		-Dintrospection=false \

ifneq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
# two symbols are missing
export DPKG_GENSYMBOLS_CHECK_LEVEL = 0
CONFIGURE_FLAGS += \
		-Dconfig-gnome=false \
		-Dpacrunner-duktape=false
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_FLAGS)

override_dh_gencontrol:
	dh_gencontrol -- -Vlibproxy=${libproxy}

override_dh_gnome_clean:
