From a773814a309604ba85dbaafc181e89ed88243101 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 29 Jan 2008 19:21:19 +0000 Subject: replaced linking against modified libdbus with a wrapper for the relevant dbus function The wrapper for dbus_connection_send_with_reply() sets the increased timeout if necessary, then calls the original implementation via dlsym(RTLD_NEXT). This ensures that always the right libdbus of the host system is used, which is necessary for ITOS2008 (which has a version which is incompatible with ITOS2007/06). git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@488 15ad00c4-1369-45f4-8270-35d70d36bdcd --- debian/dbus-wrapper.cpp | 39 +++++++++++++++++++++++++++++++++++++++ debian/rules | 9 ++++----- 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 debian/dbus-wrapper.cpp (limited to 'debian') diff --git a/debian/dbus-wrapper.cpp b/debian/dbus-wrapper.cpp new file mode 100644 index 00000000..86a02926 --- /dev/null +++ b/debian/dbus-wrapper.cpp @@ -0,0 +1,39 @@ + +#include + +/** + * There are valid use cases where the (previously hard-coded) default + * timeout was too short. This function replaces _DBUS_DEFAULT_TIMEOUT_VALUE + * and - if set - interprets the content of DBUS_DEFAULT_TIMEOUT as + * number of milliseconds. + */ +static int _dbus_connection_default_timeout(void) +{ + const char *def = getenv("DBUS_DEFAULT_TIMEOUT"); + int timeout = 0; + + if (def) { + timeout = atoi(def); + } + if (timeout <= 0) { + /* the traditional _DBUS_DEFAULT_TIMEOUT_VALUE */ + timeout = 25 * 1000; + } +} + +extern "C" int +dbus_connection_send_with_reply (void *connection, + void *message, + void **pending_return, + int timeout_milliseconds) +{ + static typeof(dbus_connection_send_with_reply) *real_func; + + if (!real_func) { + real_func = (typeof(dbus_connection_send_with_reply) *)dlsym(RTLD_NEXT, "dbus_connection_send_with_reply"); + } + return real_func ? + real_func(connection, message, pending_return, + timeout_milliseconds == -1 ? _dbus_connection_default_timeout() : timeout_milliseconds) : + 0; +} diff --git a/debian/rules b/debian/rules index 52c33cc0..37d2a202 100755 --- a/debian/rules +++ b/debian/rules @@ -12,7 +12,7 @@ # options that can be added to DEB_BUILD_OPTIONS: # - noopt: compile with -O0 -# - maemo[=]: enable maemo hacks +# - maemo: enable maemo hacks # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -39,10 +39,6 @@ ifneq (,$(findstring maemo,$(DEB_BUILD_OPTIONS))) CONFIGURE_FLAGS += --enable-maemo --enable-shared endif -ifneq (,$(findstring maemo=,$(DEB_BUILD_OPTIONS))) - CONFIGURE_FLAGS += --with-patched-libdbus=$(subst maemo=,,$(filter maemo=%,$(DEB_BUILD_OPTIONS))) -endif - config.status: configure dh_testdir # --enable-shared added to build SyncEvolution backends as modules, @@ -53,6 +49,9 @@ config.status: configure # no effect if it comes after the libs, which is where libtool 1.5.24 puts it # normally perl -pi -e 's/-shared (.*) \\\$$compiler_flags/-shared \\\$$compiler_flags $$1/' libtool + # add dbus wrapper which overrides the default timeout: only required if not yet + # in upstream source (it wasn't in the 0.7 source snapshot) + grep dbus_connection_send_with_reply src/EvolutionSyncClient.cpp >/dev/null || cat debian/dbus-wrapper.cpp >>src/EvolutionSyncClient.cpp #Architecture build: build-arch build-indep -- cgit v1.2.3