From 1151718bded213558f878918fd6a5d56503180fb Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 27 Jan 2016 22:39:31 +0100 Subject: [PATCH 3/3] Add an option to disable the backend build With xdg-app, we will want to bundle the client convenience library with applications that require GeoClue, without having them ship all the backend service files, which will be shipped in the core OS. Introduce a --disable-backend build option that implements this policy. https://bugs.freedesktop.org/show_bug.cgi?id=93889 --- Makefile.am | 8 +++++++- configure.ac | 32 ++++++++++++++++++++++---------- data/Makefile.am | 10 ++++++---- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index c620e09..6270104 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,13 @@ else LIBGEOCLUE_DIR = endif -SUBDIRS = build-aux public-api src data $(LIBGEOCLUE_DIR) demo po docs +if BUILD_BACKEND +BACKEND_DIR = src +else +BACKEND_DIR = +endif + +SUBDIRS = build-aux public-api $(BACKEND_DIR) data $(LIBGEOCLUE_DIR) demo po docs INTLTOOL_FILES = \ intltool-extract.in \ diff --git a/configure.ac b/configure.ac index b012b9c..00fa679 100644 --- a/configure.ac +++ b/configure.ac @@ -125,11 +125,6 @@ if test "x$build_modem_source" = "xyes"; then fi AM_CONDITIONAL([BUILD_MODEM_SOURCE], [test "x$build_modem_source" = "xyes"]) -# Check for ModemManager if one of the sources requires it -if test "x$require_modemmanager" = "xyes"; then - PKG_CHECK_MODULES(ModemManager, mm-glib >= $LIBMM_GLIB_MIN_VERSION) -fi - # Network NMEA Source AC_ARG_ENABLE(nmea-source, AS_HELP_STRING([--disable-nmea-source], @@ -143,12 +138,28 @@ else fi AM_CONDITIONAL([BUILD_NMEA_SOURCE], [test "x$build_nmea_source" = "xyes"]) -if test "x$build_nmea_source" = "xyes"; then - # Check for avahi-client and avahi-glib - PKG_CHECK_MODULES(NMEA_SOURCE, [ - avahi-client >= $AVAHI_MIN_VERSION - avahi-glib >= $AVAHI_MIN_VERSION]) +# Backend build +AC_ARG_ENABLE(backend, + AS_HELP_STRING([--disable-backend], [Disable backend]), + [build_backend=$enableval], [build_backend=yes]) + +if test "x$build_backend" = "xyes"; then + # Check for ModemManager if one of the sources requires it + if test "x$require_modemmanager" = "xyes"; then + PKG_CHECK_MODULES(ModemManager, mm-glib >= $LIBMM_GLIB_MIN_VERSION) + fi + + if test "x$build_nmea_source" = "xyes"; then + # Check for avahi-client and avahi-glib + PKG_CHECK_MODULES(NMEA_SOURCE, [ + avahi-client >= $AVAHI_MIN_VERSION + avahi-glib >= $AVAHI_MIN_VERSION]) + fi + AC_DEFINE([BUILD_BACKEND], [1], [Build backend?]) +else + AC_DEFINE([BUILD_BACKEND], [0], [Build backend?]) fi +AM_CONDITIONAL([BUILD_BACKEND], [test "x$build_backend" = "xyes"]) # Demo agent AC_ARG_ENABLE(demo-agent, @@ -253,6 +264,7 @@ AC_MSG_NOTICE([ c compiler: ${CC} ${CFLAGS} systemdsystemunitdir: ${systemdsystemunitdir} + Backend: ${build_backend} Convenience library: ${build_libgeoclue} Introspection: ${build_introspection} 3G source: ${build_3g_source} diff --git a/data/Makefile.am b/data/Makefile.am index 38a1e56..fc837d0 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,5 +1,9 @@ -systemconfdir = $(sysconfdir)/geoclue +service_in_files = org.freedesktop.GeoClue2.service.in systemconf_in_files = geoclue.conf.in +systemdservice_in_files = geoclue.service.in + +if BUILD_BACKEND +systemconfdir = $(sysconfdir)/geoclue systemconf_DATA = $(systemconf_in_files:.conf.in=.conf) if BUILD_DEMO_AGENT @@ -13,7 +17,6 @@ $(systemconf_DATA): $(systemconf_in_files) Makefile endif servicedir = $(datadir)/dbus-1/system-services -service_in_files = org.freedesktop.GeoClue2.service.in service_DATA = $(service_in_files:.service.in=.service) $(service_DATA): $(service_in_files) Makefile @@ -25,8 +28,6 @@ dbusservicedir = $(DBUS_SYS_DIR) dbusservice_DATA = org.freedesktop.GeoClue2.conf \ org.freedesktop.GeoClue2.Agent.conf -systemdservice_in_files = geoclue.service.in - if HAVE_SYSTEMD systemdservicedir = $(systemdsystemunitdir) systemdservice_DATA = $(systemdservice_in_files:.service.in=.service) @@ -35,6 +36,7 @@ $(systemdservice_DATA): $(systemdservice_in_files) Makefile @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< | \ sed -e "s|\@dbus_srv_user\@|$(dbus_srv_user)|" > $@ endif +endif DISTCLEANFILES = $(service_DATA) \ $(systemconf_DATA) \ -- 2.5.0