diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2016-09-20 08:19:08 -0700 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2016-09-26 12:58:26 +0200 |
commit | 426ec3543a035dfc4bd5f03dd5f02e2870d658b7 (patch) | |
tree | 3791642bbd04f6ad70115808ef6efc9ad9a4e570 | |
parent | 405ca882ebb357035c2fe0919c001eff0f37cfd5 (diff) |
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.
-rw-r--r-- | Makefile.am | 45 | ||||
-rw-r--r-- | configure.ac | 26 | ||||
-rw-r--r-- | src/backends/evolution/EvolutionCalendarSourceRegister.cpp | 3 | ||||
-rw-r--r-- | src/backends/evolution/EvolutionContactSource.cpp | 8 | ||||
-rw-r--r-- | src/backends/evolution/EvolutionContactSourceRegister.cpp | 5 | ||||
-rw-r--r-- | src/backends/webdav/WebDAVSourceRegister.cpp | 6 | ||||
-rw-r--r-- | src/dbus/server/server.cpp | 25 | ||||
-rw-r--r-- | src/shlibs.local | 13 | ||||
-rw-r--r-- | src/src.am | 12 | ||||
-rw-r--r-- | src/syncevo/ObexTransportAgent.cpp | 12 | ||||
-rw-r--r-- | src/syncevo/eds_abi_wrapper.cpp | 461 | ||||
-rw-r--r-- | src/syncevo/eds_abi_wrapper.h | 676 | ||||
-rw-r--r-- | src/syncevo/icalstrdup.c | 16 | ||||
-rw-r--r-- | src/syncevo/icalstrdup.h | 4 | ||||
-rw-r--r-- | src/syncevo/icaltz-util-wrapper.c | 42 | ||||
-rw-r--r-- | src/syncevo/icaltz-util.c | 15 | ||||
-rw-r--r-- | src/syncevo/icaltz-util.h | 2 | ||||
-rwxr-xr-x | src/syncevo/installcheck-local.sh | 5 | ||||
-rw-r--r-- | src/syncevo/syncevo.am | 36 |
19 files changed, 165 insertions, 1247 deletions
diff --git a/Makefile.am b/Makefile.am index c7a04031..be40ddbb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -141,7 +141,7 @@ else REQUIRES_deb_neon = endif if ENABLE_ICAL -REQUIRES_deb_ical = , libical0 | libical1 | libical1a +REQUIRES_deb_ical = , libical0 | libical1 | libical1a | libical2 endif VERSION_deb = 1:$(STABLE_VERSION)$(VERSION) VERSION_rpm = `echo $(VERSION) | sed -e s/-/_/g` @@ -211,11 +211,8 @@ PLATFORM_FILES_kde = platformkde syncakonadi # Additional parameters for syncevolution-kde/evolution.deb. # Fake conflicts/replaces works around a bug in CheckInstall, # which creates empty, invalid entries for those unless -# something is given. For Evolution we hard-code dependencies -# (because with EDS compatibility turned on, several -# alternatives will work at runtime) and conflict with -# EDS 3.6, because that breaks the API and does not work for us -# at the moment. +# something is given. For Evolution we expect the caller +# to provide the actual dependencies. SYNCEVOLUTION_kde_DEB_ARGS = \ --conflicts=syncevolution-foobar \ --replaces=syncevolution-foobar @@ -223,8 +220,8 @@ SYNCEVOLUTION_evolution_DEB_ARGS = \ --conflicts=syncevolution-foobar \ --replaces=syncevolution-foobar SYNCEVOLUTION_evolution_DEB_REQUIRES = \ - , libebook1.2-5 | libebook1.2-6 | libebook1.2-7 | libebook1.2-8 | libebook1.2-9 | libebook1.2-10 | libebook1.2-11 | libebook-1.2-11 | libebook-1.2-12 | libebook-1.2-13 $(EXTRA_BACKENDS_EBOOK_REQUIRES) \ - , libecal1.2-3 | libecal1.2-4 | libecal1.2-5 | libecal1.2-6 | libecal1.2-7 | libecal1.2-8 | libecal1.2-9 | libecal1.2-10 | libecal-1.2-10 | libecal-1.2-11 $(EXTRA_BACKENDS_ECAL_REQUIRES) + , $(EXTRA_BACKENDS_EBOOK_REQUIRES) \ + , $(EXTRA_BACKENDS_ECAL_REQUIRES) syncevolution-%-deb: checkinstall/dist/$(distdir) checkinstall/dist/debian/control (echo "SyncEvolution - meta package for $*" && cat $(srcdir)/description) >checkinstall/description-pak @@ -296,29 +293,6 @@ dot_dist_hook: echo 'A git checkout is required to generate a ChangeLog.' >&2; \ fi -if ENABLE_EVOLUTION_COMPATIBILITY -# check .so (relevant for modular builds) and main syncevolution binary -# (relevant in that case and for static builds) for dependencies on -# problematic libraries and symbols -# -# Exclude *-[0-9].so, these are EXTRA_BACKENDS for which other rules apply. -# -# ical_strdup is an exception because it is in SyncEvolution. -all_local_installchecks += toplevel_so_check -toplevel_so_check: - for i in `find $(DESTDIR)/$(libdir)/syncevolution $(DESTDIR)/$(libdir)/libsyncevo* $(DESTDIR)/$(libdir)/libsynthesis* -name *.so | grep -v -e -[0-9].so` $(DESTDIR)/$(bindir)/syncevolution; \ - do \ - if objdump -T -C $$i | grep -v :: | grep '\*UND\*' | sort | grep -v -w ical_strdup | grep -e ical -e " e_"; then \ - echo "$$i should not depend on EDS, libical or libbluetooth"; \ - exit 1; \ - fi; \ - if ldd $$i | grep -e libecal -e libebook -e libedata -e libical -e libbluetooth; then \ - echo "$$i should not be linked against EDS, libical or libbluetooth"; \ - exit 1; \ - fi; \ - done -endif - # Check that no executable or shared object depends on symbols in # libraries that it does not link against. Unnecessarily linking # against libs is okay, that can be caught and fixed by @@ -359,6 +333,11 @@ LINK_CHECK_ALLOWED += -e 'symbol ne_.*syncdav.so' # the release archive. LINK_CHECK_ALLOWED += -e '@GLIBCXX_[^ ]* used by' endif +# libgdbussyncevo uses some symbols from libsyncevolution without +# linking against it (circular dependency). +LINK_CHECK_ALLOWED += -e SyncEvo.*libgdbussyncevo -e gsignond_pipe_stream_new.*libgdbussyncevo + +LINK_CHECK_ALLOWED += $(EXTRA_LINK_CHECK_ALLOWED) # Be strict about running 'syncevolution' only when not doing # cross-compilation: in that case, if running 'syncevolution' fails, @@ -414,6 +393,9 @@ dist-hook: $(all_dist_hooks) install-exec-hook: $(all_install_exec_hooks) uninstall-hook: $(all_uninstall_hooks) +# Can be overridden during make invocation to inject additional commands. +CREATE_EXTRA_BACKENDS=true + # Force sequential installation. This is a workaround for relinking failures # during concurrent distcheck (a backend was relinked against not yet installed # libsyncevolution.la). @@ -424,6 +406,7 @@ uninstall-hook: $(all_uninstall_hooks) install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am @$(MAKE) $(AM_MAKEFLAGS) install-data-am + $(CREATE_EXTRA_BACKENDS) $(DESTDIR)/$(BACKENDS_DIRECTORY) for i in $(EXTRA_BACKENDS); do $(INSTALL) $$i $(DESTDIR)/$(BACKENDS_DIRECTORY)/; done # Necessary for "make distcheck": must not leave files behind. diff --git a/configure.ac b/configure.ac index c0f3619b..5222c9e8 100644 --- a/configure.ac +++ b/configure.ac @@ -992,9 +992,10 @@ fi dnl check for libical if needed by backend or icaltz-util. if test "$need_ical" = "yes" || test "$enable_icaltz_util" = "yes"; then - PKG_CHECK_MODULES(LIBICAL, libical, - [true], - [PKG_CHECK_MODULES(LIBICAL, libecal-1.2)]) + PKG_CHECK_MODULES(LIBICAL, libical) + PKG_CHECK_MODULES(LIBICAL_AVAILABLE, libical >= 0.43, + [AC_DEFINE(HAVE_LIBICAL_R, 1, [have recent enough libical with _r variants])], + [true]) fi dnl Use libical in eds_abi_wrapper if and only if required by some backend. @@ -1047,24 +1048,6 @@ if test "$host" = "arm-apple-darwin"; then DEVICE_TYPE=iPhone fi -dnl --enable-evolution-compatibility -if test "$enable_evolution_compatibility" = "yes"; then - AC_DEFINE(EVOLUTION_COMPATIBILITY, 1, [avoid hard dependency on Evolution shared objects]) - # don't link against libs wrapped by eds_abi_wrapper (no longer limited to EDS alone...) - ECAL_LIBS= - EBOOK_LIBS= - EPACKAGE_LIBS= - BLUEZ_LIBS= -fi -if test "$enable_evolution_compatibility" = "ical" || test "$enable_evolution_compatibility" = "yes"; then - AC_DEFINE(EVOLUTION_ICAL_COMPATIBILITY, 1, [work with both libical.so.0 and libical.so.1]) -fi -AM_CONDITIONAL([ENABLE_EVOLUTION_COMPATIBILITY], [test "$enable_evolution_compatibility" = "yes"]) -PKG_CHECK_MODULES(LIBICAL_AVAILABLE, - libical >= 0.43, - AC_DEFINE(HAVE_LIBICAL_R, 1, [have recent enough libical with _r variants]), - pass) - dnl --enable-developer-mode if test "$enable_developer_mode" = "yes"; then BACKENDS_SEARCH_DIRECTORY="`pwd`/src/backends/" @@ -1145,6 +1128,7 @@ echo "Core SyncEvolution: $enable_core" for backend in $BACKENDS; do eval echo $backend: \${enable_${backend}} done +echo "libical v1 timezone hack: $enable_icaltz_util" echo "DBus service: $enable_dbus_service" echo "org._01.pim support in DBus service: $enable_dbus_pim" echo "Notifications: $enable_notify" diff --git a/src/backends/evolution/EvolutionCalendarSourceRegister.cpp b/src/backends/evolution/EvolutionCalendarSourceRegister.cpp index 26543fc2..5f909ae7 100644 --- a/src/backends/evolution/EvolutionCalendarSourceRegister.cpp +++ b/src/backends/evolution/EvolutionCalendarSourceRegister.cpp @@ -31,10 +31,9 @@ static SyncSource *createSource(const SyncSourceParams ¶ms) { SourceType sourceType = SyncSource::getSourceType(params.m_nodes); bool isMe; - bool enabled; + const bool enabled = true; EDSAbiWrapperInit(); - enabled = EDSAbiHaveEcal && EDSAbiHaveEdataserver; isMe = sourceType.m_backend == "Evolution Task List"; if (isMe || sourceType.m_backend == "todo") { diff --git a/src/backends/evolution/EvolutionContactSource.cpp b/src/backends/evolution/EvolutionContactSource.cpp index d96cebec..5afb0e90 100644 --- a/src/backends/evolution/EvolutionContactSource.cpp +++ b/src/backends/evolution/EvolutionContactSource.cpp @@ -875,12 +875,8 @@ void EvolutionContactSource::readItem(const string &luid, std::string &item, boo // The function for doing the inlining was added in EDS 3.4. // In compatibility mode, we must check the function pointer for non-NULL. // In direct call mode, the existence check is done by configure. - if (raw -#ifdef EVOLUTION_COMPATIBILITY - && e_contact_inline_local_photos -#endif - ) { -#if defined(EVOLUTION_COMPATIBILITY) || defined(HAVE_E_CONTACT_INLINE_LOCAL_PHOTOS) + if (raw) { +#if defined(HAVE_E_CONTACT_INLINE_LOCAL_PHOTOS) if (!e_contact_inline_local_photos(contactptr, gerror)) { throwError(SE_HERE, string("inlining PHOTO file data in ") + luid, gerror); } diff --git a/src/backends/evolution/EvolutionContactSourceRegister.cpp b/src/backends/evolution/EvolutionContactSourceRegister.cpp index c063b546..f7946626 100644 --- a/src/backends/evolution/EvolutionContactSourceRegister.cpp +++ b/src/backends/evolution/EvolutionContactSourceRegister.cpp @@ -29,11 +29,10 @@ static SyncSource *createSource(const SyncSourceParams ¶ms) SourceType sourceType = SyncSource::getSourceType(params.m_nodes); bool isMe = sourceType.m_backend == "Evolution Address Book"; bool maybeMe = sourceType.m_backend == "addressbook"; - bool enabled; + const bool enabled = true; EDSAbiWrapperInit(); - enabled = EDSAbiHaveEbook && EDSAbiHaveEdataserver; - + if (isMe || maybeMe) { if (sourceType.m_format == "text/x-vcard") { return diff --git a/src/backends/webdav/WebDAVSourceRegister.cpp b/src/backends/webdav/WebDAVSourceRegister.cpp index b6203a42..c9587997 100644 --- a/src/backends/webdav/WebDAVSourceRegister.cpp +++ b/src/backends/webdav/WebDAVSourceRegister.cpp @@ -62,10 +62,8 @@ static SyncSource *createSource(const SyncSourceParams ¶ms) if (enabled) { boost::shared_ptr<Neon::Settings> settings; if (sourceType.m_backend == "CalDAV") { - if (EDSAbiHaveIcal) { - boost::shared_ptr<SubSyncSource> sub(new CalDAVSource(params, settings)); - return new MapSyncSource(params, sub); - } + boost::shared_ptr<SubSyncSource> sub(new CalDAVSource(params, settings)); + return new MapSyncSource(params, sub); } else { return new CalDAVVxxSource(sourceType.m_backend == "CalDAVTodo" ? "VTODO" : "VJOURNAL", params, settings); diff --git a/src/dbus/server/server.cpp b/src/dbus/server/server.cpp index a3d1135e..8bcc6b4e 100644 --- a/src/dbus/server/server.cpp +++ b/src/dbus/server/server.cpp @@ -696,6 +696,19 @@ void Server::dequeue(Session *session) sessionChanged(session->getPath(), false); m_activeSession = NULL; m_activeSessionRef.reset(); + if (m_lastFileMod && !m_shutdownTimer) { + // File modification was detected while a session was active. + // Trigger the shutdown now that it is gone. As without a + // a session, the goal is to shut down SHUTDOWN_QUIESENCE_SECONDS + // after the last file modification. + Timespec now = Timespec::monotonic(); + Timespec shutdown = m_lastFileMod + SHUTDOWN_QUIESENCE_SECONDS; + if (shutdown >= now) { + SE_LOG_DEBUG(NULL, "file modified, initiating shutdown after session finished"); + m_shutdownTimer.activate((shutdown - now).seconds(), + boost::bind(&Server::shutdown, this)); + } + } checkQueue(); } @@ -757,9 +770,15 @@ void Server::checkQueue() // Don't schedule new sessions. Instead return to Server::run(). // But don't do it immediately: when done inside the Session.Detach() // call, the D-Bus response was not delivered reliably to the client - // which caused the shutdown. - SE_LOG_DEBUG(NULL, "shutting down in checkQueue(), idle and shutdown was requested"); - addTimeout(boost::bind(quitLoop, m_loop), 0); + // which caused the shutdown. When Server::fileModified() already set + // a timeout then we don't need to do it again (solves a race + // condition in test-dbus.py's testSession2: without this check, + // if the file modification is detected before handling the Detach(), + // then the server shut down immediately after Detach()). + if (!m_shutdownTimer) { + SE_LOG_DEBUG(NULL, "shutting down in checkQueue(), idle and shutdown was requested"); + addTimeout(boost::bind(quitLoop, m_loop), 0); + } return; } diff --git a/src/shlibs.local b/src/shlibs.local index 835862c0..ae955d3c 100644 --- a/src/shlibs.local +++ b/src/shlibs.local @@ -1,6 +1,7 @@ -# Evolution 2.8 -libedataserver-1.2 5 libedataserver1.2-7 -libecal-1.2 7 libecal1.2-7 -libebook-1.2 9 libebook1.2-9 -# Evolution 2.10/12 -libedataserver-1.2 9 libedataserver1.2-9 +# Evolution 3.10 +libebook-1.2 14 +libebook-contacts-1.2 0 +libecal-1.2 16 +libedataserver-1.2 18 +# libical v1 +libical 1 @@ -96,10 +96,10 @@ 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 -# Force inclusion of our own icaltz-util.o into binaries even though -# we do not call the icaltzutil_fetch_timezone directly ourself. -# That way it is there if or when libical needs it. -CORE_LD_FLAGS += -Wl,-usyncevo_fetch_timezone +# 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 @@ -239,7 +239,6 @@ endif # COND_DBUS src_client_test_SOURCES = \ src/client-test-app.cpp \ test/ClientTest.cpp \ - test/IcalTest.cpp \ test/ClientTest.h \ test/ClientTestAssert.h \ test/client-test-main.cpp \ @@ -303,9 +302,6 @@ src_client_test_CPPFLAGS = -DHAVE_CONFIG_H -DENABLE_INTEGRATION_TESTS -DENABLE_U 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) -if !ENABLE_EVOLUTION_COMPATIBILITY -src_client_test_LDADD += $(LIBICAL_LIBS) -endif # These dependencies are intentionally a bit too broad: # they ensure that all files are in place to *run* client-test. diff --git a/src/syncevo/ObexTransportAgent.cpp b/src/syncevo/ObexTransportAgent.cpp index f0d28dc7..3c5fe0f2 100644 --- a/src/syncevo/ObexTransportAgent.cpp +++ b/src/syncevo/ObexTransportAgent.cpp @@ -103,14 +103,6 @@ void ObexTransportAgent::connect() { m_obexReady = false; if(m_transType == OBEX_BLUETOOTH) { if(m_port == -1) { - EDSAbiWrapperInit(); - // sdp_connect may be a pointer when EVOLUTION_COMPATIBILITY is enabled. - // Must check whether we really have an implementation of the sdp_ calls - // before using them. - if (!SyncEvoHaveLibbluetooth) { - SE_THROW_EXCEPTION (TransportException, "no suitable libbluetooth found, try setting Bluetooth channel manually (obex-bt://<mac>+<channel>)"); - } - //use sdp to detect the appropriate channel //Do not use BDADDR_ANY to avoid a warning bdaddr_t bdaddr, anyaddr ={{0,0,0,0,0,0}}; @@ -511,7 +503,7 @@ void ObexTransportAgent::sdp_callback_impl (uint8_t type, uint16_t status, uint8 int seqSize = 0; uint8_t dtdp; -#if defined(HAVE_BLUEZ_SAFE) || defined(EVOLUTION_COMPATIBILITY) +#if defined(HAVE_BLUEZ_SAFE) scanned = sdp_extract_seqtype_safe(rsp, bufSize, &dtdp, &seqSize); #elif defined(HAVE_BLUEZ_BUFSIZE) scanned = sdp_extract_seqtype(rsp, bufSize, &dtdp, &seqSize); @@ -530,7 +522,7 @@ void ObexTransportAgent::sdp_callback_impl (uint8_t type, uint16_t status, uint8 int recSize; recSize = 0; -#if defined(HAVE_BLUEZ_SAFE) || defined(EVOLUTION_COMPATIBILITY) +#if defined(HAVE_BLUEZ_SAFE) rec = sdp_extract_pdu_safe(rsp, bufSize, &recSize); #elif defined(HAVE_BLUEZ_BUFSIZE) rec = sdp_extract_pdu(rsp, bufSize, &recSize); diff --git a/src/syncevo/eds_abi_wrapper.cpp b/src/syncevo/eds_abi_wrapper.cpp index 5b80ab91..40d4e90a 100644 --- a/src/syncevo/eds_abi_wrapper.cpp +++ b/src/syncevo/eds_abi_wrapper.cpp @@ -27,153 +27,11 @@ #include <stdarg.h> #include <syncevo/declarations.h> -using namespace std; namespace { - static std::string &getLookupDebug() { static std::string lookupDebug; return lookupDebug; } static std::string &getLookupInfo() { static std::string lookupInfo; return lookupInfo; } - -} - -#ifdef EVOLUTION_COMPATIBILITY - -struct EDSAbiWrapper EDSAbiWrapperSingleton; - -namespace { - -enum { - FIND_SYMBOLS_NEED_ALL = 1<<0, /**< all symbols must be present for findSymbols() to succeed */ - FIND_SYMBOLS_LENIENT_MAX_VERSION = 1<<1 /**< also allow libs with higher version, with extra warning */ -}; - - -/** - * Opens a <basename>.<num> shared object with <num> coming from a - * range of known compatible versions, falling back to even more - * recent ones only after warning about it. Then searches for - * function pointers. - * - * Either all or none of the function pointers are set. - * - * End user information and debug information are added to - * lookupDebug and lookupInfo. - * - * @param libname full name including .so suffix; .<num> gets appended - * @param minver first known compatible version - * @param maxver last known compatible version - * @param flags controls specific features - * @retval realver found version - * @return dlhandle which must be kept or freed by caller - */ -void *findSymbols(const char *libname, int minver, int maxver, - int flags, int *realver, ... /* function pointer address, name, ..., (void *)0 */) -{ - void *dlhandle = NULL; - std::ostringstream debug, info; - int ver; - - if (!dlhandle) { - for (ver = maxver; - ver >= minver; - --ver) { - std::ostringstream soname; - soname << libname << "." << ver; - dlhandle = dlopen(soname.str().c_str(), RTLD_GLOBAL|RTLD_LAZY); - if (dlhandle) { - info << "using " << soname.str() << std::endl; - break; - } - } - } - - if (!dlhandle && (flags & FIND_SYMBOLS_LENIENT_MAX_VERSION)) { - for (ver = maxver + 1; - ver < maxver + 50; - ++ver) { - std::ostringstream soname; - soname << libname << "." << ver; - dlhandle = dlopen(soname.str().c_str(), RTLD_GLOBAL|RTLD_LAZY); - if (dlhandle) { - info << "using " << soname.str() << " - might not be compatible!" << std::endl; - break; - } - } - } - - if (realver) { - *realver = ver; - } - - if (!dlhandle) { - debug << libname << " not found (tried major versions " << minver << " to " << maxver + 49 << ")" << std::endl; - } else { - bool allfound = true; - - va_list ap; - va_start(ap, realver); - void **funcptr = va_arg(ap, void **); - const char *symname = NULL; - while (funcptr) { - symname = va_arg(ap, const char *); - // Don't overwrite address already found earlier. Needed - // for icaltimezone_get_component(), which may be - // overridden by ourselves. - if (!*funcptr) { - *funcptr = dlsym(dlhandle, symname); - if (!*funcptr) { - debug << symname << " not found" << std::endl; - allfound = false; - } - } - funcptr = va_arg(ap, void **); - } - va_end(ap); - - if (!allfound && (flags & FIND_SYMBOLS_NEED_ALL)) { - /* unusable, clear symbols and free handle */ - va_start(ap, realver); - funcptr = va_arg(ap, void **); - while (funcptr) { - va_arg(ap, const char *); - *funcptr = NULL; - funcptr = va_arg(ap, void **); - } - va_end(ap); - - info << libname << " unusable, required function no longer available" << std::endl; - dlclose(dlhandle); - dlhandle = NULL; - } - } - - getLookupInfo() += info.str(); - getLookupDebug() += info.str(); - getLookupDebug() += debug.str(); - return dlhandle; } -# ifdef HAVE_EDS - void *edshandle; -# endif -# ifdef ENABLE_EBOOK - void *ebookhandle; -# endif -# ifdef ENABLE_ECAL - void *ecalhandle; -# endif -# ifdef ENABLE_BLUETOOTH - void *libbluetoothhandle; - sdp_record_t *wrap_sdp_extract_pdu(const uint8_t *pdata, int bufsize, int *scanned) { return EDSAbiWrapperSingleton.sdp_extract_pdu(pdata, scanned); } - int wrap_sdp_extract_seqtype(const uint8_t *buf, int bufsize, uint8_t *dtdp, int *size) { return EDSAbiWrapperSingleton.sdp_extract_seqtype(buf, dtdp, size); } -# endif - -} - -int EDSAbiHaveEbook, EDSAbiHaveEcal, EDSAbiHaveEdataserver; -int EDSAbiHaveIcal; -int EDSAbiHaveIcal1; -int SyncEvoHaveLibbluetooth; - extern "C" void EDSAbiWrapperInit() { static bool initialized; @@ -184,310 +42,25 @@ extern "C" void EDSAbiWrapperInit() initialized = true; } - // Bind icaltimezone_get_component() to the version found (or not found, - // if internal-icaltz not configured) in our own executable. - void *get = dlsym(RTLD_DEFAULT, "icaltimezone_get_component"); - getLookupDebug() += SyncEvo::StringPrintf("icaltimezone_get_component = %p", get); -#if defined(ENABLE_ECAL) || defined(ENABLE_ICAL) - EDSAbiWrapperSingleton.icaltimezone_get_component = (icalcomponent *(*)(icaltimezone *))get; -#endif - -# ifdef HAVE_EDS - edshandle = - findSymbols("libedataserver-1.2.so", 7, 16, - FIND_SYMBOLS_NEED_ALL, NULL, - &EDSAbiWrapperSingleton.e_source_get_type, "e_source_get_type", - &EDSAbiWrapperSingleton.e_source_get_uri, "e_source_get_uri", - &EDSAbiWrapperSingleton.e_source_group_get_type, "e_source_group_get_type", - &EDSAbiWrapperSingleton.e_source_group_peek_sources, "e_source_group_peek_sources", - &EDSAbiWrapperSingleton.e_source_list_peek_groups, "e_source_list_peek_groups", - &EDSAbiWrapperSingleton.e_source_peek_name, "e_source_peek_name", - (void *)0); - EDSAbiHaveEdataserver = EDSAbiWrapperSingleton.e_source_group_peek_sources != 0; -# endif // HAVE_EDS - -# ifdef ENABLE_EBOOK - static const int libebookMinVersion = 5, - libebookMaxVersion = 13; // EDS 3.4 - ebookhandle = - findSymbols("libebook-1.2.so", libebookMinVersion, libebookMaxVersion, - FIND_SYMBOLS_NEED_ALL, NULL, - &EDSAbiWrapperSingleton.e_book_add_contact, "e_book_add_contact", - &EDSAbiWrapperSingleton.e_book_authenticate_user, "e_book_authenticate_user", - &EDSAbiWrapperSingleton.e_book_commit_contact, "e_book_commit_contact", - &EDSAbiWrapperSingleton.e_contact_duplicate, "e_contact_duplicate", - &EDSAbiWrapperSingleton.e_contact_get_const, "e_contact_get_const", - &EDSAbiWrapperSingleton.e_contact_get, "e_contact_get", - &EDSAbiWrapperSingleton.e_contact_name_free, "e_contact_name_free", - &EDSAbiWrapperSingleton.e_contact_get_type, "e_contact_get_type", - &EDSAbiWrapperSingleton.e_contact_new_from_vcard, "e_contact_new_from_vcard", - &EDSAbiWrapperSingleton.e_contact_set, "e_contact_set", - &EDSAbiWrapperSingleton.e_book_error_quark, "e_book_error_quark", - &EDSAbiWrapperSingleton.e_book_get_addressbooks, "e_book_get_addressbooks", - &EDSAbiWrapperSingleton.e_book_get_changes, "e_book_get_changes", - &EDSAbiWrapperSingleton.e_book_get_contact, "e_book_get_contact", - &EDSAbiWrapperSingleton.e_book_get_contacts, "e_book_get_contacts", - &EDSAbiWrapperSingleton.e_book_get_supported_auth_methods, "e_book_get_supported_auth_methods", - &EDSAbiWrapperSingleton.e_book_get_uri, "e_book_get_uri", - &EDSAbiWrapperSingleton.e_book_new, "e_book_new", - &EDSAbiWrapperSingleton.e_book_new_default_addressbook, "e_book_new_default_addressbook", - &EDSAbiWrapperSingleton.e_book_new_from_uri, "e_book_new_from_uri", - &EDSAbiWrapperSingleton.e_book_new_system_addressbook, "e_book_new_system_addressbook", - &EDSAbiWrapperSingleton.e_book_open, "e_book_open", - &EDSAbiWrapperSingleton.e_book_query_any_field_contains, "e_book_query_any_field_contains", - &EDSAbiWrapperSingleton.e_book_query_unref, "e_book_query_unref", - &EDSAbiWrapperSingleton.e_book_remove_contact, "e_book_remove_contact", - &EDSAbiWrapperSingleton.e_vcard_to_string, "e_vcard_to_string", - (void *)0); - EDSAbiHaveEbook = EDSAbiWrapperSingleton.e_book_new != 0; - findSymbols("libebook-1.2.so", libebookMinVersion, libebookMaxVersion, - 0, NULL, - &EDSAbiWrapperSingleton.e_contact_inline_local_photos, "e_contact_inline_local_photos", - (void *)0); - -# endif // ENABLE_EBOOK - -#define EDS_ABI_WRAPPER_ICAL_BASE \ - &EDSAbiWrapperSingleton.icalcomponent_add_component, "icalcomponent_add_component", \ - &EDSAbiWrapperSingleton.icalcomponent_add_property, "icalcomponent_add_property", \ - &EDSAbiWrapperSingleton.icalcomponent_as_ical_string, "icalcomponent_as_ical_string", \ - &EDSAbiWrapperSingleton.icalcomponent_free, "icalcomponent_free", \ - &EDSAbiWrapperSingleton.icalcomponent_get_first_component, "icalcomponent_get_first_component", \ - &EDSAbiWrapperSingleton.icalcomponent_get_first_property, "icalcomponent_get_first_property", \ - &EDSAbiWrapperSingleton.icalcomponent_get_next_component, "icalcomponent_get_next_component", \ - &EDSAbiWrapperSingleton.icalcomponent_get_next_property, "icalcomponent_get_next_property", \ - &EDSAbiWrapperSingleton.icalcomponent_get_recurrenceid, "icalcomponent_get_recurrenceid", \ - &EDSAbiWrapperSingleton.icalcomponent_get_timezone, "icalcomponent_get_timezone", \ - &EDSAbiWrapperSingleton.icalcomponent_get_location, "icalcomponent_get_location", \ - &EDSAbiWrapperSingleton.icalcomponent_get_summary, "icalcomponent_get_summary", \ - &EDSAbiWrapperSingleton.icalcomponent_get_uid, "icalcomponent_get_uid", \ - &EDSAbiWrapperSingleton.icalcomponent_get_dtstart, "icalcomponent_get_dtstart", \ - &EDSAbiWrapperSingleton.icalcomponent_set_dtstart, "icalcomponent_set_dtstart", \ - &EDSAbiWrapperSingleton.icalcomponent_isa, "icalcomponent_isa", \ - &EDSAbiWrapperSingleton.icalcomponent_new_clone, "icalcomponent_new_clone", \ - &EDSAbiWrapperSingleton.icalcomponent_new_from_string, "icalcomponent_new_from_string", \ - &EDSAbiWrapperSingleton.icalcomponent_new, "icalcomponent_new", \ - &EDSAbiWrapperSingleton.icalcomponent_merge_component, "icalcomponent_merge_component", \ - &EDSAbiWrapperSingleton.icalcomponent_remove_component, "icalcomponent_remove_component", \ - &EDSAbiWrapperSingleton.icalcomponent_remove_property, "icalcomponent_remove_property", \ - &EDSAbiWrapperSingleton.icalcomponent_set_uid, "icalcomponent_set_uid", \ - &EDSAbiWrapperSingleton.icalcomponent_set_recurrenceid, "icalcomponent_set_recurrenceid", \ - &EDSAbiWrapperSingleton.icalcomponent_vanew, "icalcomponent_vanew", \ - &EDSAbiWrapperSingleton.icalparameter_get_tzid, "icalparameter_get_tzid", \ - &EDSAbiWrapperSingleton.icalparameter_set_tzid, "icalparameter_set_tzid", \ - &EDSAbiWrapperSingleton.icalparameter_new_from_value_string, "icalparameter_new_from_value_string", \ - &EDSAbiWrapperSingleton.icalparameter_new_clone, "icalparameter_new_clone", \ - &EDSAbiWrapperSingleton.icalproperty_new_clone, "icalproperty_new_clone", \ - &EDSAbiWrapperSingleton.icalproperty_free, "icalproperty_free", \ - &EDSAbiWrapperSingleton.icalproperty_get_description, "icalproperty_get_description", \ - &EDSAbiWrapperSingleton.icalproperty_get_uid, "icalproperty_get_uid", \ - &EDSAbiWrapperSingleton.icalproperty_get_recurrenceid, "icalproperty_get_recurrenceid", \ - &EDSAbiWrapperSingleton.icalproperty_set_recurrenceid, "icalproperty_set_recurrenceid", \ - &EDSAbiWrapperSingleton.icalproperty_get_sequence, "icalproperty_get_sequence", \ - &EDSAbiWrapperSingleton.icalproperty_get_property_name, "icalproperty_get_property_name", \ - &EDSAbiWrapperSingleton.icalproperty_get_first_parameter, "icalproperty_get_first_parameter", \ - &EDSAbiWrapperSingleton.icalproperty_get_lastmodified, "icalproperty_get_lastmodified", \ - &EDSAbiWrapperSingleton.icalproperty_get_next_parameter, "icalproperty_get_next_parameter", \ - &EDSAbiWrapperSingleton.icalproperty_set_parameter, "icalproperty_set_parameter", \ - &EDSAbiWrapperSingleton.icalproperty_get_summary, "icalproperty_get_summary", \ - &EDSAbiWrapperSingleton.icalproperty_new_description, "icalproperty_new_description", \ - &EDSAbiWrapperSingleton.icalproperty_new_summary, "icalproperty_new_summary", \ - &EDSAbiWrapperSingleton.icalproperty_new_uid, "icalproperty_new_uid", \ - &EDSAbiWrapperSingleton.icalproperty_new_sequence, "icalproperty_new_sequence", \ - &EDSAbiWrapperSingleton.icalproperty_new_recurrenceid, "icalproperty_new_recurrenceid", \ - &EDSAbiWrapperSingleton.icalproperty_set_value_from_string, "icalproperty_set_value_from_string", \ - &EDSAbiWrapperSingleton.icalproperty_set_dtstamp, "icalproperty_set_dtstamp", \ - &EDSAbiWrapperSingleton.icalproperty_set_lastmodified, "icalproperty_set_lastmodified", \ - &EDSAbiWrapperSingleton.icalproperty_set_sequence, "icalproperty_set_sequence", \ - &EDSAbiWrapperSingleton.icalproperty_set_uid, "icalproperty_set_uid", \ - &EDSAbiWrapperSingleton.icalproperty_remove_parameter_by_kind, "icalproperty_remove_parameter_by_kind", \ - &EDSAbiWrapperSingleton.icalproperty_add_parameter, "icalproperty_add_parameter", \ - &EDSAbiWrapperSingleton.icalproperty_get_value_as_string, "icalproperty_get_value_as_string", \ - &EDSAbiWrapperSingleton.icalproperty_get_x_name, "icalproperty_get_x_name", \ - &EDSAbiWrapperSingleton.icalproperty_new_from_string, "icalproperty_new_from_string", \ - &EDSAbiWrapperSingleton.icaltime_is_null_time, "icaltime_is_null_time", \ - &EDSAbiWrapperSingleton.icaltime_is_utc, "icaltime_is_utc", \ - &EDSAbiWrapperSingleton.icaltime_as_ical_string, "icaltime_as_ical_string", \ - &EDSAbiWrapperSingleton.icaltime_from_string, "icaltime_from_string", \ - &EDSAbiWrapperSingleton.icaltime_from_timet, "icaltime_from_timet", \ - &EDSAbiWrapperSingleton.icaltime_null_time, "icaltime_null_time", \ - &EDSAbiWrapperSingleton.icaltime_as_timet, "icaltime_as_timet", \ - &EDSAbiWrapperSingleton.icaltime_set_timezone, "icaltime_set_timezone", \ - &EDSAbiWrapperSingleton.icaltime_convert_to_zone, "icaltime_convert_to_zone", \ - &EDSAbiWrapperSingleton.icaltime_get_timezone, "icaltime_get_timezone", \ - &EDSAbiWrapperSingleton.icaltimezone_free, "icaltimezone_free", \ - &EDSAbiWrapperSingleton.icaltimezone_get_builtin_timezone, "icaltimezone_get_builtin_timezone", \ - &EDSAbiWrapperSingleton.icaltimezone_get_builtin_timezone_from_tzid, "icaltimezone_get_builtin_timezone_from_tzid", \ - &EDSAbiWrapperSingleton.icaltimezone_get_component, "icaltimezone_get_component", \ - &EDSAbiWrapperSingleton.icaltimezone_get_tzid, "icaltimezone_get_tzid", \ - &EDSAbiWrapperSingleton.icaltimezone_new, "icaltimezone_new", \ - &EDSAbiWrapperSingleton.icaltimezone_set_component, "icaltimezone_set_component", \ - &EDSAbiWrapperSingleton.icaltimezone_get_location, "icaltimezone_get_location", \ - &EDSAbiWrapperSingleton.ical_tzid_prefix, "ical_tzid_prefix", \ - &EDSAbiWrapperSingleton.icalerror_set_errno, "icalerror_set_errno", \ - &EDSAbiWrapperSingleton.icalproperty_new_dtstart, "icalproperty_new_dtstart", \ - &EDSAbiWrapperSingleton.icalproperty_new_rrule, "icalproperty_new_rrule", \ - &EDSAbiWrapperSingleton.icalproperty_new_tzid, "icalproperty_new_tzid", \ - &EDSAbiWrapperSingleton.icalproperty_new_tzname, "icalproperty_new_tzname", \ - &EDSAbiWrapperSingleton.icalproperty_new_tzoffsetfrom, "icalproperty_new_tzoffsetfrom", \ - &EDSAbiWrapperSingleton.icalproperty_new_tzoffsetto, "icalproperty_new_tzoffsetto", \ - &EDSAbiWrapperSingleton.icalproperty_new_x, "icalproperty_new_x", \ - &EDSAbiWrapperSingleton.icalproperty_set_x_name, "icalproperty_set_x_name", \ - &EDSAbiWrapperSingleton.icalrecur_iterator_free, "icalrecur_iterator_free", \ - &EDSAbiWrapperSingleton.icalrecur_iterator_new, "icalrecur_iterator_new", \ - &EDSAbiWrapperSingleton.icalrecur_iterator_next, "icalrecur_iterator_next", \ - &EDSAbiWrapperSingleton.icalrecurrencetype_clear, "icalrecurrencetype_clear", \ - &EDSAbiWrapperSingleton.icaltime_day_of_week, "icaltime_day_of_week", \ - &EDSAbiWrapperSingleton.icaltime_days_in_month, "icaltime_days_in_month", \ - &EDSAbiWrapperSingleton.icaltzutil_get_zone_directory, "icaltzutil_get_zone_directory", \ - - - // icalparameter_new_scheduleagent was added in libical.so.1. We - // use it only to detect the libical 1.0 ABI. This works because - // all methods in EDS_ABI_WRAPPER_ICAL_R are considered optional. -#define EDS_ABI_WRAPPER_ICAL_R \ - &EDSAbiWrapperSingleton.icalparameter_new_scheduleagent, "icalparameter_new_scheduleagent", \ - &EDSAbiWrapperSingleton.icalcomponent_as_ical_string_r, "icalcomponent_as_ical_string_r", \ - &EDSAbiWrapperSingleton.icaltime_as_ical_string_r, "icaltime_as_ical_string_r", \ - &EDSAbiWrapperSingleton.icalproperty_get_value_as_string_r, "icalproperty_get_value_as_string_r", - -# ifdef ENABLE_ECAL - static const int libecalMinVersion = 3, - libecalMaxVersion = 11; // EDS 3.4 - ecalhandle = - findSymbols("libecal-1.2.so", libecalMinVersion, libecalMaxVersion, - FIND_SYMBOLS_NEED_ALL, NULL, - &EDSAbiWrapperSingleton.e_cal_add_timezone, "e_cal_add_timezone", - &EDSAbiWrapperSingleton.e_cal_component_get_icalcomponent, "e_cal_component_get_icalcomponent", - &EDSAbiWrapperSingleton.e_cal_component_get_last_modified, "e_cal_component_get_last_modified", - &EDSAbiWrapperSingleton.e_cal_component_get_type, "e_cal_component_get_type", - &EDSAbiWrapperSingleton.e_cal_create_object, "e_cal_create_object", - &EDSAbiWrapperSingleton.e_calendar_error_quark, "e_calendar_error_quark", - &EDSAbiWrapperSingleton.e_cal_get_component_as_string, "e_cal_get_component_as_string", - &EDSAbiWrapperSingleton.e_cal_get_object, "e_cal_get_object", - &EDSAbiWrapperSingleton.e_cal_get_object_list_as_comp, "e_cal_get_object_list_as_comp", - &EDSAbiWrapperSingleton.e_cal_get_sources, "e_cal_get_sources", - &EDSAbiWrapperSingleton.e_cal_get_timezone, "e_cal_get_timezone", - &EDSAbiWrapperSingleton.e_cal_modify_object, "e_cal_modify_object", - &EDSAbiWrapperSingleton.e_cal_new, "e_cal_new", - &EDSAbiWrapperSingleton.e_cal_new_from_uri, "e_cal_new_from_uri", - &EDSAbiWrapperSingleton.e_cal_new_system_calendar, "e_cal_new_system_calendar", - &EDSAbiWrapperSingleton.e_cal_new_system_tasks, "e_cal_new_system_tasks", - &EDSAbiWrapperSingleton.e_cal_get_uri, "e_cal_get_uri", - &EDSAbiWrapperSingleton.e_cal_open, "e_cal_open", - &EDSAbiWrapperSingleton.e_cal_remove_object, "e_cal_remove_object", - &EDSAbiWrapperSingleton.e_cal_remove_object_with_mod, "e_cal_remove_object_with_mod", - &EDSAbiWrapperSingleton.e_cal_set_auth_func, "e_cal_set_auth_func", - EDS_ABI_WRAPPER_ICAL_BASE - (void *)0); - EDSAbiHaveEcal = EDSAbiWrapperSingleton.e_cal_new != 0; - ecalhandle = - findSymbols("libecal-1.2.so", libecalMinVersion, libecalMaxVersion, - 0, NULL, - EDS_ABI_WRAPPER_ICAL_R - (void *)0); -# endif // ENABLE_ECAL - -# ifdef ENABLE_ICAL - if (!EDSAbiWrapperSingleton.icalcomponent_add_component) { - // libecal not found above (or not enabled), but libical - // might still be available, so check for it separately - ecalhandle = - findSymbols("libical.so", 0, 1, - FIND_SYMBOLS_NEED_ALL, NULL, - EDS_ABI_WRAPPER_ICAL_BASE - (void *)0); - ecalhandle = - findSymbols("libical.so", 0, 1, - 0, NULL, - EDS_ABI_WRAPPER_ICAL_R - (void *)0); - } - EDSAbiHaveIcal = EDSAbiWrapperSingleton.icalcomponent_add_component != 0; - EDSAbiHaveIcal1 = EDSAbiWrapperSingleton.icalparameter_new_scheduleagent != 0; -# endif // ENABLE_ICAL - -# ifdef ENABLE_BLUETOOTH - int bluetooth_version; - libbluetoothhandle = - findSymbols("libbluetooth.so", 2, 3, 0, &bluetooth_version, - &EDSAbiWrapperSingleton.sdp_close, "sdp_close", - &EDSAbiWrapperSingleton.sdp_connect, "sdp_connect", - &EDSAbiWrapperSingleton.sdp_extract_pdu, "sdp_extract_pdu", - &EDSAbiWrapperSingleton.sdp_extract_pdu_safe, "sdp_extract_pdu_safe", - &EDSAbiWrapperSingleton.sdp_extract_seqtype, "sdp_extract_seqtype", - &EDSAbiWrapperSingleton.sdp_extract_seqtype_safe, "sdp_extract_seqtype_safe", - &EDSAbiWrapperSingleton.sdp_get_access_protos, "sdp_get_access_protos", - &EDSAbiWrapperSingleton.sdp_get_proto_port, "sdp_get_proto_port", - &EDSAbiWrapperSingleton.sdp_get_socket, "sdp_get_socket", - &EDSAbiWrapperSingleton.sdp_list_append, "sdp_list_append", - &EDSAbiWrapperSingleton.sdp_list_free, "sdp_list_free", - &EDSAbiWrapperSingleton.sdp_process, "sdp_process", - &EDSAbiWrapperSingleton.sdp_record_free, "sdp_record_free", - &EDSAbiWrapperSingleton.sdp_service_search_attr_async, "sdp_service_search_attr_async", - &EDSAbiWrapperSingleton.sdp_set_notify, "sdp_set_notify", - &EDSAbiWrapperSingleton.sdp_uuid128_create, "sdp_uuid128_create", - &EDSAbiWrapperSingleton.str2ba, "str2ba", - (void *)0); - if (bluetooth_version == 2) { - // libbluetooth.so.2's sdp_extract_pdu() and - // sdp_extract_seqtype() do not match our prototype (have no - // bufsize). Some versions have a _safe variant. If not, use - // wrappers which accept the bufsize parameter and drop it. - if (!EDSAbiWrapperSingleton.sdp_extract_pdu_safe) { - EDSAbiWrapperSingleton.sdp_extract_pdu_safe = wrap_sdp_extract_pdu; - } - if (!EDSAbiWrapperSingleton.sdp_extract_seqtype_safe) { - EDSAbiWrapperSingleton.sdp_extract_seqtype_safe = wrap_sdp_extract_seqtype; - } - } else { - // _safe variants were removed in favor of an API/ABI change. Redirect - // into normal versions. We know they have the right prototype because - // of that change. - EDSAbiWrapperSingleton.sdp_extract_pdu_safe = reinterpret_cast<typeof(EDSAbiWrapperSingleton.sdp_extract_pdu_safe)>(EDSAbiWrapperSingleton.sdp_extract_pdu); - EDSAbiWrapperSingleton.sdp_extract_seqtype_safe = reinterpret_cast<typeof(EDSAbiWrapperSingleton.sdp_extract_seqtype_safe)>(EDSAbiWrapperSingleton.sdp_extract_seqtype); - } - SyncEvoHaveLibbluetooth = EDSAbiWrapperSingleton.sdp_connect != 0; -# endif -} -#elif defined(EVOLUTION_ICAL_COMPATIBILITY) -// Simpler version of the ABI wrapper which only checks for -// libical.so.1. To be used with normal linking against libical.so.0 -// and then patching the resulting files to be used with libical.so.1 -// instead. -int EDSAbiHaveIcal1; - -void EDSAbiWrapperInit() -{ - static bool initialized; - - if (initialized) { - return; - } else { - initialized = true; - } - - // Bind icaltimezone_get_component() and - // icaltzutil_fetch_timezone() to the version found (or not found, - // if not enabled) in our own executable. Without this, the - // dynamic linker on Ubuntu Saucy and Trusty prefers the versions - // from libical once it is loaded. - void *fetch = dlsym(RTLD_DEFAULT, "icaltzutil_fetch_timezone"); - void *get = dlsym(RTLD_DEFAULT, "icaltimezone_get_component"); - getLookupDebug() += SyncEvo::StringPrintf("icaltzutil_fetch_timezone = %p\n", fetch); - getLookupDebug() += SyncEvo::StringPrintf("icaltimezone_get_component = %p", get); - - static const char *soname = "libical.so.1"; - void *dlhandle = dlopen(soname, RTLD_GLOBAL|RTLD_LAZY); - if (dlhandle) { - getLookupInfo() += "using "; - getLookupInfo() += soname; - getLookupInfo() += "\n"; - EDSAbiHaveIcal1 = 1; - dlclose(dlhandle); + // TODO: remove? +#if 0 and defined(ENABLE_ICALTZ_UTIL) + static void *icaltzutil = dlopen("libsyncevo-icaltz-util.so.0", RTLD_LAZY|RTLD_GLOBAL); + if (icaltzutil) { + // Bind icaltimezone_get_component() and + // icaltzutil_fetch_timezone() to the version found (or not found, + // if not enabled) in our own libsyncevo-icaltz-util.so.1. Without this, the + // dynamic linker on Ubuntu Saucy and Trusty prefers the versions + // from libical once it is loaded. + void *fetch = dlsym(RTLD_DEFAULT, "icaltzutil_fetch_timezone"), + *fetch_lib = dlsym(icaltzutil, "icaltzutil_fetch_timezone"), + *get = dlsym(RTLD_DEFAULT, "icaltimezone_get_component"), + *get_lib = dlsym(icaltzutil, "icaltimezone_get_component"); + getLookupInfo() += "libsyncevo-icaltz-util.so.0 + libical.so.1\n"; + getLookupDebug() += SyncEvo::StringPrintf("icaltzutil_fetch_timezone = %p (default), %p (SyncEvolution)\n", fetch, fetch_lib); + getLookupDebug() += SyncEvo::StringPrintf("icaltimezone_get_component = %p (default), %p (SyncEvolution)\n", get, get_lib); } +#endif // ENABLE_ICALTZ_UTIL } -#endif // EVOLUTION_COMPATIBILITY extern "C" const char *EDSAbiWrapperInfo() { EDSAbiWrapperInit(); return getLookupInfo().c_str(); } extern "C" const char *EDSAbiWrapperDebug() { EDSAbiWrapperInit(); return getLookupDebug().c_str(); } diff --git a/src/syncevo/eds_abi_wrapper.h b/src/syncevo/eds_abi_wrapper.h index 6d98c39b..cb21dce7 100644 --- a/src/syncevo/eds_abi_wrapper.h +++ b/src/syncevo/eds_abi_wrapper.h @@ -18,29 +18,26 @@ */ /** - * The main purpose of this file is to separate SyncEvolution from - * Evolution Dataserver ABI changes by never depending directly - * on any symbol in its libraries. Instead all functions are - * called via function pointers found via dlopen/dlsym. + * The main purpose of this file was to separate SyncEvolution from + * ABI changes by never depending directly + * on any symbol in libraries. Instead all functions were + * called via function pointers found via dlopen/dlsym. Originally + * meant for Evolution Data Server (EDS), hence the name. * * This is more flexible than linking against a specific revision of * the libs, but circumvents the usual lib versioning and therefore * may fail when the functions needed by SyncEvolution change. * - * History shows that this has not happened for a long time whereas - * the versions of EDS libs had to be bumped quite a few times due to other - * changes. + * History showed that in particular EDS changed sonames quite + * frequently although the actual functions needed by SyncEvolution + * didn't change. * - * A similar problem came up with an API and ABI change in - * libbluetooth.so.3: the sdp_extract_seqtype() and sdp_extract_pdu() - * gained one more parameter (a buffer size for the buffer being - * written into). When compatibility mode is enabled, this header - * file provides the extended version and maps it back to the older - * version if necessary. + * Nowadays, normal linking is used again, with code sensitive to + * library versions located in dynamically loaded backends (sometimes + * recompiled, sometimes copied and patched to support multiple + * different library versions), so this wrapper is mostly empty now. * - * To use the wrappers, include this header file. It overrides - * the normal C API functions with the function pointers via - * defines. + * It's kept around to minimize changes elsewhere. */ #ifndef INCL_EDS_ABI_WRAPPER @@ -93,427 +90,6 @@ extern "C" { #endif -#if defined(EVOLUTION_COMPATIBILITY) || defined(EVOLUTION_ICAL_COMPATIBILITY) -extern int EDSAbiHaveIcal1; // 1 for libical.so.1, 0 for libical.so.0; numeric value matters, see defines below. - -/** initialize pointers to EDS functions, if necessary; can be called multiple times */ -void EDSAbiWrapperInit(); -#else -# define EDSAbiWrapperInit() -#endif - -#ifdef EVOLUTION_COMPATIBILITY - -/** libebook, libecal, libedataserver available (currently checks for e_book_new/e_cal_new/e_source_group_peek_sources) */ -extern int EDSAbiHaveEbook, EDSAbiHaveEcal, EDSAbiHaveEdataserver; -extern int EDSAbiHaveIcal; - -/** libbluetooth available (checks sdp_connect()) */ -extern int SyncEvoHaveLibbluetooth; - -/** - * This is a struct instead of a namespace because that allows - * printing it in a debugger. This code also has to be usable - * in plain C. - */ -struct EDSAbiWrapper { -# ifdef HAVE_EDS - GType (*e_source_get_type) (void); - char *(*e_source_get_uri) (ESource *source); - GType (*e_source_group_get_type) (void); - GSList *(*e_source_group_peek_sources) (ESourceGroup *group); - GSList *(*e_source_list_peek_groups) (ESourceList *list); - const char *(*e_source_peek_name) (ESource *source); -# endif /* HAVE_EDS */ - -# ifdef ENABLE_EBOOK - gboolean (*e_book_add_contact) (EBook *book, EContact *contact, GError **error); - gboolean (*e_book_authenticate_user) (EBook *book, const char *user, const char *passwd, const char *auth_method, GError **error); - gboolean (*e_book_commit_contact) (EBook *book, EContact *contact, GError **error); - EContact* (*e_contact_duplicate) (EContact *contact); - gconstpointer (*e_contact_get_const) (EContact *contact, EContactField field_id); - gpointer (*e_contact_get) (EContact *contact, EContactField field_id); - void (*e_contact_name_free)(EContactName *name); - GType (*e_contact_get_type) (void); - EContact* (*e_contact_new_from_vcard) (const char *vcard); - void (*e_contact_set) (EContact *contact, EContactField field_id, const gpointer value); - gboolean (*e_book_get_addressbooks) (ESourceList** addressbook_sources, GError **error); - gboolean (*e_book_get_changes) (EBook *book, char *changeid, GList **changes, GError **error); - gboolean (*e_book_get_contact) (EBook *book, const char *id, EContact **contact, GError **error); - gboolean (*e_book_get_contacts) (EBook *book, EBookQuery *query, GList **contacts, GError **error); - gboolean (*e_book_get_supported_auth_methods) (EBook *book, GList **auth_methods, GError **error); - const char *(*e_book_get_uri) (EBook *book); - EBook *(*e_book_new) (ESource *source, GError **error); - EBook *(*e_book_new_default_addressbook) (GError **error); - EBook *(*e_book_new_from_uri) (const char *uri, GError **error); - EBook *(*e_book_new_system_addressbook) (GError **error); - gboolean (*e_book_open) (EBook *book, gboolean only_if_exists, GError **error); - EBookQuery* (*e_book_query_any_field_contains) (const char *value); - void (*e_book_query_unref) (EBookQuery *q); - GQuark (*e_book_error_quark) (void); - gboolean (*e_book_remove_contact) (EBook *book, const char *id, GError **error); - char* (*e_vcard_to_string) (EVCard *evc, EVCardFormat format); - gboolean (*e_contact_inline_local_photos) (EContact *contact, GError **error); -# endif /* ENABLE_EBOOK */ - -# ifdef ENABLE_ECAL - gboolean (*e_cal_add_timezone) (ECal *ecal, icaltimezone *izone, GError **error); - icalcomponent *(*e_cal_component_get_icalcomponent) (ECalComponent *comp); - void (*e_cal_component_get_last_modified) (ECalComponent *comp, struct icaltimetype **t); - GType (*e_cal_component_get_type) (void); - gboolean (*e_cal_create_object) (ECal *ecal, icalcomponent *icalcomp, char **uid, GError **error); - GQuark (*e_calendar_error_quark) (void) G_GNUC_CONST; - char* (*e_cal_get_component_as_string) (ECal *ecal, icalcomponent *icalcomp); - gboolean (*e_cal_get_object) (ECal *ecal, const char *uid, const char *rid, icalcomponent **icalcomp, GError **error); - gboolean (*e_cal_get_object_list_as_comp) (ECal *ecal, const char *query, GList **objects, GError **error); - gboolean (*e_cal_get_sources) (ESourceList **sources, ECalSourceType type, GError **error); - gboolean (*e_cal_get_timezone) (ECal *ecal, const char *tzid, icaltimezone **zone, GError **error); - gboolean (*e_cal_modify_object) (ECal *ecal, icalcomponent *icalcomp, CalObjModType mod, GError **error); - ECal *(*e_cal_new) (ESource *source, ECalSourceType type); - ECal *(*e_cal_new_from_uri) (const gchar *uri, ECalSourceType type); - ECal *(*e_cal_new_system_calendar) (void); - ECal *(*e_cal_new_system_tasks) (void); - const gchar *(*e_cal_get_uri)(ECal *); - gboolean (*e_cal_open) (ECal *ecal, gboolean only_if_exists, GError **error); - gboolean (*e_cal_remove_object) (ECal *ecal, const char *uid, GError **error); - gboolean (*e_cal_remove_object_with_mod) (ECal *ecal, const char *uid, const char *rid, CalObjModType mod, GError **error); - void (*e_cal_set_auth_func) (ECal *ecal, ECalAuthFunc func, gpointer data); -#endif /* ENABLE_ECAL */ -#ifdef ENABLE_ICAL - void (*icalcomponent_add_component) (icalcomponent* parent, icalcomponent* child); - void (*icalcomponent_add_property) (icalcomponent* comp, icalproperty* prop); - char* (*icalcomponent_as_ical_string) (icalcomponent* component); - void (*icalcomponent_free) (icalcomponent* component); - icalcomponent* (*icalcomponent_get_first_component) (icalcomponent* component, icalcomponent_kind kind); - icalproperty* (*icalcomponent_get_first_property) (icalcomponent* component, icalproperty_kind kind); - icalcomponent* (*icalcomponent_get_next_component) (icalcomponent* component, icalcomponent_kind kind); - icalproperty* (*icalcomponent_get_next_property) (icalcomponent* component, icalproperty_kind kind); - struct icaltimetype (*icalcomponent_get_recurrenceid) (icalcomponent* comp); - icaltimezone* (*icalcomponent_get_timezone) (icalcomponent* comp, const char *tzid); - const char* (*icalcomponent_get_location) (icalcomponent* comp); - const char* (*icalcomponent_get_summary) (icalcomponent* comp); - const char* (*icalcomponent_get_uid) (icalcomponent* comp); - struct icaltimetype (*icalcomponent_get_dtstart)(icalcomponent* comp); - void (*icalcomponent_set_dtstart)(icalcomponent* comp, struct icaltimetype v); - icalcomponent_kind (*icalcomponent_isa) (const icalcomponent* component); - icalcomponent* (*icalcomponent_new_clone) (icalcomponent* component); - icalcomponent* (*icalcomponent_new_from_string) (char* str); - icalcomponent* (*icalcomponent_new) (icalcomponent_kind kind); - void (*icalcomponent_merge_component) (icalcomponent* component, icalcomponent *comp_to_merge); - void (*icalcomponent_remove_component) (icalcomponent* component, icalcomponent *comp_to_remove); - void (*icalcomponent_remove_property) (icalcomponent* component, icalproperty* property); - void (*icalcomponent_set_uid) (icalcomponent* comp, const char* v); - void (*icalcomponent_set_recurrenceid)(icalcomponent* comp, struct icaltimetype v); - icalcomponent* (*icalcomponent_vanew) (icalcomponent_kind kind, ...); - const char* (*icalparameter_get_tzid) (const icalparameter* value); - void (*icalparameter_set_tzid) (icalparameter* value, const char* v); - icalparameter *(*icalparameter_new_from_value_string)(icalparameter_kind kind, const char *value); - icalparameter *(*icalparameter_new_clone)(icalparameter *param); - icalproperty *(*icalproperty_new_clone)(icalproperty *prop); - void (*icalproperty_free)(icalproperty *prop); - const char* (*icalproperty_get_description) (const icalproperty* prop); - const char* (*icalproperty_get_property_name) (const icalproperty* prop); - const char* (*icalproperty_get_uid) (const icalproperty* prop); - struct icaltimetype (*icalproperty_get_recurrenceid) (const icalproperty* prop); - void (*icalproperty_set_recurrenceid) (const icalproperty* prop, icaltimetype rid); - int (*icalproperty_get_sequence) (const icalproperty* prop); - icalparameter* (*icalproperty_get_first_parameter) (icalproperty* prop, icalparameter_kind kind); - struct icaltimetype (*icalproperty_get_lastmodified) (const icalproperty* prop); - icalparameter* (*icalproperty_get_next_parameter) (icalproperty* prop, icalparameter_kind kind); - void (*icalproperty_set_parameter)(icalproperty *prop, icalparameter *param); - const char* (*icalproperty_get_summary) (const icalproperty* prop); - icalproperty* (*icalproperty_new_description) (const char* v); - icalproperty* (*icalproperty_new_summary) (const char* v); - icalproperty* (*icalproperty_new_sequence) (int v); - icalproperty* (*icalproperty_new_uid) (const char* v); - icalproperty* (*icalproperty_new_recurrenceid) (icaltimetype v); - void (*icalproperty_set_value_from_string) (icalproperty* prop,const char* value, const char* kind); - void (*icalproperty_set_dtstamp) (icalproperty* prop, struct icaltimetype v); - void (*icalproperty_set_lastmodified) (icalproperty* prop, struct icaltimetype v); - void (*icalproperty_set_sequence) (icalproperty* prop, int v); - void (*icalproperty_set_uid) (icalproperty* prop, const char *v); - void (*icalproperty_remove_parameter_by_kind)(icalproperty* prop, - icalparameter_kind kind); - void (*icalproperty_add_parameter)(icalproperty* prop,icalparameter* parameter); - const char* (*icalproperty_get_value_as_string)(const icalproperty* prop); - const char* (*icalproperty_get_x_name)(icalproperty* prop); - icalproperty* (*icalproperty_new_from_string)(const char* str); - icalproperty* (*icalproperty_new_dtstart)(struct icaltimetype v); - icalproperty* (*icalproperty_new_rrule)(struct icalrecurrencetype v); - icalproperty* (*icalproperty_new_tzid)(const char* v); - icalproperty* (*icalproperty_new_tzname)(const char* v); - icalproperty* (*icalproperty_new_tzoffsetfrom)(int v); - icalproperty* (*icalproperty_new_tzoffsetto)(int v); - icalproperty* (*icalproperty_new_x)(const char* v); - void (*icalproperty_set_x_name)(icalproperty* prop, const char* name); - - void (*icalrecur_iterator_free)(icalrecur_iterator*); - icalrecur_iterator* (*icalrecur_iterator_new)(struct icalrecurrencetype rule, struct icaltimetype dtstart); - struct icaltimetype (*icalrecur_iterator_next)(icalrecur_iterator*); - - void (*icalrecurrencetype_clear)(struct icalrecurrencetype *r); - int (*icaltime_day_of_week)(const struct icaltimetype t); - int (*icaltime_days_in_month)(const int month, const int year); - - int (*icaltime_is_null_time)(const struct icaltimetype t); - int (*icaltime_is_utc)(const struct icaltimetype t); - const char* (*icaltime_as_ical_string) (const struct icaltimetype tt); - icaltimetype (*icaltime_from_string)(const char* str); - icaltimetype (*icaltime_from_timet)(const time_t v, const int is_date); - icaltimetype (*icaltime_null_time)(); - time_t (*icaltime_as_timet)(const struct icaltimetype); - void (*icaltime_set_timezone)(icaltimetype *tt, const icaltimezone *zone); - struct icaltimetype (*icaltime_convert_to_zone)(const struct icaltimetype tt, icaltimezone *zone); - const icaltimezone *(*icaltime_get_timezone)(const struct icaltimetype t); - - void (*icaltimezone_free) (icaltimezone *zone, int free_struct); - icaltimezone* (*icaltimezone_get_builtin_timezone) (const char *location); - icaltimezone* (*icaltimezone_get_builtin_timezone_from_tzid) (const char *tzid); - icalcomponent* (*icaltimezone_get_component) (icaltimezone *zone); - char* (*icaltimezone_get_tzid) (icaltimezone *zone); - icaltimezone *(*icaltimezone_new) (void); - int (*icaltimezone_set_component) (icaltimezone *zone, icalcomponent *comp); - const char* (*icaltimezone_get_location) (icaltimezone *zone); - - void (*icalerror_set_errno)(icalerrorenum x); - const char *(*icaltzutil_get_zone_directory)(void); - const char **ical_tzid_prefix; - - // Optional, added in libical.so.1. Can't be called be like this, - // we merely check for the method to detect the ABI. - void (*icalparameter_new_scheduleagent)(void); - - // optional variants which allocate the returned string for us - const char* (*icaltime_as_ical_string_r) (const struct icaltimetype tt); - char* (*icalcomponent_as_ical_string_r) (icalcomponent* component); - char* (*icalproperty_get_value_as_string_r) (const icalproperty* prop); -# endif /* ENABLE_ICAL */ - -# ifdef ENABLE_BLUETOOTH - int (*sdp_close)(sdp_session_t *session); - sdp_session_t *(*sdp_connect)(const bdaddr_t *src, const bdaddr_t *dst, uint32_t flags); - /** libbluetooth.so.2 version of sdp_extract_pdu() */ - sdp_record_t *(*sdp_extract_pdu)(const uint8_t *pdata, int *scanned); - /** alternate version of sdp_extract_pdu() only found in some releases of libbluetooth.so.2 */ - sdp_record_t *(*sdp_extract_pdu_safe)(const uint8_t *pdata, int bufsize, int *scanned); - /** libbluetooth.so.2 version of sdp_extract_seqtype() */ - int (*sdp_extract_seqtype)(const uint8_t *buf, uint8_t *dtdp, int *size); - /** alternate version of sdp_extract_seqtype() only found in some releases of libbluetooth.so.2 */ - int (*sdp_extract_seqtype_safe)(const uint8_t *buf, int bufsize, uint8_t *dtdp, int *size); - int (*sdp_get_access_protos)(const sdp_record_t *rec, sdp_list_t **protos); - int (*sdp_get_proto_port)(const sdp_list_t *list, int proto); - int (*sdp_get_socket)(const sdp_session_t *session); - sdp_list_t *(*sdp_list_append)(sdp_list_t *list, void *d); - void (*sdp_list_free)(sdp_list_t *list, sdp_free_func_t f); - int (*sdp_process)(sdp_session_t *session); - void (*sdp_record_free)(sdp_record_t *rec); - int (*sdp_service_search_attr_async)(sdp_session_t *session, const sdp_list_t *search, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list); - int (*sdp_set_notify)(sdp_session_t *session, sdp_callback_t *func, void *udata); - uuid_t *(*sdp_uuid128_create)(uuid_t *uuid, const void *data); - int (*str2ba)(const char *str, bdaddr_t *ba); -# endif /* ENABLE_BLUETOOTH */ - - int initialized; -}; - -extern struct EDSAbiWrapper EDSAbiWrapperSingleton; - -# ifndef EDS_ABI_WRAPPER_NO_REDEFINE -# ifdef HAVE_EDS -# define e_source_get_type EDSAbiWrapperSingleton.e_source_get_type -# define e_source_get_uri EDSAbiWrapperSingleton.e_source_get_uri -# define e_source_group_get_type EDSAbiWrapperSingleton.e_source_group_get_type -# define e_source_group_peek_sources EDSAbiWrapperSingleton.e_source_group_peek_sources -# define e_source_list_peek_groups EDSAbiWrapperSingleton.e_source_list_peek_groups -# define e_source_peek_name EDSAbiWrapperSingleton.e_source_peek_name -# endif /* HAVE_EDS */ - -# ifdef ENABLE_EBOOK -# define e_book_add_contact EDSAbiWrapperSingleton.e_book_add_contact -# define e_book_authenticate_user EDSAbiWrapperSingleton.e_book_authenticate_user -# define e_book_commit_contact EDSAbiWrapperSingleton.e_book_commit_contact -# define e_contact_duplicate EDSAbiWrapperSingleton.e_contact_duplicate -# define e_contact_get_const EDSAbiWrapperSingleton.e_contact_get_const -# define e_contact_get EDSAbiWrapperSingleton.e_contact_get -# define e_contact_name_free EDSAbiWrapperSingleton.e_contact_name_free -# define e_contact_get_type EDSAbiWrapperSingleton.e_contact_get_type -# define e_contact_new_from_vcard EDSAbiWrapperSingleton.e_contact_new_from_vcard -# define e_contact_set EDSAbiWrapperSingleton.e_contact_set -# define e_book_error_quark EDSAbiWrapperSingleton.e_book_error_quark -# define e_book_get_addressbooks EDSAbiWrapperSingleton.e_book_get_addressbooks -# define e_book_get_changes EDSAbiWrapperSingleton.e_book_get_changes -# define e_book_get_contact EDSAbiWrapperSingleton.e_book_get_contact -# define e_book_get_contacts EDSAbiWrapperSingleton.e_book_get_contacts -# define e_book_get_supported_auth_methods EDSAbiWrapperSingleton.e_book_get_supported_auth_methods -# define e_book_get_uri EDSAbiWrapperSingleton.e_book_get_uri -# define e_book_new EDSAbiWrapperSingleton.e_book_new -# define e_book_new_default_addressbook EDSAbiWrapperSingleton.e_book_new_default_addressbook -# define e_book_new_from_uri EDSAbiWrapperSingleton.e_book_new_from_uri -# define e_book_new_system_addressbook EDSAbiWrapperSingleton.e_book_new_system_addressbook -# define e_book_open EDSAbiWrapperSingleton.e_book_open -# define e_book_query_any_field_contains EDSAbiWrapperSingleton.e_book_query_any_field_contains -# define e_book_query_unref EDSAbiWrapperSingleton.e_book_query_unref -# define e_book_remove_contact EDSAbiWrapperSingleton.e_book_remove_contact -# define e_vcard_to_string EDSAbiWrapperSingleton.e_vcard_to_string -# define e_contact_inline_local_photos EDSAbiWrapperSingleton.e_contact_inline_local_photos -# endif /* ENABLE_EBOOK */ - -# ifdef ENABLE_ECAL -# define e_cal_add_timezone EDSAbiWrapperSingleton.e_cal_add_timezone -# define e_cal_component_get_icalcomponent EDSAbiWrapperSingleton.e_cal_component_get_icalcomponent -# define e_cal_component_get_last_modified EDSAbiWrapperSingleton.e_cal_component_get_last_modified -# define e_cal_component_get_type EDSAbiWrapperSingleton.e_cal_component_get_type -# define e_cal_create_object EDSAbiWrapperSingleton.e_cal_create_object -# define e_calendar_error_quark EDSAbiWrapperSingleton.e_calendar_error_quark -# define e_cal_get_component_as_string EDSAbiWrapperSingleton.e_cal_get_component_as_string -# define e_cal_get_object EDSAbiWrapperSingleton.e_cal_get_object -# define e_cal_get_object_list_as_comp EDSAbiWrapperSingleton.e_cal_get_object_list_as_comp -# define e_cal_get_sources EDSAbiWrapperSingleton.e_cal_get_sources -# define e_cal_get_timezone EDSAbiWrapperSingleton.e_cal_get_timezone -# define e_cal_modify_object EDSAbiWrapperSingleton.e_cal_modify_object -# define e_cal_new EDSAbiWrapperSingleton.e_cal_new -# define e_cal_new_from_uri EDSAbiWrapperSingleton.e_cal_new_from_uri -# define e_cal_new_system_calendar EDSAbiWrapperSingleton.e_cal_new_system_calendar -# define e_cal_new_system_tasks EDSAbiWrapperSingleton.e_cal_new_system_tasks -# define e_cal_get_uri EDSAbiWrapperSingleton.e_cal_get_uri -# define e_cal_open EDSAbiWrapperSingleton.e_cal_open -# define e_cal_remove_object EDSAbiWrapperSingleton.e_cal_remove_object -# define e_cal_remove_object_with_mod EDSAbiWrapperSingleton.e_cal_remove_object_with_mod -# define e_cal_set_auth_func EDSAbiWrapperSingleton.e_cal_set_auth_func -# endif /* ENABLE_ECAL */ -# ifdef ENABLE_ICAL -# define icalcomponent_add_component EDSAbiWrapperSingleton.icalcomponent_add_component -# define icalcomponent_add_property EDSAbiWrapperSingleton.icalcomponent_add_property -# define icalcomponent_as_ical_string (EDSAbiWrapperSingleton.icalcomponent_as_ical_string_r ? EDSAbiWrapperSingleton.icalcomponent_as_ical_string_r : EDSAbiWrapperSingleton.icalcomponent_as_ical_string) -# define icalcomponent_free EDSAbiWrapperSingleton.icalcomponent_free -# define icalcomponent_get_first_component EDSAbiWrapperSingleton.icalcomponent_get_first_component -# define icalcomponent_get_first_property EDSAbiWrapperSingleton.icalcomponent_get_first_property -# define icalcomponent_get_next_component EDSAbiWrapperSingleton.icalcomponent_get_next_component -# define icalcomponent_get_next_property EDSAbiWrapperSingleton.icalcomponent_get_next_property -# define icalcomponent_get_recurrenceid EDSAbiWrapperSingleton.icalcomponent_get_recurrenceid -# define icalcomponent_get_timezone EDSAbiWrapperSingleton.icalcomponent_get_timezone -# define icalcomponent_get_location EDSAbiWrapperSingleton.icalcomponent_get_location -# define icalcomponent_get_summary EDSAbiWrapperSingleton.icalcomponent_get_summary -# define icalcomponent_get_uid EDSAbiWrapperSingleton.icalcomponent_get_uid -# define icalcomponent_get_dtstart EDSAbiWrapperSingleton.icalcomponent_get_dtstart -# define icalcomponent_set_dtstart EDSAbiWrapperSingleton.icalcomponent_set_dtstart -# define icalcomponent_isa EDSAbiWrapperSingleton.icalcomponent_isa -# define icalcomponent_new_clone EDSAbiWrapperSingleton.icalcomponent_new_clone -# define icalcomponent_new_from_string EDSAbiWrapperSingleton.icalcomponent_new_from_string -# define icalcomponent_new EDSAbiWrapperSingleton.icalcomponent_new -# define icalcomponent_merge_component EDSAbiWrapperSingleton.icalcomponent_merge_component -# define icalcomponent_remove_component EDSAbiWrapperSingleton.icalcomponent_remove_component -# define icalcomponent_remove_property EDSAbiWrapperSingleton.icalcomponent_remove_property -# define icalcomponent_set_uid EDSAbiWrapperSingleton.icalcomponent_set_uid -# define icalcomponent_set_recurrenceid EDSAbiWrapperSingleton.icalcomponent_set_recurrenceid -# define icalcomponent_vanew EDSAbiWrapperSingleton.icalcomponent_vanew -# define icalparameter_get_tzid EDSAbiWrapperSingleton.icalparameter_get_tzid -# define icalparameter_set_tzid EDSAbiWrapperSingleton.icalparameter_set_tzid -# define icalparameter_new_from_value_string EDSAbiWrapperSingleton.icalparameter_new_from_value_string -# define icalparameter_new_clone EDSAbiWrapperSingleton.icalparameter_new_clone -# define icalproperty_new_clone EDSAbiWrapperSingleton.icalproperty_new_clone -# define icalproperty_free EDSAbiWrapperSingleton.icalproperty_free -# define icalproperty_get_description EDSAbiWrapperSingleton.icalproperty_get_description -# define icalproperty_get_uid EDSAbiWrapperSingleton.icalproperty_get_uid -# define icalproperty_get_recurrenceid EDSAbiWrapperSingleton.icalproperty_get_recurrenceid -# define icalproperty_set_recurrenceid EDSAbiWrapperSingleton.icalproperty_set_recurrenceid -# define icalproperty_get_sequence EDSAbiWrapperSingleton.icalproperty_get_sequence -# define icalproperty_get_property_name EDSAbiWrapperSingleton.icalproperty_get_property_name -# define icalproperty_get_first_parameter EDSAbiWrapperSingleton.icalproperty_get_first_parameter -# define icalproperty_get_lastmodified EDSAbiWrapperSingleton.icalproperty_get_lastmodified -# define icalproperty_get_next_parameter EDSAbiWrapperSingleton.icalproperty_get_next_parameter -# define icalproperty_set_parameter EDSAbiWrapperSingleton.icalproperty_set_parameter -# define icalproperty_get_summary EDSAbiWrapperSingleton.icalproperty_get_summary -# define icalproperty_new_description EDSAbiWrapperSingleton.icalproperty_new_description -# define icalproperty_new_summary EDSAbiWrapperSingleton.icalproperty_new_summary -# define icalproperty_new_uid EDSAbiWrapperSingleton.icalproperty_new_uid -# define icalproperty_new_sequence EDSAbiWrapperSingleton.icalproperty_new_sequence -# define icalproperty_new_recurrenceid EDSAbiWrapperSingleton.icalproperty_new_recurrenceid -# define icalproperty_set_value_from_string EDSAbiWrapperSingleton.icalproperty_set_value_from_string -# define icalproperty_set_dtstamp EDSAbiWrapperSingleton.icalproperty_set_dtstamp -# define icalproperty_set_lastmodified EDSAbiWrapperSingleton.icalproperty_set_lastmodified -# define icalproperty_set_sequence EDSAbiWrapperSingleton.icalproperty_set_sequence -# define icalproperty_set_uid EDSAbiWrapperSingleton.icalproperty_set_uid -# define icalproperty_remove_parameter_by_kind EDSAbiWrapperSingleton.icalproperty_remove_parameter_by_kind -# define icalproperty_add_parameter EDSAbiWrapperSingleton.icalproperty_add_parameter -# define icalproperty_get_value_as_string (EDSAbiWrapperSingleton.icalproperty_get_value_as_string_r ? EDSAbiWrapperSingleton.icalproperty_get_value_as_string_r : (char *(*)(const icalproperty*))EDSAbiWrapperSingleton.icalproperty_get_value_as_string) -# define icalproperty_get_x_name EDSAbiWrapperSingleton.icalproperty_get_x_name -# define icalproperty_new_from_string EDSAbiWrapperSingleton.icalproperty_new_from_string -# define icaltime_is_null_time EDSAbiWrapperSingleton.icaltime_is_null_time -# define icaltime_is_utc EDSAbiWrapperSingleton.icaltime_is_utc -# define icaltime_as_ical_string (EDSAbiWrapperSingleton.icaltime_as_ical_string_r ? EDSAbiWrapperSingleton.icaltime_as_ical_string_r : EDSAbiWrapperSingleton.icaltime_as_ical_string) -# define icaltime_from_string EDSAbiWrapperSingleton.icaltime_from_string -# define icaltime_from_timet EDSAbiWrapperSingleton.icaltime_from_timet -# define icaltime_null_time EDSAbiWrapperSingleton.icaltime_null_time -# define icaltime_as_timet EDSAbiWrapperSingleton.icaltime_as_timet -# define icaltime_set_timezone EDSAbiWrapperSingleton.icaltime_set_timezone -# define icaltime_convert_to_zone EDSAbiWrapperSingleton.icaltime_convert_to_zone -# define icaltime_get_timezone EDSAbiWrapperSingleton.icaltime_get_timezone -# define icaltimezone_free EDSAbiWrapperSingleton.icaltimezone_free -# define icaltimezone_get_builtin_timezone EDSAbiWrapperSingleton.icaltimezone_get_builtin_timezone -# define icaltimezone_get_builtin_timezone_from_tzid EDSAbiWrapperSingleton.icaltimezone_get_builtin_timezone_from_tzid -# define icaltimezone_get_component EDSAbiWrapperSingleton.icaltimezone_get_component -# define icaltimezone_get_tzid EDSAbiWrapperSingleton.icaltimezone_get_tzid -# define icaltimezone_new EDSAbiWrapperSingleton.icaltimezone_new -# define icaltimezone_set_component EDSAbiWrapperSingleton.icaltimezone_set_component -# define icaltimezone_get_location EDSAbiWrapperSingleton.icaltimezone_get_location - -# define ical_tzid_prefix (*EDSAbiWrapperSingleton.ical_tzid_prefix) -# define icalerror_set_errno EDSAbiWrapperSingleton.icalerror_set_errno -# define icalproperty_new_dtstart EDSAbiWrapperSingleton.icalproperty_new_dtstart -# define icalproperty_new_rrule EDSAbiWrapperSingleton.icalproperty_new_rrule -# define icalproperty_new_tzid EDSAbiWrapperSingleton.icalproperty_new_tzid -# define icalproperty_new_tzname EDSAbiWrapperSingleton.icalproperty_new_tzname -# define icalproperty_new_tzoffsetfrom EDSAbiWrapperSingleton.icalproperty_new_tzoffsetfrom -# define icalproperty_new_tzoffsetto EDSAbiWrapperSingleton.icalproperty_new_tzoffsetto -# define icalproperty_new_x EDSAbiWrapperSingleton.icalproperty_new_x -# define icalproperty_set_x_name EDSAbiWrapperSingleton.icalproperty_set_x_name -# define icalrecur_iterator_free EDSAbiWrapperSingleton.icalrecur_iterator_free -# define icalrecur_iterator_new EDSAbiWrapperSingleton.icalrecur_iterator_new -# define icalrecur_iterator_next EDSAbiWrapperSingleton.icalrecur_iterator_next -# define icalrecurrencetype_clear EDSAbiWrapperSingleton.icalrecurrencetype_clear -# define icaltime_day_of_week EDSAbiWrapperSingleton.icaltime_day_of_week -# define icaltime_days_in_month EDSAbiWrapperSingleton.icaltime_days_in_month -# define icaltzutil_get_zone_directory EDSAbiWrapperSingleton.icaltzutil_get_zone_directory - -# endif /* ENABLE_ICAL */ -# ifdef ENABLE_BLUETOOTH -# define sdp_close EDSAbiWrapperSingleton.sdp_close -# define sdp_connect EDSAbiWrapperSingleton.sdp_connect -# define sdp_extract_pdu do_not_use_sdp_extract_pdu -# define sdp_extract_pdu_safe EDSAbiWrapperSingleton.sdp_extract_pdu_safe -# define sdp_extract_seqtype do_not_use_sdp_extract_seqtype -# define sdp_extract_seqtype_safe EDSAbiWrapperSingleton.sdp_extract_seqtype_safe -# define sdp_get_access_protos EDSAbiWrapperSingleton.sdp_get_access_protos -# define sdp_get_proto_port EDSAbiWrapperSingleton.sdp_get_proto_port -# define sdp_get_socket EDSAbiWrapperSingleton.sdp_get_socket -# define sdp_list_append EDSAbiWrapperSingleton.sdp_list_append -# define sdp_list_free EDSAbiWrapperSingleton.sdp_list_free -# define sdp_process EDSAbiWrapperSingleton.sdp_process -# define sdp_record_free EDSAbiWrapperSingleton.sdp_record_free -# define sdp_service_search_attr_async EDSAbiWrapperSingleton.sdp_service_search_attr_async -# define sdp_set_notify EDSAbiWrapperSingleton.sdp_set_notify -# define sdp_uuid128_create EDSAbiWrapperSingleton.sdp_uuid128_create -# define str2ba EDSAbiWrapperSingleton.str2ba -# endif /* ENABLE_BLUETOOTH */ -# endif /* EDS_ABI_WRAPPER_NO_REDEFINE */ - -#else /* EVOLUTION_COMPATIBILITY */ - -// This is necessary because in C++, 1 && 1 triggers -// a warning with some gcc versions. -#ifdef __cplusplus -# define EDS_ABI_HACK_TRUE true -#else -# define EDS_ABI_HACK_TRUE 1 -#endif - -# define EDSAbiHaveEbook EDS_ABI_HACK_TRUE -# define EDSAbiHaveEcal EDS_ABI_HACK_TRUE -# define EDSAbiHaveEdataserver EDS_ABI_HACK_TRUE -# define EDSAbiHaveIcal EDS_ABI_HACK_TRUE -# define SyncEvoHaveLibbluetooth EDS_ABI_HACK_TRUE - # if !defined(EDS_ABI_WRAPPER_NO_REDEFINE) && defined(HAVE_LIBICAL_R) # ifdef ENABLE_ICAL # ifndef LIBICAL_MEMFIXES @@ -525,234 +101,10 @@ extern struct EDSAbiWrapper EDSAbiWrapperSingleton; # endif /* LIBICAL_MEMFIXES */ # endif /* ENABLE_ICAL */ # endif /* EDS_ABI_WRAPPER_NO_REDEFINE */ -#endif /* EVOLUTION_COMPATIBILITY */ - -#if defined(EVOLUTION_ICAL_COMPATIBILITY) && defined(ENABLE_ICAL) -/* - * libical.so.1 inserted a new ICAL_ACKNOWLEDGED_PROPERTY at the start of the enum, - * causing a renumbering of the constants. We need to map the names to the right constants - * at runtime. - * - * Opening libical.so.1 instead of libical.so.0 is orthogonal to this: - * it can be done either via dlopen() with EVOLUTION_COMPATIBILITY, or - * by patching a shared library which was originally linked against - * libical.so.0. - * - * unchanged: ICAL_ANY_PROPERTY = 0, - * new, cannot depend on it: ICAL_ACKNOWLEDGED_PROPERTY, - * - * These are the original enum values from libical.so.0: - */ - enum { - EDSABI_ICAL_ACTION_PROPERTY = 1, - EDSABI_ICAL_ALLOWCONFLICT_PROPERTY, - EDSABI_ICAL_ATTACH_PROPERTY, - EDSABI_ICAL_ATTENDEE_PROPERTY, - EDSABI_ICAL_CALID_PROPERTY, - EDSABI_ICAL_CALMASTER_PROPERTY, - EDSABI_ICAL_CALSCALE_PROPERTY, - EDSABI_ICAL_CAPVERSION_PROPERTY, - EDSABI_ICAL_CARLEVEL_PROPERTY, - EDSABI_ICAL_CARID_PROPERTY, - EDSABI_ICAL_CATEGORIES_PROPERTY, - EDSABI_ICAL_CLASS_PROPERTY, - EDSABI_ICAL_CMD_PROPERTY, - EDSABI_ICAL_COMMENT_PROPERTY, - EDSABI_ICAL_COMPLETED_PROPERTY, - EDSABI_ICAL_COMPONENTS_PROPERTY, - EDSABI_ICAL_CONTACT_PROPERTY, - EDSABI_ICAL_CREATED_PROPERTY, - EDSABI_ICAL_CSID_PROPERTY, - EDSABI_ICAL_DATEMAX_PROPERTY, - EDSABI_ICAL_DATEMIN_PROPERTY, - EDSABI_ICAL_DECREED_PROPERTY, - EDSABI_ICAL_DEFAULTCHARSET_PROPERTY, - EDSABI_ICAL_DEFAULTLOCALE_PROPERTY, - EDSABI_ICAL_DEFAULTTZID_PROPERTY, - EDSABI_ICAL_DEFAULTVCARS_PROPERTY, - EDSABI_ICAL_DENY_PROPERTY, - EDSABI_ICAL_DESCRIPTION_PROPERTY, - EDSABI_ICAL_DTEND_PROPERTY, - EDSABI_ICAL_DTSTAMP_PROPERTY, - EDSABI_ICAL_DTSTART_PROPERTY, - EDSABI_ICAL_DUE_PROPERTY, - EDSABI_ICAL_DURATION_PROPERTY, - EDSABI_ICAL_EXDATE_PROPERTY, - EDSABI_ICAL_EXPAND_PROPERTY, - EDSABI_ICAL_EXRULE_PROPERTY, - EDSABI_ICAL_FREEBUSY_PROPERTY, - EDSABI_ICAL_GEO_PROPERTY, - EDSABI_ICAL_GRANT_PROPERTY, - EDSABI_ICAL_ITIPVERSION_PROPERTY, - EDSABI_ICAL_LASTMODIFIED_PROPERTY, - EDSABI_ICAL_LOCATION_PROPERTY, - EDSABI_ICAL_MAXCOMPONENTSIZE_PROPERTY, - EDSABI_ICAL_MAXDATE_PROPERTY, - EDSABI_ICAL_MAXRESULTS_PROPERTY, - EDSABI_ICAL_MAXRESULTSSIZE_PROPERTY, - EDSABI_ICAL_METHOD_PROPERTY, - EDSABI_ICAL_MINDATE_PROPERTY, - EDSABI_ICAL_MULTIPART_PROPERTY, - EDSABI_ICAL_NAME_PROPERTY, - EDSABI_ICAL_ORGANIZER_PROPERTY, - EDSABI_ICAL_OWNER_PROPERTY, - EDSABI_ICAL_PERCENTCOMPLETE_PROPERTY, - EDSABI_ICAL_PERMISSION_PROPERTY, - EDSABI_ICAL_PRIORITY_PROPERTY, - EDSABI_ICAL_PRODID_PROPERTY, - EDSABI_ICAL_QUERY_PROPERTY, - EDSABI_ICAL_QUERYLEVEL_PROPERTY, - EDSABI_ICAL_QUERYID_PROPERTY, - EDSABI_ICAL_QUERYNAME_PROPERTY, - EDSABI_ICAL_RDATE_PROPERTY, - EDSABI_ICAL_RECURACCEPTED_PROPERTY, - EDSABI_ICAL_RECUREXPAND_PROPERTY, - EDSABI_ICAL_RECURLIMIT_PROPERTY, - EDSABI_ICAL_RECURRENCEID_PROPERTY, - EDSABI_ICAL_RELATEDTO_PROPERTY, - EDSABI_ICAL_RELCALID_PROPERTY, - EDSABI_ICAL_REPEAT_PROPERTY, - EDSABI_ICAL_REQUESTSTATUS_PROPERTY, - EDSABI_ICAL_RESOURCES_PROPERTY, - EDSABI_ICAL_RESTRICTION_PROPERTY, - EDSABI_ICAL_RRULE_PROPERTY, - EDSABI_ICAL_SCOPE_PROPERTY, - EDSABI_ICAL_SEQUENCE_PROPERTY, - EDSABI_ICAL_STATUS_PROPERTY, - EDSABI_ICAL_STORESEXPANDED_PROPERTY, - EDSABI_ICAL_SUMMARY_PROPERTY, - EDSABI_ICAL_TARGET_PROPERTY, - EDSABI_ICAL_TRANSP_PROPERTY, - EDSABI_ICAL_TRIGGER_PROPERTY, - EDSABI_ICAL_TZID_PROPERTY, - EDSABI_ICAL_TZNAME_PROPERTY, - EDSABI_ICAL_TZOFFSETFROM_PROPERTY, - EDSABI_ICAL_TZOFFSETTO_PROPERTY, - EDSABI_ICAL_TZURL_PROPERTY, - EDSABI_ICAL_UID_PROPERTY, - EDSABI_ICAL_URL_PROPERTY, - EDSABI_ICAL_VERSION_PROPERTY, - EDSABI_ICAL_X_PROPERTY, - EDSABI_ICAL_XLICCLASS_PROPERTY, - EDSABI_ICAL_XLICCLUSTERCOUNT_PROPERTY, - EDSABI_ICAL_XLICERROR_PROPERTY, - EDSABI_ICAL_XLICMIMECHARSET_PROPERTY, - EDSABI_ICAL_XLICMIMECID_PROPERTY, - EDSABI_ICAL_XLICMIMECONTENTTYPE_PROPERTY, - EDSABI_ICAL_XLICMIMEENCODING_PROPERTY, - EDSABI_ICAL_XLICMIMEFILENAME_PROPERTY, - EDSABI_ICAL_XLICMIMEOPTINFO_PROPERTY, - EDSABI_ICAL_NO_PROPERTY - }; - -/* - * The defines rely on EDSAbiHaveIcal1 == 0 for libical.so.0 (= original enum value used - * unchanged) and EDSAbiHaveIcal1 == 1 for libical.so.1 (original value has to be incremented - * by one). - */ -# define ICAL_ACTION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_ACTION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_ALLOWCONFLICT_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_ALLOWCONFLICT_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_ATTACH_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_ATTACH_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_ATTENDEE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_ATTENDEE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CALID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CALID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CALMASTER_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CALMASTER_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CALSCALE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CALSCALE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CAPVERSION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CAPVERSION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CARLEVEL_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CARLEVEL_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CARID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CARID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CATEGORIES_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CATEGORIES_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CLASS_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CLASS_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CMD_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CMD_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_COMMENT_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_COMMENT_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_COMPLETED_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_COMPLETED_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_COMPONENTS_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_COMPONENTS_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CONTACT_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CONTACT_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CREATED_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CREATED_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_CSID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_CSID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DATEMAX_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DATEMAX_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DATEMIN_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DATEMIN_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DECREED_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DECREED_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DEFAULTCHARSET_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DEFAULTCHARSET_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DEFAULTLOCALE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DEFAULTLOCALE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DEFAULTTZID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DEFAULTTZID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DEFAULTVCARS_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DEFAULTVCARS_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DENY_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DENY_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DESCRIPTION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DESCRIPTION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DTEND_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DTEND_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DTSTAMP_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DTSTAMP_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DTSTART_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DTSTART_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DUE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DUE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_DURATION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_DURATION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_EXDATE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_EXDATE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_EXPAND_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_EXPAND_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_EXRULE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_EXRULE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_FREEBUSY_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_FREEBUSY_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_GEO_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_GEO_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_GRANT_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_GRANT_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_ITIPVERSION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_ITIPVERSION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_LASTMODIFIED_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_LASTMODIFIED_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_LOCATION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_LOCATION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_MAXCOMPONENTSIZE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_MAXCOMPONENTSIZE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_MAXDATE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_MAXDATE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_MAXRESULTS_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_MAXRESULTS_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_MAXRESULTSSIZE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_MAXRESULTSSIZE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_METHOD_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_METHOD_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_MINDATE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_MINDATE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_MULTIPART_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_MULTIPART_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_NAME_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_NAME_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_ORGANIZER_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_ORGANIZER_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_OWNER_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_OWNER_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_PERCENTCOMPLETE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_PERCENTCOMPLETE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_PERMISSION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_PERMISSION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_PRIORITY_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_PRIORITY_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_PRODID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_PRODID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_QUERY_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_QUERY_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_QUERYLEVEL_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_QUERYLEVEL_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_QUERYID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_QUERYID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_QUERYNAME_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_QUERYNAME_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RDATE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RDATE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RECURACCEPTED_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RECURACCEPTED_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RECUREXPAND_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RECUREXPAND_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RECURLIMIT_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RECURLIMIT_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RECURRENCEID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RECURRENCEID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RELATEDTO_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RELATEDTO_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RELCALID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RELCALID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_REPEAT_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_REPEAT_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_REQUESTSTATUS_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_REQUESTSTATUS_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RESOURCES_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RESOURCES_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RESTRICTION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RESTRICTION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_RRULE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_RRULE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_SCOPE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_SCOPE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_SEQUENCE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_SEQUENCE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_STATUS_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_STATUS_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_STORESEXPANDED_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_STORESEXPANDED_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_SUMMARY_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_SUMMARY_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_TARGET_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_TARGET_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_TRANSP_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_TRANSP_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_TRIGGER_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_TRIGGER_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_TZID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_TZID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_TZNAME_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_TZNAME_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_TZOFFSETFROM_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_TZOFFSETFROM_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_TZOFFSETTO_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_TZOFFSETTO_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_TZURL_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_TZURL_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_UID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_UID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_URL_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_URL_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_VERSION_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_VERSION_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_X_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_X_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICCLASS_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICCLASS_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICCLUSTERCOUNT_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICCLUSTERCOUNT_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICERROR_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICERROR_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICMIMECHARSET_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICMIMECHARSET_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICMIMECID_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICMIMECID_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICMIMECONTENTTYPE_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICMIMECONTENTTYPE_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICMIMEENCODING_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICMIMEENCODING_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICMIMEFILENAME_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICMIMEFILENAME_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_XLICMIMEOPTINFO_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_XLICMIMEOPTINFO_PROPERTY + EDSAbiHaveIcal1)) -# define ICAL_NO_PROPERTY ((icalproperty_kind)(EDSABI_ICAL_NO_PROPERTY + EDSAbiHaveIcal1)) -#endif /* EVOLUTION_ICAL_COMPATIBILITY && ENABLE_ICAL */ const char *EDSAbiWrapperInfo(); const char *EDSAbiWrapperDebug(); +void EDSAbiWrapperInit(); #ifdef __cplusplus } diff --git a/src/syncevo/icalstrdup.c b/src/syncevo/icalstrdup.c index d71437e6..41b3d2be 100644 --- a/src/syncevo/icalstrdup.c +++ b/src/syncevo/icalstrdup.c @@ -20,7 +20,7 @@ #include "icalstrdup.h" #include <syncevo/eds_abi_wrapper.h> -#if !defined(LIBICAL_MEMFIXES) || defined(EVOLUTION_COMPATIBILITY) +#if !defined(LIBICAL_MEMFIXES) #if defined(HAVE_CONFIG_H) # include <config.h> @@ -56,20 +56,6 @@ char *ical_strdup(const char *x) } #endif -#ifdef EVOLUTION_COMPATIBILITY - // Another situation is when we have a libical with the - // _r variants of the relevant calls. We can call that directly, - // which has the advantage that we get the saner implementation. - // There have been crashes on Debian testing with libical 0.43-2 - // inside icalmemory_add_tmp_buffer/icaltime_as_ical_string. - // - // We assume here that if one _r variant was found, all of - // them are found. See also the wrappers in eds_abi_wrapper.h. - if (EDSAbiWrapperSingleton.icalcomponent_as_ical_string_r) { - return (char *)x; - } -#endif - return x ? strdup(x) : NULL; } diff --git a/src/syncevo/icalstrdup.h b/src/syncevo/icalstrdup.h index 8c501709..007916cd 100644 --- a/src/syncevo/icalstrdup.h +++ b/src/syncevo/icalstrdup.h @@ -38,7 +38,7 @@ extern "C" { #pragma } #endif /* __cplusplus */ -#if !defined(LIBICAL_MEMFIXES) || defined(EVOLUTION_COMPATIBILITY) +#if !defined(LIBICAL_MEMFIXES) /** * The patch in http://bugzilla.gnome.org/show_bug.cgi?id=516408 * changes the ownership of strings returned by some libical and libecal @@ -51,8 +51,6 @@ extern "C" { * As soon as Evolution switches to upstream libical (planned for 2.25), * it probably will have to bump the libecal version because the API * is reverted so that binaries which free strings will crash. - * When EVOLUTION_COMPATIBILITY is defined, SyncEvolution deals with - * this by always checking at runtime what the memory handling is. * * This utility function ensures that the caller *always* owns the * returned string. When compiled against a current Evolution diff --git a/src/syncevo/icaltz-util-wrapper.c b/src/syncevo/icaltz-util-wrapper.c new file mode 100644 index 00000000..104c485a --- /dev/null +++ b/src/syncevo/icaltz-util-wrapper.c @@ -0,0 +1,42 @@ +#define _GNU_SOURCE 1 +#include <dlfcn.h> + +static void *(*icaltimezone_get_component_p)(void *zone); +static void *(*icaltzutil_fetch_timezone_p)(const char *location); + +static void init() +{ + static int initialized; + if (!initialized) { + static void *icaltzutil; + icaltzutil = dlopen("libsyncevo-icaltz-util.so.0", RTLD_LAZY|RTLD_LOCAL); + if (icaltzutil) { + icaltimezone_get_component_p = dlsym(icaltzutil, "icaltimezone_get_component"); + icaltzutil_fetch_timezone_p = dlsym(icaltzutil, "icaltzutil_fetch_timezone"); + } else { + icaltimezone_get_component_p = dlsym(RTLD_NEXT, "icaltimezone_get_component"); + icaltzutil_fetch_timezone_p = dlsym(RTLD_NEXT, "icaltzutil_fetch_timezone"); + } + initialized = 1; + } +} + + +void *icaltimezone_get_component(void *zone) +{ + init(); + return icaltimezone_get_component_p(zone); +} + +void *icaltzutil_fetch_timezone(const char *location) +{ + init(); + return icaltzutil_fetch_timezone_p(location); +} + +/* + * For including the .o file in binaries via -Wl,-usyncevo_fetch_timezone. + * We cannot use -Wl,-uicaltzutil_fetch_timezone because that gets satisfied by + * libical itself. + */ +int syncevo_fetch_timezone; diff --git a/src/syncevo/icaltz-util.c b/src/syncevo/icaltz-util.c index 0820a77c..202a2cd9 100644 --- a/src/syncevo/icaltz-util.c +++ b/src/syncevo/icaltz-util.c @@ -643,21 +643,6 @@ icalcomponent *icaltimezone_get_component(icaltimezone *zone) return comp; } -/* - * For including the .o file in binaries via -Wl,-usyncevo_fetch_timezone. - * We cannot use -Wl,-uicaltzutil_fetch_timezone because that gets satisfied by - * libical itself. - */ -int syncevo_fetch_timezone; - -/* - * Avoid lazy resolution of the methods that we export. client-test otherwise - * ends up calling the libical version of the methods despite having its own - * copy compiled into the executable, at least on Ubuntu Saucy and Trusty. - */ -/* void *syncevo_fetch_timezone_p = &icaltzutil_fetch_timezone; */ -/* void *syncevo_get_component_p = &icaltimezone_get_component; */ - #ifdef ICALTZ_UTIL_MAIN int main (int argc, char *argv []) diff --git a/src/syncevo/icaltz-util.h b/src/syncevo/icaltz-util.h index 1900cebd..bb785a06 100644 --- a/src/syncevo/icaltz-util.h +++ b/src/syncevo/icaltz-util.h @@ -35,10 +35,8 @@ extern "C" { #define ZONES_TAB_SYSTEM_FILENAME "zone.tab" #endif -#if !defined(EVOLUTION_COMPATIBILITY) || !defined(ENABLE_ICAL) const char *icaltzutil_get_zone_directory (void); extern const char *ical_tzid_prefix; -#endif icalcomponent *icaltzutil_fetch_timezone (const char *location); #ifdef __cplusplus diff --git a/src/syncevo/installcheck-local.sh b/src/syncevo/installcheck-local.sh index fdfd5011..2d097a23 100755 --- a/src/syncevo/installcheck-local.sh +++ b/src/syncevo/installcheck-local.sh @@ -1,7 +1,6 @@ #!/bin/sh # -# usage: PKG_CONFIG_PATH=... installcheck-local.sh <path to syncevo header files> <DESTDIR> - +# usage: PKG_CONFIG_PATH=... installcheck-local.sh <path to syncevo header files> <path to syncevo libraries> <extra ld flags> set -ex DIR=`mktemp -d` @@ -53,4 +52,4 @@ done # must take DESTDIR into account by adding -L<libdir> (skipped when equal to /usr/lib) # and modifying any additional paths including that pkg-config --libs syncevolution -env LD_LIBRARY_PATH=$3:$3/syncevolution:$LD_LIBRARY_PATH $CXX -v $TMPFILE_O -o $TMPFILE "-L$3" `pkg-config --libs syncevolution | sed -e "s;/usr/lib;$3;g"` +env LD_LIBRARY_PATH=$3:$3/syncevolution:$LD_LIBRARY_PATH $CXX -v $TMPFILE_O -o $TMPFILE "-L$3" `pkg-config --libs syncevolution | sed -e "s;/usr/lib;$3;g"` $4 diff --git a/src/syncevo/syncevo.am b/src/syncevo/syncevo.am index aff0a5dd..7720dc64 100644 --- a/src/syncevo/syncevo.am +++ b/src/syncevo/syncevo.am @@ -14,6 +14,33 @@ src_syncevo_cxxflags += $(CPPUNIT_CFLAGS) src_syncevo_ldadd += $(CPPUNIT_LIBS) endif +# libsyncevo-icaltz-util.so.1 replaces libical 1.0 system time zone +# loading with the code from libical before 1.0, which produces +# interoperable time zone definitions. +# +# The .so depends on libical.so.1 and thus won't load on +# distros with libical.so.2, but there it isn't necessary +# anymore because libical 2.0 supports producing interoperable +# definitions again. +# +# Because the dynamic linker will find icaltzutil_fetch_timezone() +# first in libical instead of libsyncevo-icaltz-util when both +# are loaded, we have to provide the functions we want to override +# in the actual binaries. libsyncevo-icaltz-util-wrapper.la does that. +# It gets used in src/src.am. +if ENABLE_ICALTZ_UTIL +lib_LTLIBRARIES += src/syncevo/libsyncevo-icaltz-util.la +noinst_LTLIBRARIES += src/syncevo/libsyncevo-icaltz-util-wrapper.la +endif +src_syncevo_libsyncevo_icaltz_util_la_SOURCES = \ + src/syncevo/icaltz-util.h \ + src/syncevo/icaltz-util.c +src_syncevo_libsyncevo_icaltz_util_la_CFLAGS = $(LIBICAL_CFLAGS) +src_syncevo_libsyncevo_icaltz_util_la_LIBADD = $(LIBICAL_LIBS) +src_syncevo_libsyncevo_icaltz_util_wrapper_la_SOURCES = \ + src/syncevo/icaltz-util-wrapper.c +src_syncevo_libsyncevo_icaltz_util_wrapper_la_LIBADD = -ldl + lib_LTLIBRARIES += src/syncevo/libsyncevolution.la src_syncevo_sources = \ @@ -161,15 +188,6 @@ src_syncevo_sources += \ src/syncevo/icalstrdup.h endif -if ENABLE_ICALTZ_UTIL -src_syncevo_sources += \ - src/syncevo/icaltz-util.c \ - src/syncevo/icaltz-util.h -if !ENABLE_EVOLUTION_COMPATIBILITY -src_syncevo_ldadd += $(LIBICAL_LIBS) -endif -endif - src_syncevo_libsyncevolution_includedir= $(includedir)/syncevo src_syncevo_libsyncevolution_include_HEADERS = \ src/syncevo/declarations.h \ |