From 55c7eba9546df2317f1b5cbbd8f2f64936f7d33b Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 13 Dec 2017 01:49:54 -0800 Subject: [PATCH] autotools: building of binaries optional When building and installing backends on additional build platforms, linking the binaries is both unnecessary and sometimes problematic (for example, helper libraries not available in a version that works). Therefore configure arguments can be used to disable linking of the binaries. Signed-off-by: Patrick Ohly --- Makefile.am | 9 +++++++++ configure.ac | 12 ++++++++++++ src/src.am | 10 ++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index be40ddbb..d321011b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -351,6 +351,7 @@ RUN_SYNCEVOLUTION_CHECK=die if $$?; return $$buffer; endif # patch README.rst properties on-the-fly +if COND_CMDLINE README.patched.rst: README.rst src/syncevolution $(AM_V_GEN)perl -e '$$syncfound=0; $$sourcefound=0; $$res=0;' \ -e 'sub run { $$cmd = shift; $$buffer = `env LD_LIBRARY_PATH=src/syncevo/.libs:src/gdbus/.libs:src/gdbusxx/.libs:src/build-synthesis/src/.libs:$$ENV{LD_LIBRARY_PATH} $$cmd`; $(RUN_SYNCEVOLUTION_CHECK) }' \ @@ -365,6 +366,14 @@ README.patched.rst: README.rst src/syncevolution -e 'die "<> tag not in README.rst?!" unless $$sourcefound;' \ -e 'exit $$res;' \ $< >$@ +else +# Simpler version without inserting the actual sync and datastore properties. +README.patched.rst: README.rst + $(AM_V_GEN)perl -p \ + -e 's/^:Version: .*/:Version: $(VERSION)/;' \ + -e 's/:Date: .*/":Date: " . `date +%Y-%m-%d`/e;' \ + $< >$@ +endif CLEANFILES += README.patched.rst # produce man pages diff --git a/configure.ac b/configure.ac index 849872fa..30d08dd5 100644 --- a/configure.ac +++ b/configure.ac @@ -477,6 +477,18 @@ AC_ARG_ENABLE(core, enable_core="$enableval", enable_core="yes") AM_CONDITIONAL([COND_CORE], [test "$enable_core" = "yes"]) +AC_ARG_ENABLE(cmdline, + AS_HELP_STRING([--enable-cmdline], + [enables building the SyncEvolution command line tool, syncevolution]), + enable_cmdline="$enableval", + enable_cmdline="yes") +AM_CONDITIONAL([COND_CMDLINE], [test "$enable_cmdline" = "yes"]) +AC_ARG_ENABLE(local-sync, + AS_HELP_STRING([--enable-local-sync], + [enables building the local synchronization support, in particular syncevo-local-sync]), + enable_local_sync="$enableval", + enable_local_sync="yes") +AM_CONDITIONAL([COND_LOCAL_SYNC], [test "$enable_local_sync" = "yes"]) AC_ARG_ENABLE(dbus-service, AS_HELP_STRING([--enable-dbus-service=args], diff --git a/src/src.am b/src/src.am index 2cfbaf0d..89c8b06c 100644 --- a/src/src.am +++ b/src/src.am @@ -18,12 +18,14 @@ include $(top_srcdir)/src/syncevo/syncevo.am src_cppflags += -I$(top_srcdir)/src/syncevo include $(top_srcdir)/src/backends/backends.am src_cppflags += $(addprefix -I$(top_srcdir)/,$(BACKENDS)) -I$(SYNTHESIS_SUBDIR) -bin_PROGRAMS += src/syncevolution bin_SCRIPTS += src/synccompare include $(top_srcdir)/src/templates/templates.am else src_cppflags += -I$(top_srcdir)/$(SYNTHESIS_SUBDIR_INCLUDES) endif +if COND_CMDLINE +bin_PROGRAMS += src/syncevolution +endif include $(top_srcdir)/src/dbus/dbus.am src_cppflags += -I$(top_srcdir)/src/dbus @@ -182,8 +184,8 @@ distclean-local: rm -rf $(SYNTHESIS_SUBDIR) rm -rf $(CLEAN_CLIENT_SRC) -# Local sync helper executable. Built unconditionally at the moment, -# thus creating a hard dependency on D-Bus. +# Local sync helper executable. Depends on D-Bus for internal communication. +if COND_LOCAL_SYNC libexec_PROGRAMS += src/syncevo-local-sync src_syncevo_local_sync_SOURCES = \ src/syncevo-local-sync.cpp \ @@ -196,7 +198,7 @@ src_syncevo_local_sync_CPPFLAGS = -DHAVE_CONFIG_H -I$(gdbus_dir) $(src_cppflags) src_syncevo_local_sync_CXXFLAGS = $(PCRECPP_CFLAGS) $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) $(LIBSOUP_CFLAGS) $(SYNCEVO_WFLAGS) src_syncevo_local_sync_LDFLAGS = $(PCRECPP_LIBS) $(CORE_LD_FLAGS) $(LIBSOUP_LIBS) src_syncevo_local_sync_DEPENDENCIES = $(top_builddir)/$(gdbus_build_dir)/libgdbussyncevo.la $(EXTRA_LTLIBRARIES) $(CORE_DEP) $(SYNTHESIS_DEP) - +endif # Do the linking here, as with all SyncEvolution executables. # Sources are compiled in dbus/server.