syncevolution/src/src.am

429 lines
19 KiB
Plaintext
Raw Permalink Normal View History

src_cppflags = -I$(top_srcdir)/src
if ENABLE_GNOME_BLUETOOTH_PANEL
include $(top_srcdir)/src/gnome-bluetooth/gnome-bluetooth.am
src_cppflags += -I$(top_srcdir)/src/gnome-bluetooth
endif
if COND_GIO_GDBUS
include $(top_srcdir)/src/gdbusxx/gdbusxx.am
src_cppflags += -I$(top_srcdir)/src/gdbusxx
else
include $(top_srcdir)/src/gdbus/gdbus.am
src_cppflags += -I$(top_srcdir)/src/gdbus
endif
if COND_CORE
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
include $(top_srcdir)/src/dbus/dbus.am
src_cppflags += -I$(top_srcdir)/src/dbus
include $(top_srcdir)/src/gtk-ui/gtk-ui.am
include $(top_srcdir)/src/gtk3-ui/gtk-ui.am
src_cppflags += -I$(top_srcdir)/test -I$(top_srcdir) $(BACKEND_CPPFLAGS)
DISTCLEANFILES += src/synccompare
CLEANFILES += src/libstdc++.a src/client-test $(CLIENT_LIB_TEST_FILES)
if COND_DBUS
nodist_bin_SCRIPTS += src/syncevo-http-server
endif
src/syncevo-http-server: $(top_srcdir)/test/syncevo-http-server.py
$(AM_V_GEN)cp $< $@
CLEANFILES += src/syncevo-http-server
nodist_bin_SCRIPTS += src/syncevo-phone-config
src/syncevo-phone-config: $(top_srcdir)/test/syncevo-phone-config.py
$(AM_V_GEN)cp $< $@
CLEANFILES += src/syncevo-phone-config
SYNCEVOLUTION_DEP =
if !ENABLE_MODULES
# SYNCEVOLUTION_LDADD is defined in configure script.
SYNCEVOLUTION_LDADD += @SYNCSOURCES@
SYNCEVOLUTION_DEP += @SYNCSOURCES@
endif
dist_noinst_DATA += \
src/shlibs.local \
src/synthesis-includes/Makefile.am \
src/synthesis-includes/Makefile.in
DISTCLEANFILES += src/synthesis-includes/Makefile
# synccompare is created by replacing its 'import Algorithm::Diff;'
# with a simplified copy of Diff.pm.
src/synccompare : $(top_srcdir)/test/Algorithm/Diff.pm $(top_srcdir)/test/synccompare.pl
$(AM_V_GEN)perl -e '$$diff = shift; open(DIFF, "<$$diff"); ($$_) = split(/__END__/, join("", <DIFF>)); s/\*import.*//m; s/require +Exporter;//; s/^#.*\n//mg; s/ +#.*\n//mg; $$diff = $$_;' -e 'while(<>) {' @MODIFY_SYNCCOMPARE@ -e 's/use +Algorithm::Diff;/"# embedded version of Algorithm::Diff follows, copyright by the original authors\n" . $$diff . "# end of embedded Algorithm::Diff\n"/e; print;}' $+ >$@ \
&&chmod u+x $@
# helper script for testing
bin_SCRIPTS += src/synclog2html
CLEANFILES += src/synclog2html
src/synclog2html: $(top_srcdir)/test/log2html.py
$(AM_V_GEN)cp $< $@ && chmod u+x $@
CORE_SOURCES =
# The files which register backends have to be compiled into
# "client-test" and "syncevolution" in order to pull in the
# code from the libs which implement the backends.
#
# Unit testing also goes there.
#
# When using modules the registration is done inside the
# module and the register file is unnecessary. However, they
# still need to be included in "make dist".
if ENABLE_MODULES
dist_noinst_DATA += $(BACKEND_REGISTRIES)
else
CORE_SOURCES += $(BACKEND_REGISTRIES)
endif
CORE_CXXFLAGS = $(SYNTHESIS_CFLAGS) $(CPPUNIT_CFLAGS)
CORE_LDADD = $(SYNCEVOLUTION_LDADD) src/syncevo/libsyncevolution.la $(GLIB_LIBS) $(GTHREAD_LIBS) $(GOBJECT_LIBS) $(LIBS)
CORE_DEP = $(SYNCEVOLUTION_DEP) src/syncevo/libsyncevolution.la $(SYNTHESIS_DEP)
CORE_LD_FLAGS = -Wl,-uSyncEvolution_Module_Version -Wl,--export-dynamic $(CPPUNIT_LIBS) $(ADDITIONAL_LDFLAGS)
if ENABLE_ICALTZ_UTIL
syncevolution.org: compile on Ubuntu Trusty, libical v1/v2 compatibility syncevolution.org binaries are now getting compiled on Ubuntu Trusty and thus no longer support distros with older EDS. The code should still compile against older EDS (for example, for Maemo), but that is not getting tested anymore. This allows removing the dynamic linker hacks related to older libraries, which was only used in those binaries. Instead, backends using libical or EDS get compiled on Ubuntu Trusty and then the soname of those libs get patched to make the backend module usable in combination with a different set of libs. That patching is part of a script maintained in the syncevolution.org build infrastructure. This approach was already used before to generate different EDS backends for EDS versions with the newer EClient API, because that turned out to be easier than the dynamic loading approach. It works because none of the methods used by SyncEvolution changed their ABI, only some other parts of the libraries did. Should there ever be a situation again that cannot be handled like this, then backends might also get compiled on different distros than Ubuntu Trusty (however, that may lead to problems due to the libstdc++ ABI changes - to be decided...). libical still requires one special hack: system time zone loading in libical v1 (and only in that version, v2 has builtin support again) must be overridden such that time zones are generated with rules instead of transitions because that is more compatible with the peers that SyncEvolution exchanges data with. That hack now relies on overriding the two relevant functions inside the main binaries (has to be there, otherwise libical still ends up calling its own internal implementation). The overriding code is in libsyncevo-icaltz-util.so.0 and depends on libical.so.1. If libsyncevo-icaltz-util.so.0 can be loaded, the wrappers in the main binary use it, otherwise they fall through to the code from the current libical.so, which then should be libical.so.2 or more recent. This hack is active by default when libical v1 is detected during configuration.
2016-09-20 17:19:08 +02:00
# Force inclusion of our own ical replacement functions directly
# in the binaries. Otherwise the dynamic linker will still end up
# using the functions from libical.so.1.
CORE_LD_FLAGS += -Wl,-usyncevo_fetch_timezone src/syncevo/libsyncevo-icaltz-util-wrapper.la
endif
# Used when build syncevolution.org binaries to link statically
# against certain libraries with ABIs that changed between distros
# (libpcrecpp, libopenobex).
CORE_LDADD += $(EXTRACORELDADD)
# put link to static c++ library into current directory, needed if compiling with --enable-static-c++
src/libstdc++.a :
$(AM_V_GEN)path=`$(CXX) $(CORE_LDADD) $(LD_FLAGS) -print-file-name=src/libstdc++.a` && ln -s $$path .
src_syncevolution_SOURCES = \
src/syncevolution.cpp \
$(CORE_SOURCES)
if ENABLE_UNIT_TESTS
nodist_src_syncevolution_SOURCES = test/test.cpp
endif
# SYNCEVOLUTION_LDADD will be replaced with libsyncebook.la/libsyncecal.la/libsyncsqlite.la
# if linking statically against them, empty otherwise;
# either way this does not lead to a dependency on those libs - done explicitly
src_syncevolution_LDADD = $(CORE_LDADD)
src_syncevolution_DEPENDENCIES = $(EXTRA_LTLIBRARIES) $(CORE_DEP)
if COND_DBUS
src_syncevolution_LDADD += $(gdbus_build_dir)/libgdbussyncevo.la
src_syncevolution_DEPENDENCIES += $(gdbus_build_dir)/libgdbussyncevo.la
endif
src_syncevolution_LDFLAGS = $(PCRECPP_LIBS) $(CORE_LD_FLAGS) $(DBUS_LIBS)
src_syncevolution_CXXFLAGS = $(PCRECPP_CFLAGS) $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS) $(DBUS_CFLAGS) $(SYNCEVO_WFLAGS)
src_syncevolution_CPPFLAGS = $(src_cppflags) -I$(gdbus_dir)
# include Synthesis in distribution: package only files in git if using a git checkout
autotools: ensure that link lines are complete As mentioned by Tino Keitel on the mailing list, some libs and executables were only implicitly linked against libraries that they called directly. This happened to work by chance because these libraries ended up in the running executable anyway, due to indirect loading. To catch such problems, the "make installcheck" was extended: dpkg-shlibdeps is run, if available, and the error output is scanned for the messages which indicate that a symbol is used without linking to the right library (example output below). Had to fix quite a few _LIBADD lines to pass the test. Some exceptions are allowed: - libsmltk depends on the caller providing SySync logging support. - libneon is intentionally not linked explicitly for syncevolution.org binaries, to make resulting binaries work with GNUTLS and OpenSSL. dpkg-shlibdeps: warning: debian/syncevolution-libs/usr/lib/syncevolution/backends/syncdav.so contains an unresolvable reference to symbol icalparameter_new_from_value_string: it's probably a plugin. dpkg-shlibdeps: warning: 51 other similar warnings have been skipped (use -v to see them all). ... dpkg-shlibdeps: warning: symbol dlsym used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlerror used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlopen used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
2012-07-12 17:59:33 +02:00
#
# Need to run autogen.sh in $(distdir)-synthesis and not the final
# $(distdir)/src/synthesis because recent autotools do not copy
# files like config.sub when invoked in $(distdir)/src/synthesis
# (automake 1.11.5, autoconf 2.69), probably because they are
# found in a parent directory. However, these files are needed
# later on during the recursive libsynthesis configure+make.
all_dist_hooks += src_dist_hook
src_dist_hook:
@set -x; [ ! '$(SYNTHESIS_SUBDIR)' ] || \
autotools: ensure that link lines are complete As mentioned by Tino Keitel on the mailing list, some libs and executables were only implicitly linked against libraries that they called directly. This happened to work by chance because these libraries ended up in the running executable anyway, due to indirect loading. To catch such problems, the "make installcheck" was extended: dpkg-shlibdeps is run, if available, and the error output is scanned for the messages which indicate that a symbol is used without linking to the right library (example output below). Had to fix quite a few _LIBADD lines to pass the test. Some exceptions are allowed: - libsmltk depends on the caller providing SySync logging support. - libneon is intentionally not linked explicitly for syncevolution.org binaries, to make resulting binaries work with GNUTLS and OpenSSL. dpkg-shlibdeps: warning: debian/syncevolution-libs/usr/lib/syncevolution/backends/syncdav.so contains an unresolvable reference to symbol icalparameter_new_from_value_string: it's probably a plugin. dpkg-shlibdeps: warning: 51 other similar warnings have been skipped (use -v to see them all). ... dpkg-shlibdeps: warning: symbol dlsym used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlerror used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlopen used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
2012-07-12 17:59:33 +02:00
rm -rf $(distdir)-synthesis && \
mkdir -p $(distdir)-synthesis && \
if test -d '$(SYNTHESIS_SRC)/.git'; \
then \
autotools: ensure that link lines are complete As mentioned by Tino Keitel on the mailing list, some libs and executables were only implicitly linked against libraries that they called directly. This happened to work by chance because these libraries ended up in the running executable anyway, due to indirect loading. To catch such problems, the "make installcheck" was extended: dpkg-shlibdeps is run, if available, and the error output is scanned for the messages which indicate that a symbol is used without linking to the right library (example output below). Had to fix quite a few _LIBADD lines to pass the test. Some exceptions are allowed: - libsmltk depends on the caller providing SySync logging support. - libneon is intentionally not linked explicitly for syncevolution.org binaries, to make resulting binaries work with GNUTLS and OpenSSL. dpkg-shlibdeps: warning: debian/syncevolution-libs/usr/lib/syncevolution/backends/syncdav.so contains an unresolvable reference to symbol icalparameter_new_from_value_string: it's probably a plugin. dpkg-shlibdeps: warning: 51 other similar warnings have been skipped (use -v to see them all). ... dpkg-shlibdeps: warning: symbol dlsym used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlerror used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlopen used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
2012-07-12 17:59:33 +02:00
( ( cd '$(SYNTHESIS_SRC)' && git archive HEAD ) | ( cd '$(distdir)-synthesis' && tar xf - && $$SHELL autogen.sh && rm -rf autom4te.cache && find . -name .gitignore -delete ) ) && \
( printf 'Creating synthesis ChangeLog... ' && \
( ( cd '$(SYNTHESIS_SRC)' && \
echo '# Generated by configure. Do not edit.' && \
githash=`git show-ref --head --hash | head -1` && \
echo "# git revision $$githash" && \
echo "# git tag `git describe --tags $$githash`" && \
echo && \
'$(top_srcdir)/missing' --run perl '$(top_srcdir)/build/gen-changelog.pl' ) >ChangeLog.tmp ) && \
autotools: ensure that link lines are complete As mentioned by Tino Keitel on the mailing list, some libs and executables were only implicitly linked against libraries that they called directly. This happened to work by chance because these libraries ended up in the running executable anyway, due to indirect loading. To catch such problems, the "make installcheck" was extended: dpkg-shlibdeps is run, if available, and the error output is scanned for the messages which indicate that a symbol is used without linking to the right library (example output below). Had to fix quite a few _LIBADD lines to pass the test. Some exceptions are allowed: - libsmltk depends on the caller providing SySync logging support. - libneon is intentionally not linked explicitly for syncevolution.org binaries, to make resulting binaries work with GNUTLS and OpenSSL. dpkg-shlibdeps: warning: debian/syncevolution-libs/usr/lib/syncevolution/backends/syncdav.so contains an unresolvable reference to symbol icalparameter_new_from_value_string: it's probably a plugin. dpkg-shlibdeps: warning: 51 other similar warnings have been skipped (use -v to see them all). ... dpkg-shlibdeps: warning: symbol dlsym used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlerror used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlopen used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
2012-07-12 17:59:33 +02:00
( mv -f ChangeLog.tmp '$(distdir)-synthesis/ChangeLog' && \
printf 'synthesis ChangeLog done\n' ) || \
( rm -f ChangeLog.tmp ; \
autotools: ensure that link lines are complete As mentioned by Tino Keitel on the mailing list, some libs and executables were only implicitly linked against libraries that they called directly. This happened to work by chance because these libraries ended up in the running executable anyway, due to indirect loading. To catch such problems, the "make installcheck" was extended: dpkg-shlibdeps is run, if available, and the error output is scanned for the messages which indicate that a symbol is used without linking to the right library (example output below). Had to fix quite a few _LIBADD lines to pass the test. Some exceptions are allowed: - libsmltk depends on the caller providing SySync logging support. - libneon is intentionally not linked explicitly for syncevolution.org binaries, to make resulting binaries work with GNUTLS and OpenSSL. dpkg-shlibdeps: warning: debian/syncevolution-libs/usr/lib/syncevolution/backends/syncdav.so contains an unresolvable reference to symbol icalparameter_new_from_value_string: it's probably a plugin. dpkg-shlibdeps: warning: 51 other similar warnings have been skipped (use -v to see them all). ... dpkg-shlibdeps: warning: symbol dlsym used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlerror used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlopen used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
2012-07-12 17:59:33 +02:00
printf 'synthesis ChangeLog failed\n'; \
echo 'Failed to generate synthesis ChangeLog.' >&2 ) \
); \
elif test '$(SYNTHESIS_SRC)' != 'no-synthesis-source'; \
then \
autotools: ensure that link lines are complete As mentioned by Tino Keitel on the mailing list, some libs and executables were only implicitly linked against libraries that they called directly. This happened to work by chance because these libraries ended up in the running executable anyway, due to indirect loading. To catch such problems, the "make installcheck" was extended: dpkg-shlibdeps is run, if available, and the error output is scanned for the messages which indicate that a symbol is used without linking to the right library (example output below). Had to fix quite a few _LIBADD lines to pass the test. Some exceptions are allowed: - libsmltk depends on the caller providing SySync logging support. - libneon is intentionally not linked explicitly for syncevolution.org binaries, to make resulting binaries work with GNUTLS and OpenSSL. dpkg-shlibdeps: warning: debian/syncevolution-libs/usr/lib/syncevolution/backends/syncdav.so contains an unresolvable reference to symbol icalparameter_new_from_value_string: it's probably a plugin. dpkg-shlibdeps: warning: 51 other similar warnings have been skipped (use -v to see them all). ... dpkg-shlibdeps: warning: symbol dlsym used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlerror used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlopen used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
2012-07-12 17:59:33 +02:00
cp -a '$(SYNTHESIS_SRC)/'* '$(distdir)-synthesis' && \
for i in _build autom4te.cache; do [ ! -d "$(SYNTHESIS_SRC)/$$i" ] || chmod -R u+rwx "$(SYNTHESIS_SRC)/$$i"; done && \
autotools: ensure that link lines are complete As mentioned by Tino Keitel on the mailing list, some libs and executables were only implicitly linked against libraries that they called directly. This happened to work by chance because these libraries ended up in the running executable anyway, due to indirect loading. To catch such problems, the "make installcheck" was extended: dpkg-shlibdeps is run, if available, and the error output is scanned for the messages which indicate that a symbol is used without linking to the right library (example output below). Had to fix quite a few _LIBADD lines to pass the test. Some exceptions are allowed: - libsmltk depends on the caller providing SySync logging support. - libneon is intentionally not linked explicitly for syncevolution.org binaries, to make resulting binaries work with GNUTLS and OpenSSL. dpkg-shlibdeps: warning: debian/syncevolution-libs/usr/lib/syncevolution/backends/syncdav.so contains an unresolvable reference to symbol icalparameter_new_from_value_string: it's probably a plugin. dpkg-shlibdeps: warning: 51 other similar warnings have been skipped (use -v to see them all). ... dpkg-shlibdeps: warning: symbol dlsym used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlerror used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries. dpkg-shlibdeps: warning: symbol dlopen used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
2012-07-12 17:59:33 +02:00
find '$(distdir)-synthesis' -name '.libs' -o -name '*~' -o -name '.*' -o -name '*.o' -o -name '*.lo' -o -name 'CVS' -o -name '.svn' -o -name '.git' -o -name .gitignore -o -name 'autom4te.cache' -print0 | xargs -0 rm -rf; \
fi && \
mv '$(distdir)-synthesis' '$(distdir)/src/synthesis'
clean-local: testclean
rm -rf src/testcases
[ ! -L src/templates ] || rm src/templates
# files created during testing
testclean:
rm -rf src/*.test.vcf src/*.log src/*.log.html src/*.tests src/*.diff src/*.dat src/*Client_Sync_*client.* src/*Client_Source*
distclean-local:
rm -rf $(SYNTHESIS_SUBDIR)
rm -rf $(CLEAN_CLIENT_SRC)
local sync: execute 'syncevo-local-sync' on child side, communicate via D-Bus Instead of forking and continuing to sync in the forked process without an explicit exec(), exec() the 'syncevo-local-sync' helper in the forked process. The syncevo-local-sync helper binary gets installed into libexec. SYNCEVOLUTION_LIBEXEC_DIR must be set if that helper is not installed yet, not in the PATH, or an old version would be found without that env variable ("make" without "make install" during development!). Main advantage is the cleaner environment for running the child side of local sync. Required for getting ActiveSync to work again (GDBus GIO as used by recent activesyncd client libraries did not work in the forked process without the exec()). Full D-Bus communication gets established between parent and child. The downside is the hard dependency of local sync on the D-Bus libraries (not the daemon!). D-Bus communication allowed implementing interactive password requests from the child side through the parent to the UI using the parent, something that wasn't implemented before. The child asks its parent for the password, which in turn passes the request to its SyncContext. This happens to work when that SyncContext is a normal instance (reads from stdin, the "syncevolution --daemon" case) and the syncevo-dbus-server (sends out an Info Request signal and waits for a response). The info request and response are handled in the blocking askPassword() by polling the running mail loop, so the parent should remain responsive. Overall it is still a pretty difficult setup; it would be better if askPassword() was asynchronous. Describing the required password also is sub-optimal: the sync-ui just asks for a password in its current config (even though that might not be the config which currently gets synced) and crashes if no config is currently selected. The command line uses the description derived from the property and config name, which is a bit technical, but at least correct. Syncing uses the child's error string as "first error" in the parent, too, by logging it anew on the parent side. That puts it into the parent's sync report ahead of any additional error that it might encounter while the child shuts down. Also use the child's status when available instead of a misleading TransportError. In addition, suppress as many of these errors as possible when we know already that the child reported an error in its sync report. Not all "transport errors" are currently avoided that way, but this is at least a first step.
2012-01-09 16:30:53 +01:00
# Local sync helper executable. Built unconditionally at the moment,
# thus creating a hard dependency on D-Bus.
libexec_PROGRAMS += src/syncevo-local-sync
src_syncevo_local_sync_SOURCES = \
src/syncevo-local-sync.cpp \
$(CORE_SOURCES)
if ENABLE_UNIT_TESTS
nodist_src_syncevo_local_sync_SOURCES = test/test.cpp
endif
src_syncevo_local_sync_LDADD = $(gdbus_build_dir)/libgdbussyncevo.la $(CORE_LDADD) $(DBUS_LIBS)
local sync: execute 'syncevo-local-sync' on child side, communicate via D-Bus Instead of forking and continuing to sync in the forked process without an explicit exec(), exec() the 'syncevo-local-sync' helper in the forked process. The syncevo-local-sync helper binary gets installed into libexec. SYNCEVOLUTION_LIBEXEC_DIR must be set if that helper is not installed yet, not in the PATH, or an old version would be found without that env variable ("make" without "make install" during development!). Main advantage is the cleaner environment for running the child side of local sync. Required for getting ActiveSync to work again (GDBus GIO as used by recent activesyncd client libraries did not work in the forked process without the exec()). Full D-Bus communication gets established between parent and child. The downside is the hard dependency of local sync on the D-Bus libraries (not the daemon!). D-Bus communication allowed implementing interactive password requests from the child side through the parent to the UI using the parent, something that wasn't implemented before. The child asks its parent for the password, which in turn passes the request to its SyncContext. This happens to work when that SyncContext is a normal instance (reads from stdin, the "syncevolution --daemon" case) and the syncevo-dbus-server (sends out an Info Request signal and waits for a response). The info request and response are handled in the blocking askPassword() by polling the running mail loop, so the parent should remain responsive. Overall it is still a pretty difficult setup; it would be better if askPassword() was asynchronous. Describing the required password also is sub-optimal: the sync-ui just asks for a password in its current config (even though that might not be the config which currently gets synced) and crashes if no config is currently selected. The command line uses the description derived from the property and config name, which is a bit technical, but at least correct. Syncing uses the child's error string as "first error" in the parent, too, by logging it anew on the parent side. That puts it into the parent's sync report ahead of any additional error that it might encounter while the child shuts down. Also use the child's status when available instead of a misleading TransportError. In addition, suppress as many of these errors as possible when we know already that the child reported an error in its sync report. Not all "transport errors" are currently avoided that way, but this is at least a first step.
2012-01-09 16:30:53 +01:00
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)
local sync: execute 'syncevo-local-sync' on child side, communicate via D-Bus Instead of forking and continuing to sync in the forked process without an explicit exec(), exec() the 'syncevo-local-sync' helper in the forked process. The syncevo-local-sync helper binary gets installed into libexec. SYNCEVOLUTION_LIBEXEC_DIR must be set if that helper is not installed yet, not in the PATH, or an old version would be found without that env variable ("make" without "make install" during development!). Main advantage is the cleaner environment for running the child side of local sync. Required for getting ActiveSync to work again (GDBus GIO as used by recent activesyncd client libraries did not work in the forked process without the exec()). Full D-Bus communication gets established between parent and child. The downside is the hard dependency of local sync on the D-Bus libraries (not the daemon!). D-Bus communication allowed implementing interactive password requests from the child side through the parent to the UI using the parent, something that wasn't implemented before. The child asks its parent for the password, which in turn passes the request to its SyncContext. This happens to work when that SyncContext is a normal instance (reads from stdin, the "syncevolution --daemon" case) and the syncevo-dbus-server (sends out an Info Request signal and waits for a response). The info request and response are handled in the blocking askPassword() by polling the running mail loop, so the parent should remain responsive. Overall it is still a pretty difficult setup; it would be better if askPassword() was asynchronous. Describing the required password also is sub-optimal: the sync-ui just asks for a password in its current config (even though that might not be the config which currently gets synced) and crashes if no config is currently selected. The command line uses the description derived from the property and config name, which is a bit technical, but at least correct. Syncing uses the child's error string as "first error" in the parent, too, by logging it anew on the parent side. That puts it into the parent's sync report ahead of any additional error that it might encounter while the child shuts down. Also use the child's status when available instead of a misleading TransportError. In addition, suppress as many of these errors as possible when we know already that the child reported an error in its sync report. Not all "transport errors" are currently avoided that way, but this is at least a first step.
2012-01-09 16:30:53 +01:00
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)
local sync: execute 'syncevo-local-sync' on child side, communicate via D-Bus Instead of forking and continuing to sync in the forked process without an explicit exec(), exec() the 'syncevo-local-sync' helper in the forked process. The syncevo-local-sync helper binary gets installed into libexec. SYNCEVOLUTION_LIBEXEC_DIR must be set if that helper is not installed yet, not in the PATH, or an old version would be found without that env variable ("make" without "make install" during development!). Main advantage is the cleaner environment for running the child side of local sync. Required for getting ActiveSync to work again (GDBus GIO as used by recent activesyncd client libraries did not work in the forked process without the exec()). Full D-Bus communication gets established between parent and child. The downside is the hard dependency of local sync on the D-Bus libraries (not the daemon!). D-Bus communication allowed implementing interactive password requests from the child side through the parent to the UI using the parent, something that wasn't implemented before. The child asks its parent for the password, which in turn passes the request to its SyncContext. This happens to work when that SyncContext is a normal instance (reads from stdin, the "syncevolution --daemon" case) and the syncevo-dbus-server (sends out an Info Request signal and waits for a response). The info request and response are handled in the blocking askPassword() by polling the running mail loop, so the parent should remain responsive. Overall it is still a pretty difficult setup; it would be better if askPassword() was asynchronous. Describing the required password also is sub-optimal: the sync-ui just asks for a password in its current config (even though that might not be the config which currently gets synced) and crashes if no config is currently selected. The command line uses the description derived from the property and config name, which is a bit technical, but at least correct. Syncing uses the child's error string as "first error" in the parent, too, by logging it anew on the parent side. That puts it into the parent's sync report ahead of any additional error that it might encounter while the child shuts down. Also use the child's status when available instead of a misleading TransportError. In addition, suppress as many of these errors as possible when we know already that the child reported an error in its sync report. Not all "transport errors" are currently avoided that way, but this is at least a first step.
2012-01-09 16:30:53 +01:00
# Do the linking here, as with all SyncEvolution executables.
# Sources are compiled in dbus/server.
if COND_DBUS
D-Bus server: fork/exec for sync, command line and restore operations This commit moves the blocking syncing, database restore and command line execution into a separate, short-lived process executing the syncevo-dbus-helper. The advantage is that the main syncevo-dbus-server remains responsive under all circumstances (fully asynchronous now) and suffers less from memory leaks and/or crashes during a sync. The core idea behind the new architecture is that Session remains the D-Bus facing side of a session. It continues to run inside syncevo-dbus-server and uses the syncevo-dbus-helper transparently via a custom D-Bus interface between the two processes. State changes of the helper are mirrored in the server. Later the helper might also be used multiple times in a Session. For example, anything related to loading backends should be moved into the helper (currently the "is config usable" check still runs in the syncevo-dbus-server and needs to load/initialize backends). The startup code of the helper already handles that (see boolean result of operation callback), but it is not used yet in practice. At the moment, only the helper provides a D-Bus API. It sends out signals when it needs information from the server. The server watches those and replies when ready. The helper monitors the connection to the parent and detects that it won't get an answer if that connection goes down. The problem of "helper died unexpectedly" is also handled, by not returning a D-Bus method reply until the requested operation is completed (different from the way how the public D-Bus API is defined!). The Connection class continues to use such a Session, as before. It's now fully asynchronous and exchanges messages with the helper via the Session class. Inside syncevo-dbus-server, boost::signals2 and the dbus-callbacks infrastructure for asynchronous methods execution are used heavily now. The glib event loop is entered exactly once and only left to shut down. Inside syncevo-dbus-helper, the event loop is entered only as needed. Password requests sent from syncevo-local-sync to syncevo-dbus-helper are handled asynchronously inside the event loop driven by the local transport. syncevo-dbus-helper and syncevo-local-sync are conceptually very similar. Should investigate whether a single executable can serve both functions. The AutoSyncManager was completely rewritten. The data structure is a lot simpler now (basically just a cache of transient information about a sync config and the relevant config properties that define auto syncing). The main work happens inside the schedule() call, which verifies whether a session can run and, if not possible for some reasons, ensures that it gets invoked again when that blocker is gone (timeout over, server idle, etc.). The new code also uses signals/slots instead of explicit coupling between the different classes. All code still lives inside the src/dbus/server directory. This simplifies checking differences in partly modified files like dbus-sync.cpp. A future commit will move the helper files. The syslog logger code is referenced by the server, but never used. This functionality needs further thought: - Make usage depend on command line option? Beware that test-dbus.py looks for the "ready to run" output and thus startup breaks when all output goes to syslog instead of stdout. - Redirect glib messages into syslog (done by LogRedirect, disabled when using LoggerSyslog)? The syncevo-dbus-server now sends the final "Session.StatusChanged done" signal immediately. The old implementation accidentally delayed sending that for 100 seconds. The revised test-dbus.py checks for more "session done" quit events to cover this fix. Only user-visible messages should have the INFO level in any of the helpers. Messages about starting and stopping processes are related to implementation details and thus should only have DEBUG level. The user also doesn't care about where the operation eventually runs. All messages related to it should be in INFO/DEBUG/ERROR messages without a process name. Therefore now syncevo-dbus-server logs with a process name (also makes some explicit argv[0] logging redundant; requires changes in test-dbus.py) and syncevo-dbus-helper doesn't. syncevo-local-sync is different from syncevo-dbus-helper: it produces user-relevant output (the other half of the local sync). It's output is carefully chosen so that the process name is something the user understands (target context) and output can be clearly related to one side or the other (for example, context names are included in the sync table). Output handling is based on the same idea as output handling in the syncevo-dbus-server: - Session registers itself as the top-most logger and sends SyncEvolution logging via D-Bus to the parent, which re-sends it with the right D-Bus object path as output of the session. - Output redirection catches all other output and feeds it back to the Session log handler, from where it goes via D-Bus to the parent. The advantage of this approach is that level information is made available directly to the parent and that message boundaries are preserved properly. stderr and stdout are redirected into the parent and logged there as error. Normally the child should not print anything. While it runs, LogRedirect inside it will capture output and log it internally. Anything reaching the parent thus must be from early process startup or shutdown. Almost all communication from syncevo-dbus-helper to syncevo-dbus-server is purely information for the syncevo-dbus-server; syncevo-dbus-helper doesn't care whether the signal can be delivered. The only exception is the information request, which must succeed. Instead of catching exceptions everywhere, the optional signals are declared as such in the EmitSignal template parameterization and no longer throw exceptions when something goes wrong. They also don't log anything, because that could lead to quite a lof of output.
2012-03-26 17:19:25 +02:00
# DBus Server
libexec_PROGRAMS += src/syncevo-dbus-server
src_syncevo_dbus_server_SOURCES = \
$(CORE_SOURCES)
if ENABLE_UNIT_TESTS
nodist_src_syncevo_dbus_server_SOURCES = test/test.cpp
endif
src_syncevo_dbus_server_LDADD = $(builddir)/src/dbus/server/libsyncevodbusserver.la $(gdbus_build_dir)/libgdbussyncevo.la $(CORE_LDADD) $(LIBNOTIFY_LIBS) $(MLITE_LIBS) $(DBUS_LIBS)
src_syncevo_dbus_server_CPPFLAGS = -DHAVE_CONFIG_H -I$(gdbus_dir) $(src_cppflags) -DSYNCEVOLUTION_LOCALEDIR=\"${SYNCEVOLUTION_LOCALEDIR}\"
D-Bus server: fork/exec for sync, command line and restore operations This commit moves the blocking syncing, database restore and command line execution into a separate, short-lived process executing the syncevo-dbus-helper. The advantage is that the main syncevo-dbus-server remains responsive under all circumstances (fully asynchronous now) and suffers less from memory leaks and/or crashes during a sync. The core idea behind the new architecture is that Session remains the D-Bus facing side of a session. It continues to run inside syncevo-dbus-server and uses the syncevo-dbus-helper transparently via a custom D-Bus interface between the two processes. State changes of the helper are mirrored in the server. Later the helper might also be used multiple times in a Session. For example, anything related to loading backends should be moved into the helper (currently the "is config usable" check still runs in the syncevo-dbus-server and needs to load/initialize backends). The startup code of the helper already handles that (see boolean result of operation callback), but it is not used yet in practice. At the moment, only the helper provides a D-Bus API. It sends out signals when it needs information from the server. The server watches those and replies when ready. The helper monitors the connection to the parent and detects that it won't get an answer if that connection goes down. The problem of "helper died unexpectedly" is also handled, by not returning a D-Bus method reply until the requested operation is completed (different from the way how the public D-Bus API is defined!). The Connection class continues to use such a Session, as before. It's now fully asynchronous and exchanges messages with the helper via the Session class. Inside syncevo-dbus-server, boost::signals2 and the dbus-callbacks infrastructure for asynchronous methods execution are used heavily now. The glib event loop is entered exactly once and only left to shut down. Inside syncevo-dbus-helper, the event loop is entered only as needed. Password requests sent from syncevo-local-sync to syncevo-dbus-helper are handled asynchronously inside the event loop driven by the local transport. syncevo-dbus-helper and syncevo-local-sync are conceptually very similar. Should investigate whether a single executable can serve both functions. The AutoSyncManager was completely rewritten. The data structure is a lot simpler now (basically just a cache of transient information about a sync config and the relevant config properties that define auto syncing). The main work happens inside the schedule() call, which verifies whether a session can run and, if not possible for some reasons, ensures that it gets invoked again when that blocker is gone (timeout over, server idle, etc.). The new code also uses signals/slots instead of explicit coupling between the different classes. All code still lives inside the src/dbus/server directory. This simplifies checking differences in partly modified files like dbus-sync.cpp. A future commit will move the helper files. The syslog logger code is referenced by the server, but never used. This functionality needs further thought: - Make usage depend on command line option? Beware that test-dbus.py looks for the "ready to run" output and thus startup breaks when all output goes to syslog instead of stdout. - Redirect glib messages into syslog (done by LogRedirect, disabled when using LoggerSyslog)? The syncevo-dbus-server now sends the final "Session.StatusChanged done" signal immediately. The old implementation accidentally delayed sending that for 100 seconds. The revised test-dbus.py checks for more "session done" quit events to cover this fix. Only user-visible messages should have the INFO level in any of the helpers. Messages about starting and stopping processes are related to implementation details and thus should only have DEBUG level. The user also doesn't care about where the operation eventually runs. All messages related to it should be in INFO/DEBUG/ERROR messages without a process name. Therefore now syncevo-dbus-server logs with a process name (also makes some explicit argv[0] logging redundant; requires changes in test-dbus.py) and syncevo-dbus-helper doesn't. syncevo-local-sync is different from syncevo-dbus-helper: it produces user-relevant output (the other half of the local sync). It's output is carefully chosen so that the process name is something the user understands (target context) and output can be clearly related to one side or the other (for example, context names are included in the sync table). Output handling is based on the same idea as output handling in the syncevo-dbus-server: - Session registers itself as the top-most logger and sends SyncEvolution logging via D-Bus to the parent, which re-sends it with the right D-Bus object path as output of the session. - Output redirection catches all other output and feeds it back to the Session log handler, from where it goes via D-Bus to the parent. The advantage of this approach is that level information is made available directly to the parent and that message boundaries are preserved properly. stderr and stdout are redirected into the parent and logged there as error. Normally the child should not print anything. While it runs, LogRedirect inside it will capture output and log it internally. Anything reaching the parent thus must be from early process startup or shutdown. Almost all communication from syncevo-dbus-helper to syncevo-dbus-server is purely information for the syncevo-dbus-server; syncevo-dbus-helper doesn't care whether the signal can be delivered. The only exception is the information request, which must succeed. Instead of catching exceptions everywhere, the optional signals are declared as such in the EmitSignal template parameterization and no longer throw exceptions when something goes wrong. They also don't log anything, because that could lead to quite a lof of output.
2012-03-26 17:19:25 +02:00
src_syncevo_dbus_server_CXXFLAGS = $(PCRECPP_CFLAGS) $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) $(LIBNOTIFY_CFLAGS) $(MLITE_CFLAGS) $(SYNCEVO_WFLAGS)
src_syncevo_dbus_server_LDFLAGS = $(PCRECPP_LIBS) $(CORE_LD_FLAGS)
src_syncevo_dbus_server_DEPENDENCIES = $(builddir)/src/dbus/server/libsyncevodbusserver.la $(gdbus_build_dir)/libgdbussyncevo.la $(EXTRA_LTLIBRARIES) $(CORE_DEP) $(SYNTHESIS_DEP)
D-Bus server: fork/exec for sync, command line and restore operations This commit moves the blocking syncing, database restore and command line execution into a separate, short-lived process executing the syncevo-dbus-helper. The advantage is that the main syncevo-dbus-server remains responsive under all circumstances (fully asynchronous now) and suffers less from memory leaks and/or crashes during a sync. The core idea behind the new architecture is that Session remains the D-Bus facing side of a session. It continues to run inside syncevo-dbus-server and uses the syncevo-dbus-helper transparently via a custom D-Bus interface between the two processes. State changes of the helper are mirrored in the server. Later the helper might also be used multiple times in a Session. For example, anything related to loading backends should be moved into the helper (currently the "is config usable" check still runs in the syncevo-dbus-server and needs to load/initialize backends). The startup code of the helper already handles that (see boolean result of operation callback), but it is not used yet in practice. At the moment, only the helper provides a D-Bus API. It sends out signals when it needs information from the server. The server watches those and replies when ready. The helper monitors the connection to the parent and detects that it won't get an answer if that connection goes down. The problem of "helper died unexpectedly" is also handled, by not returning a D-Bus method reply until the requested operation is completed (different from the way how the public D-Bus API is defined!). The Connection class continues to use such a Session, as before. It's now fully asynchronous and exchanges messages with the helper via the Session class. Inside syncevo-dbus-server, boost::signals2 and the dbus-callbacks infrastructure for asynchronous methods execution are used heavily now. The glib event loop is entered exactly once and only left to shut down. Inside syncevo-dbus-helper, the event loop is entered only as needed. Password requests sent from syncevo-local-sync to syncevo-dbus-helper are handled asynchronously inside the event loop driven by the local transport. syncevo-dbus-helper and syncevo-local-sync are conceptually very similar. Should investigate whether a single executable can serve both functions. The AutoSyncManager was completely rewritten. The data structure is a lot simpler now (basically just a cache of transient information about a sync config and the relevant config properties that define auto syncing). The main work happens inside the schedule() call, which verifies whether a session can run and, if not possible for some reasons, ensures that it gets invoked again when that blocker is gone (timeout over, server idle, etc.). The new code also uses signals/slots instead of explicit coupling between the different classes. All code still lives inside the src/dbus/server directory. This simplifies checking differences in partly modified files like dbus-sync.cpp. A future commit will move the helper files. The syslog logger code is referenced by the server, but never used. This functionality needs further thought: - Make usage depend on command line option? Beware that test-dbus.py looks for the "ready to run" output and thus startup breaks when all output goes to syslog instead of stdout. - Redirect glib messages into syslog (done by LogRedirect, disabled when using LoggerSyslog)? The syncevo-dbus-server now sends the final "Session.StatusChanged done" signal immediately. The old implementation accidentally delayed sending that for 100 seconds. The revised test-dbus.py checks for more "session done" quit events to cover this fix. Only user-visible messages should have the INFO level in any of the helpers. Messages about starting and stopping processes are related to implementation details and thus should only have DEBUG level. The user also doesn't care about where the operation eventually runs. All messages related to it should be in INFO/DEBUG/ERROR messages without a process name. Therefore now syncevo-dbus-server logs with a process name (also makes some explicit argv[0] logging redundant; requires changes in test-dbus.py) and syncevo-dbus-helper doesn't. syncevo-local-sync is different from syncevo-dbus-helper: it produces user-relevant output (the other half of the local sync). It's output is carefully chosen so that the process name is something the user understands (target context) and output can be clearly related to one side or the other (for example, context names are included in the sync table). Output handling is based on the same idea as output handling in the syncevo-dbus-server: - Session registers itself as the top-most logger and sends SyncEvolution logging via D-Bus to the parent, which re-sends it with the right D-Bus object path as output of the session. - Output redirection catches all other output and feeds it back to the Session log handler, from where it goes via D-Bus to the parent. The advantage of this approach is that level information is made available directly to the parent and that message boundaries are preserved properly. stderr and stdout are redirected into the parent and logged there as error. Normally the child should not print anything. While it runs, LogRedirect inside it will capture output and log it internally. Anything reaching the parent thus must be from early process startup or shutdown. Almost all communication from syncevo-dbus-helper to syncevo-dbus-server is purely information for the syncevo-dbus-server; syncevo-dbus-helper doesn't care whether the signal can be delivered. The only exception is the information request, which must succeed. Instead of catching exceptions everywhere, the optional signals are declared as such in the EmitSignal template parameterization and no longer throw exceptions when something goes wrong. They also don't log anything, because that could lead to quite a lof of output.
2012-03-26 17:19:25 +02:00
# syncevo-dbus-server's helper binary
libexec_PROGRAMS += src/syncevo-dbus-helper
if ENABLE_UNIT_TESTS
nodist_src_syncevo_dbus_helper_SOURCES = test/test.cpp
endif
D-Bus server: fork/exec for sync, command line and restore operations This commit moves the blocking syncing, database restore and command line execution into a separate, short-lived process executing the syncevo-dbus-helper. The advantage is that the main syncevo-dbus-server remains responsive under all circumstances (fully asynchronous now) and suffers less from memory leaks and/or crashes during a sync. The core idea behind the new architecture is that Session remains the D-Bus facing side of a session. It continues to run inside syncevo-dbus-server and uses the syncevo-dbus-helper transparently via a custom D-Bus interface between the two processes. State changes of the helper are mirrored in the server. Later the helper might also be used multiple times in a Session. For example, anything related to loading backends should be moved into the helper (currently the "is config usable" check still runs in the syncevo-dbus-server and needs to load/initialize backends). The startup code of the helper already handles that (see boolean result of operation callback), but it is not used yet in practice. At the moment, only the helper provides a D-Bus API. It sends out signals when it needs information from the server. The server watches those and replies when ready. The helper monitors the connection to the parent and detects that it won't get an answer if that connection goes down. The problem of "helper died unexpectedly" is also handled, by not returning a D-Bus method reply until the requested operation is completed (different from the way how the public D-Bus API is defined!). The Connection class continues to use such a Session, as before. It's now fully asynchronous and exchanges messages with the helper via the Session class. Inside syncevo-dbus-server, boost::signals2 and the dbus-callbacks infrastructure for asynchronous methods execution are used heavily now. The glib event loop is entered exactly once and only left to shut down. Inside syncevo-dbus-helper, the event loop is entered only as needed. Password requests sent from syncevo-local-sync to syncevo-dbus-helper are handled asynchronously inside the event loop driven by the local transport. syncevo-dbus-helper and syncevo-local-sync are conceptually very similar. Should investigate whether a single executable can serve both functions. The AutoSyncManager was completely rewritten. The data structure is a lot simpler now (basically just a cache of transient information about a sync config and the relevant config properties that define auto syncing). The main work happens inside the schedule() call, which verifies whether a session can run and, if not possible for some reasons, ensures that it gets invoked again when that blocker is gone (timeout over, server idle, etc.). The new code also uses signals/slots instead of explicit coupling between the different classes. All code still lives inside the src/dbus/server directory. This simplifies checking differences in partly modified files like dbus-sync.cpp. A future commit will move the helper files. The syslog logger code is referenced by the server, but never used. This functionality needs further thought: - Make usage depend on command line option? Beware that test-dbus.py looks for the "ready to run" output and thus startup breaks when all output goes to syslog instead of stdout. - Redirect glib messages into syslog (done by LogRedirect, disabled when using LoggerSyslog)? The syncevo-dbus-server now sends the final "Session.StatusChanged done" signal immediately. The old implementation accidentally delayed sending that for 100 seconds. The revised test-dbus.py checks for more "session done" quit events to cover this fix. Only user-visible messages should have the INFO level in any of the helpers. Messages about starting and stopping processes are related to implementation details and thus should only have DEBUG level. The user also doesn't care about where the operation eventually runs. All messages related to it should be in INFO/DEBUG/ERROR messages without a process name. Therefore now syncevo-dbus-server logs with a process name (also makes some explicit argv[0] logging redundant; requires changes in test-dbus.py) and syncevo-dbus-helper doesn't. syncevo-local-sync is different from syncevo-dbus-helper: it produces user-relevant output (the other half of the local sync). It's output is carefully chosen so that the process name is something the user understands (target context) and output can be clearly related to one side or the other (for example, context names are included in the sync table). Output handling is based on the same idea as output handling in the syncevo-dbus-server: - Session registers itself as the top-most logger and sends SyncEvolution logging via D-Bus to the parent, which re-sends it with the right D-Bus object path as output of the session. - Output redirection catches all other output and feeds it back to the Session log handler, from where it goes via D-Bus to the parent. The advantage of this approach is that level information is made available directly to the parent and that message boundaries are preserved properly. stderr and stdout are redirected into the parent and logged there as error. Normally the child should not print anything. While it runs, LogRedirect inside it will capture output and log it internally. Anything reaching the parent thus must be from early process startup or shutdown. Almost all communication from syncevo-dbus-helper to syncevo-dbus-server is purely information for the syncevo-dbus-server; syncevo-dbus-helper doesn't care whether the signal can be delivered. The only exception is the information request, which must succeed. Instead of catching exceptions everywhere, the optional signals are declared as such in the EmitSignal template parameterization and no longer throw exceptions when something goes wrong. They also don't log anything, because that could lead to quite a lof of output.
2012-03-26 17:19:25 +02:00
src_syncevo_dbus_helper_SOURCES = \
$(CORE_SOURCES)
src_syncevo_dbus_helper_LDADD = $(builddir)/src/dbus/server/libsyncevodbushelper.la $(gdbus_build_dir)/libgdbussyncevo.la $(CORE_LDADD) $(DBUS_LIBS)
src_syncevo_dbus_helper_CPPFLAGS = -DHAVE_CONFIG_H -I$(gdbus_dir) $(src_cppflags) -DSYNCEVOLUTION_LOCALEDIR=\"${SYNCEVOLUTION_LOCALEDIR}\"
src_syncevo_dbus_helper_CXXFLAGS = $(PCRECPP_CFLAGS) $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) $(SYNCEVO_WFLAGS)
src_syncevo_dbus_helper_LDFLAGS = $(PCRECPP_LIBS) $(CORE_LD_FLAGS)
src_syncevo_dbus_helper_DEPENDENCIES = $(builddir)/src/dbus/server/libsyncevodbushelper.la $(gdbus_build_dir)/libgdbussyncevo.la $(EXTRA_LTLIBRARIES) $(CORE_DEP) $(SYNTHESIS_DEP)
endif # COND_DBUS
# With --disable-shared autotools links against libfunambol.a which does not
# pull any of the test suites into the test binary, so they would not be
# executed. The workaround is to explicitly set them as undefined on the
# link line.
src_client_test_SOURCES = \
src/client-test-app.cpp \
test/ClientTest.cpp \
test/ClientTest.h \
test/ClientTestAssert.h \
test/client-test-main.cpp \
$(CORE_SOURCES)
nodist_src_client_test_SOURCES = test/test.cpp
# Compiling ClientTest.cpp with autotool's default CXXFLAGS (usually
# -g -O2) is expensive (due to many templates and the large file size)
# and unnecessary - it is much better for debugging when optimization
# is off.
#
# Therefore use GNU make's "Target-specific Variable Values" to
# override CXXFLAGS for that special file. We assume that the compiler
# knows the -g flag.
#
# We have to get the target name right. The worst that happens if we
# don't is that it gets compiled with the normal CXXFLAGS. Because
# we don't know if GNU make is used, use a configure check and only
# enable this when found during configure.
#
# Note that src_client_test_CXXFLAGS cannot be used to remove
# -O2, because CXXFLAGS comes later in the final compile command.
@ifGNUmake@ $(foreach e, $(foreach i, $(src_client_test_SOURCES), $(dir $(i))src_client_test-$(basename $(notdir $i))), $(e).o $(e).lo $(e).obj) : CXXFLAGS = -g
# List of test files which get copied verbatim from
# $(top_srcdir)/test/testcases/ to src/testcases below. test/test.am
# has the list for inclusion in "make dist" with the original
# "test/" directory. We need to replace that here.
#
# Generated files (testcases/eds_event.ics.funambol.tem) are derived from
# the original base file ($(srcdir)/test/testcases/eds_event.ics) by
# applying a patch ($(srcdir)/test/testcases/eds_event.ics.funambol.tem.patch).
CLIENT_LIB_TEST_FILES = $(subst test/,src/,$(test_testcases))
# all patch files
TEST_FILES_PATCHES = $(wildcard $(top_srcdir)/test/testcases/*.patch)
# generated local files
# converts from
# $(top_srcdir)/test/testcases/eds_contact.vcf.apple.tem.patch
# to
# src/testcases/eds_contact.vcf.apple.tem
TEST_FILES_GENERATED = $(subst .patch,,$(subst $(top_srcdir)/test/,src/,$(TEST_FILES_PATCHES)))
# all patched files, regardless whether the patch already exists
TEST_FILES_PATCHED = $(wildcard src/testcases/*.tem)
# add files created via patches
CLIENT_LIB_TEST_FILES += $(TEST_FILES_GENERATED)
# client-test must link against all static utility libs which might contain
# object files with SYNCEVOLUTION_TEST_SUITE_REGISTRATION() macros.
# To pull in those object files, LDFLAGS must contain undef statements
# for the C symbols exported by the macro.
src_client_test_libs = src/syncevo/libsyncevolution.la
if COND_DBUS
src_client_test_libs += src/dbus/server/libsyncevodbushelper.la src/dbus/server/libsyncevodbusserver.la
endif
# src/syncevo/libsyncevolution.la -> src/syncevo/.libs/libsyncevolution.a -> -Wl,-u...
src_client_test_undef = $(shell nm $(patsubst %.la,%.a,$(subst /lib,/.libs/lib,$(src_client_test_libs))) | grep funambolAutoRegisterRegistry | sed -e 's/.* /-Wl,-u/' )
src_client_test_CPPFLAGS = -DHAVE_CONFIG_H -DENABLE_INTEGRATION_TESTS -DENABLE_UNIT_TESTS $(src_cppflags) $(QT_CPPFLAGS)
src_client_test_CXXFLAGS = $(filter-out -O2, @CPPUNIT_CFLAGS@ $(PCRECPP_CFLAGS) $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS) $(filter-out -O2 -g -W -Wall, $(QT_CXXFLAGS)) $(SYNCEVO_WFLAGS))
src_client_test_LDFLAGS = @CPPUNIT_LIBS@ $(src_client_test_undef) $(CORE_LD_FLAGS) $(QT_LDFLAGS)
src_client_test_LDADD = $(src_client_test_libs) $(CORE_LDADD) $(PCRECPP_LIBS) $(SYNTHESIS_ENGINE) $(QT_LIBS)
# These dependencies are intentionally a bit too broad:
# they ensure that all files are in place to *run* client-test.
# rule to generate patched files from patches:
# make cannot compute the dependencies completely, so run the commands
# on each make invocation and do the time stamp test ourselves
#
# If we create the patched file anew, then set its time to the more
# recent of the two input files. That way it won't be re-generated
# (because it is not older), and it won't be used to refresh the patch
# either in testcase2patch (because it is not newer either).
# That is useful on platforms where diff produces different results
# than the one in the source (possible because the "find shortest
# patch" problem may have multiple solutions).
all_phonies += $(TEST_FILES_GENERATED)
$(TEST_FILES_GENERATED):
@ set -e \
&& mkdir -p 'src/testcases' \
&& echo 'checking whether server specific test case $@ is up-to-date'; \
patchfile='$(top_srcdir)/test/$(subst src/,,$@).patch'; \
basefile='$(top_srcdir)/test/$(subst src/,,$(basename $(basename $@)))'; \
( [ -e '$@' ] && [ ! '$@' -ot "$$patchfile" ] && [ ! $@ -ot "$$basefile" ] && echo ' $@ up-to-date' ) || \
( [ ! -s "$$patchfile" ] && echo " copy $$basefile to $@ because patch file is empty" && cp "$$basefile" '$@' ) || \
( echo " generating $@ by applying $$patchfile to $$basefile" && \
(echo '*** foo'; echo '--- bar'; cat "$$patchfile") | patch -s -o '$@' "$$basefile" && \
( if [ "$$basefile" -ot "$$patchfile" ]; then \
touch -r "$$patchfile" '$@'; else \
touch -r "$$basefile" '$@'; fi ) \
)
# rule to regenerate patches:
# like generating the patched files, this is run every time.
# It must avoid making the patch file more recent than the
# patched file, otherwise the rule above would needlessly recreate
# it (not nice when having the file open in an editor).
#
# To avoid needlessly updating the content of the patch file,
# the first two lines with changing information (paths, file dates)
# are stripped from it.
all_phonies += testcase2patch
testcase2patch: $(TEST_FILES_GENERATED)
@ set -e \
&& echo 'checking whether test case patch files are up-to-date'; \
for i in src/testcases/*.tem; do \
temfile=`echo "$$i" | cut -d / -f 2-` \
patchfile="$(top_srcdir)/test/$$temfile.patch"; \
basefile="$(top_srcdir)/test/`echo $$temfile | cut -d . -f -2`"; \
if [ "$$patchfile" -ot "$$i" ] || [ "$$patchfile" -ot "$$basefile" ]; \
then \
diff -u "$$basefile" "$$i" | tail -n +3 > "$$patchfile" || true; \
touch -r "$$i" "$$patchfile"; \
echo " updated $$patchfile"; \
else \
echo " $$patchfile up-to-date"; \
fi; \
done
# generate syntax-highlighted version of ClientTest.cpp for HTML
# version of .log test results
nodist_noinst_DATA += src/ClientTest.cpp.html
CLEANFILES += src/ClientTest.cpp.html
src/ClientTest.cpp.html: build/source2html.py test/ClientTest.cpp
$(AM_V_GEN)python $+ >$@
# copy base test files
$(filter-out %.tem, $(filter src/testcases/%, $(subst $(top_srcdir)/test/,src/,$(CLIENT_LIB_TEST_FILES)))) : src/% : $(top_srcdir)/test/%
$(AM_V_at)mkdir -p '$(dir $@)'; \
cp '$<' '$@'
# The binary does not really depend on the test cases, only running it does.
# Listing the dependencies here is done to ensure that one doesn't accidentally
# runs the binary with out-dated auxiliary files.
src_client_test_DEPENDENCIES = $(EXTRA_LTLIBRARIES) $(src_client_test_libs) $(CORE_DEP) $(CLIENT_LIB_TEST_FILES) testcase2patch src/synccompare src/synclog2html src/templates
# Copy template directory into current working directory, if not there
# yet. -ef flag checks whether device and inode numbers of both files
# are equal. If such check passes then it does mean that it is either
# the same file or one of them is symlink to another. So if this is a
# symlink, then it is fine - that is what we want. If this is the same
# file then also it is fine - that means that we built the project in
# the same directory as source.
all_phonies += src/templates
src/templates:
$(AM_V_at)if test ! '$(top_srcdir)/src/templates' -ef '$(top_builddir)/src/templates'; \
then \
rm -rf src/templates; \
ln -s '$(abs_top_srcdir)/src/templates' 'src/templates'; \
fi
# distribute test system?
if ENABLE_TESTING
# yes: install client-test and test files in testdir
test_PROGRAMS += src/client-test
include $(top_srcdir)/src/testcases.am
else
# The "all" dependency causes a rebuild even if the actual input files
# haven't changed. If client-test is part of the regular targets built
# by "all", then it must not depend on all!
EXTRA_PROGRAMS += src/client-test
nodist_src_client_test_SOURCES += $(CLIENT_LIB_TEST_FILES)
src_client_test_DEPENDENCIES += all
endif
# test program for output redirection, has to be built
# and run manually
EXTRA_PROGRAMS += src/abort-redirect
CLEANFILES += src/abort-redirect.log
src_abort_redirect_SOURCES = test/abort-redirect.cpp
src_abort_redirect_CPPFLAGS = -DHAVE_CONFIG_H $(src_cppflags)
src_abort_redirect_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS) $(SYNCEVO_WFLAGS)
src_abort_redirect_LDFLAGS = $(CORE_LD_FLAGS)
src_abort_redirect_LDADD = $(CORE_LDADD)
src_abort_redirect_DEPENDENCIES = all
# special target for testing with valgrind
valgrind : src/test
valgrind --leak-check=yes --suppressions=valgrind.supp src/client-test
# old-style name for test program(s)
all_phonies += test valgrind
src/test: src/client-test