#!/usr/bin/make -f
# -*- makefile -*-

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

ifneq ($(DEB_BUILD_ARCH_OS),linux)
  MM_NM_FLAGS := --disable-3g-source \
                 --disable-modem-gps-source \
                 --disable-cdma-source
endif

ifneq ($(shell which gtkdoc-scan),)
ifeq ($(filter nodoc, $(DEB_BUILD_OPTIONS)),)
  BUILD_DOC := --enable-gtk-doc
endif
endif

override_dh_auto_configure:
	dh_auto_configure -- --libexec=/usr/lib/geoclue-2.0 \
                             --with-dbus-service-user=geoclue \
                             --with-systemdsystemunitdir=/lib/systemd/system \
			     ${BUILD_DOC} \
                             ${MM_NM_FLAGS}

override_dh_auto_test:
	# testsuite fails on missing latitude (et.al)
	# which is only available when using GeoLiteCity.dat
	# database, which "geoip-database" package in debian
	# does not include.
	dh_auto_test || true

override_dh_auto_install:
	dh_auto_install
	mv $(CURDIR)/debian/tmp/usr/lib/geoclue-2.0/geoclue-2.0/demos \
		$(CURDIR)/debian/tmp/usr/lib/geoclue-2.0/demos

%:
	dh $@ --with autoreconf,gir

override_dh_missing:
	dh_missing --list-missing
