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

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 -- --libdir=/usr/lib \
                             --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
	rm -f $(CURDIR)/debian/geoclue-2.0/usr/share/applications/geoclue-demo-agent.desktop
	mv $(CURDIR)/debian/geoclue-2.0/usr/lib/geoclue-2.0/geoclue-2.0/demos \
		$(CURDIR)/debian/geoclue-2.0/usr/lib/geoclue-2.0/demos
	rm -rf $(CURDIR)/debian/geoclue-2.0/usr/lib/geoclue-2.0/geoclue-2.0/

%:
	dh $@ --with autotools-dev,autoreconf
