From: Ralf Habacker Date: Fri, 29 Oct 2010 09:46:33 +0000 (+0200) Subject: Service dir related bug fix on windows. X-Git-Tag: dbus-1.4.1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8810a7940ad4bc5852196fdd8d21c82941ba14d;p=thirdparty%2Fdbus.git Service dir related bug fix on windows. The code for accessing services requires absolute pathes, which are based on DBUS_DATADIR. DBUS_DATADIR on windows is defined relative. This patch makes sure that those pathes are absolute. --- diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 53902bde4..17464132d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -23,6 +23,51 @@ endif(COMMAND cmake_policy) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules") +########### basic vars ############### + + +if (DBUSDIR) + set(DBUS_INSTALL_DIR "${DBUSDIR}") +endif (DBUSDIR) +if ($ENV{DBUSDIR}) + set(DBUS_INSTALL_DIR "$ENV{DBUSDIR}") +endif ($ENV{DBUSDIR}) + +if (DBUS_INSTALL_DIR) + set(CMAKE_INSTALL_PREFIX "${DBUS_INSTALL_DIR}" CACHE TYPE PATH FORCE) +else (DBUS_INSTALL_DIR) + set(DBUS_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}") +endif (DBUS_INSTALL_DIR) + +# autotools style +if (NOT DATAROOTDIR) + set (DATAROOTDIR share) +endif() + +if (NOT DATADIR) + set (DATADIR ${DATAROOTDIR}) +endif() + +if (NOT DOCDIR) + SET(DOCDIR ${DATAROOTDIR}/doc/dbus) +endif() + +if (NOT DBUS_DATADIR) + SET(DBUS_DATADIR ${DATADIR}) +endif() + +set(prefix ${DBUS_INSTALL_DIR}) +set(exec_prefix ${prefix}) +set(EXPANDED_LIBDIR ${DBUS_INSTALL_DIR}/lib) +set(EXPANDED_INCLUDEDIR ${DBUS_INSTALL_DIR}/include) +set(EXPANDED_BINDIR ${DBUS_INSTALL_DIR}/bin) +set(EXPANDED_SYSCONFDIR ${DBUS_INSTALL_DIR}/etc) +set(EXPANDED_DATADIR ${DBUS_INSTALL_DIR}/${DBUS_DATADIR}) +set(DBUS_MACHINE_UUID_FILE ${DBUS_INSTALL_DIR}/lib/dbus/machine-id) +set(DBUS_BINDIR ${EXPANDED_BINDIR}) +set(DBUS_DAEMONDIR ${EXPANDED_BINDIR}) + + #enable building of shared library SET(BUILD_SHARED_LIBS ON) @@ -170,33 +215,6 @@ set(DBUS_INCLUDES) ENABLE_TESTING() - -########### basic vars ############### - -if (DBUSDIR) - set(DBUS_INSTALL_DIR "${DBUSDIR}") -endif (DBUSDIR) -if ($ENV{DBUSDIR}) - set(DBUS_INSTALL_DIR "$ENV{DBUSDIR}") -endif ($ENV{DBUSDIR}) - -if (DBUS_INSTALL_DIR) - set(CMAKE_INSTALL_PREFIX "${DBUS_INSTALL_DIR}" CACHE TYPE PATH FORCE) -else (DBUS_INSTALL_DIR) - set(DBUS_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}") -endif (DBUS_INSTALL_DIR) - -set(prefix ${DBUS_INSTALL_DIR}) -set(exec_prefix ${prefix}) -set(EXPANDED_LIBDIR ${DBUS_INSTALL_DIR}/lib) -set(EXPANDED_INCLUDEDIR ${DBUS_INSTALL_DIR}/include) -set(EXPANDED_BINDIR ${DBUS_INSTALL_DIR}/bin) -set(EXPANDED_SYSCONFDIR ${DBUS_INSTALL_DIR}/etc) -set(EXPANDED_DATADIR ${DBUS_INSTALL_DIR}/data) -set(DBUS_MACHINE_UUID_FILE ${DBUS_INSTALL_DIR}/lib/dbus/machine-id) -set(DBUS_BINDIR ${EXPANDED_BINDIR}) -set(DBUS_DAEMONDIR ${EXPANDED_BINDIR}) - ########### command line options ############### # TODO: take check from configure.in @@ -424,7 +442,6 @@ if (WIN32) set (DBUS_SESSION_CONFIG_FILE "etc/dbus-1/session.conf") # bus-test expects a non empty string set (DBUS_USER "Administrator") - set (DBUS_DATADIR "data") else (WIN32) set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "unix:tmpdir=" CACHE STRING "system bus default address" ) set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "unix:path=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default address" ) @@ -433,7 +450,6 @@ else (WIN32) set (DBUS_SYSTEM_CONFIG_FILE ${configdir}/system.conf) set (DBUS_SESSION_CONFIG_FILE ${configdir}/session.conf) set (DBUS_USER "root") - set (DBUS_DATADIR ${EXPANDED_DATADIR}) endif (WIN32) set(DBUS_DAEMON_NAME dbus-daemon CACHE STRING "The name of the dbus daemon executable") diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt index f13e67803..afbd544ec 100644 --- a/cmake/dbus/CMakeLists.txt +++ b/cmake/dbus/CMakeLists.txt @@ -261,10 +261,9 @@ endif(MSVC_IDE) ### Client library add_library(dbus-1 SHARED - ${DBUS_LIB_SOURCES} - ${DBUS_SHARED_SOURCES} - ${DBUS_LIB_HEADERS} - ${DBUS_SHARED_HEADERS}) + ${libdbus_SOURCES} + ${libdbus_HEADERS} +) if(WIN32) if(WINCE) target_link_libraries(dbus-1 ws2) diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index ece106907..e51ccc848 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -42,6 +42,7 @@ #include "dbus-threads.h" #include "dbus-protocol.h" #include "dbus-string.h" +#include "dbus-sysdeps.h" #include "dbus-sysdeps-win.h" #include "dbus-protocol.h" #include "dbus-hash.h" @@ -2942,6 +2943,25 @@ _dbus_get_standard_session_servicedirs (DBusList **dirs) } } #else +/* + the code for accessing services requires absolute base pathes + in case DBUS_DATADIR is relative make it absolute +*/ +#ifdef DBUS_WIN + { + DBusString p; + + _dbus_string_init_const (&p, DBUS_DATADIR); + + if (!_dbus_path_is_absolute (&p)) + { + char install_root[1000]; + if (_dbus_get_install_root (install_root, sizeof(install_root))) + if (!_dbus_string_append (&servicedir_path, install_root)) + goto oom; + } + } +#endif if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR)) goto oom;