summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@gmx.de>2008-01-29 19:21:19 +0000
committerPatrick Ohly <patrick.ohly@gmx.de>2008-01-29 19:21:19 +0000
commita773814a309604ba85dbaafc181e89ed88243101 (patch)
treecc414a50f8c57a313cf0167e3d5baacbc64548b1 /debian
parentda7022963b1fc48403acb41e23b9d9896fa6b2ac (diff)
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
Diffstat (limited to 'debian')
-rw-r--r--debian/dbus-wrapper.cpp39
-rwxr-xr-xdebian/rules9
2 files changed, 43 insertions, 5 deletions
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 <dlfcn.h>
+
+/**
+ * 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[=<absolute path to directory which contains patched libdbus-1.a/so>]: 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