#!/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

override_dh_auto_configure:
	dh_auto_configure -- --libexec=/usr/lib/geoclue-2.0 \
                             --with-dbus-service-user=geoclue \
                             --with-systemdsystemunitdir=/lib/systemd/system \
                             --disable-silent-rules \
                             ${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 autotools-dev,autoreconf,gir

override_dh_install:
	dh_install --list-missing
