#!/usr/bin/make -f
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-Bsymbolic

%:
	dh $@ --with gir,gnome

autoreconf:
	NOCONFIGURE=true gnome-autogen.sh

override_dh_autoreconf:
	dh_autoreconf --as-needed debian/rules -- autoreconf

override_dh_auto_configure:
	dh_auto_configure -- \
		--with-unicode-support=libunistring \
		--enable-introspection \
		--enable-tracker-fts \
		--enable-libstemmer \
		--enable-upower \
		--enable-gtk-doc \
		--enable-unit-tests \
		--disable-network-manager \
		--disable-hal \
		--disable-static \
		--libexecdir=\$${prefix}/lib/tracker

override_dh_install:
	find debian/tmp -name '*.la' -print -delete
	find debian/tmp -name libtracker-common.so -print -delete
	find debian/tmp -name libtracker-data.so -print -delete
	dh_install

override_dh_missing:
	dh_missing --fail-missing

# Enforce tight shlibs dependencies
override_dh_makeshlibs:
	dh_makeshlibs -V -X/usr/lib/$(DEB_HOST_MULTIARCH)/tracker-2.0/

override_dh_strip:
	dh_strip --dbgsym-migration='tracker-dbg (<< 1.7.4-1~)'

override_dh_auto_test:
ifeq (, $(filter nocheck, $(DEB_BUILD_OPTIONS)))
	dbus-run-session -- $(MAKE) check -k VERBOSE=1 || true
endif
