#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/buildvars.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/class/gnome.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk
include /usr/share/gnome-pkg-tools/1/rules/gnome-version.mk
include /usr/share/hardening-includes/hardening.make

ELIBDIR := usr/lib/evolution/3.0

DEB_SHLIBDEPS_INCLUDE := debian/evolution/$(ELIBDIR)
DEB_DH_MAKESHLIBS_ARGS_libevolution += -V'libevolution (>= $(DEB_GNOME_VERSION)), libevolution (<< $(DEB_GNOME_NEXTVERSION))' --noscripts -X $(ELIBDIR)/modules
DEB_DH_MAKESHLIBS_ARGS_evolution += -V
DEB_DH_MAKESHLIBS_ARGS_ALL += --noscripts -X $(ELIBDIR)/plugins

LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
CFLAGS += $(HARDENING_CFLAGS)
LDFLAGS+=-Wl,-z,defs -Wl,-O1 -Wl,--as-needed $(HARDENING_LDFLAGS)

export CFLAGS LDFLAGS

DEB_REVISION := $(shell echo $(DEB_VERSION) | awk -F- '{ print $$NF }')

DEB_CONFIGURE_EXTRA_FLAGS += \
	--with-openldap \
	--enable-nls \
	--with-krb5=/usr \
	--sysconfdir=/etc \
	--libexecdir=/usr/lib \
	--enable-plugins=experimental \
	--disable-pst-import \
        --disable-contacts-map \
	--disable-image-inline \
	--with-sub-version=-$(DEB_REVISION)

ifneq ($(DEB_HOST_ARCH_OS), linux)
	DEB_CONFIGURE_EXTRA_FLAGS+=--disable-nm
else
	DEB_CONFIGURE_EXTRA_FLAGS+=--enable-nm
endif

clean::
	debconf-updatepo
	find -name '*.schemas' | xargs rm -f

common-binary-post-install-indep::
	dh_bugfiles -A
