#!/usr/bin/make -f

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

FEATURE_FLAGS = \
	-Dgeneric_media_extractor=gstreamer \
	-Dsystemd_user_services=/usr/lib/systemd/user \
	-Ddocs=true \
	-Dabiword=true \
	-Dmp3=true \
	-Denable-dvi=true \
	-Dps=true \
	-Dicon=true \
	-Dtext=true \
	-Dfunctional_tests=true \
	-Dminer_rss=false \
	-Dbattery_detection=upower \
	-Dcharset_detection=icu

# Disable this section since meson doesn't have these options yet
# https://gitlab.gnome.org/GNOME/tracker-miners/issues/39
# Disable 'universe' dependencies on Ubuntu
#ifeq ($(shell dpkg-vendor --query vendor),Ubuntu)
#FEATURE_FLAGS += \
#	-Dlibiptcdata=false \
#	-Dlibosinfo=false
#else
#FEATURE_FLAGS += \
#	-Dlibiptcdata=true \
#	-Dlibosinfo=true \
#endif

%:
	dh $@ --with gnome --buildsystem=meson

override_dh_auto_configure:
	dh_auto_configure -- \
		$(FEATURE_FLAGS) \
		--libexecdir=/usr/lib/tracker

override_dh_install:
	find debian/tmp -name 01-writeback.py -print -delete
	find debian/tmp -name tracker-tests -print -delete
	dh_install

override_dh_missing:
	dh_missing --fail-missing

override_dh_makeshlibs:
	dh_makeshlibs -X/usr/lib/$(DEB_HOST_MULTIARCH)/tracker-miners-2.0/

override_dh_shlibdeps:
	dh_shlibdeps -Ltracker-extract

override_dh_auto_test:
	dbus-run-session -- dh_auto_test
