From: Modestas Vainius Subject: Framework for making libkdeinit4_*.so "private" Forwarded: no Origin: vendor Last-Update: 2013-09-04 The patch adds LIBKDEINIT_INSTALL_DIR cmake flag which specifies where libkdeinit4_*.so are supposed to end up. Please note, however, that libkdeinit4_*.so will not be automatically installed to LIBKDEINIT_INSTALL_DIR (but rather LIB_INSTALL_DIR) after cmake_install and you will need to be move to LIBKDEINIT_INSTALL_DIR manually in packaging (or e.g. with dh_movelibkdeinit). ENABLE_LIBKDEINIT_RUNPATH boolean variable controls whether to add RUNPATH to generated kdeinit executables. ENABLE_LIBKDEINIT_RUNPATH is OFF by default unless CMAKE_BUILD_TYPE is set to Debian. However, please note that CDBS kde.mk and debhelper kde addon/buildsystem set CMAKE_BUILD_TYPE=Debian and call dh_movelibkdeinit by default. The patch also adds support for "kdeinit" resource type to KDE Platform libraries. Index: kde4libs/CreateKDELibsDependenciesFile.cmake =================================================================== --- kde4libs.orig/CreateKDELibsDependenciesFile.cmake 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/CreateKDELibsDependenciesFile.cmake 2015-09-19 02:00:16.613327099 +0200 @@ -32,6 +32,7 @@ make_install_path_absolute(KDE4_LIB_INSTALL_DIR ${LIB_INSTALL_DIR}) make_install_path_absolute(KDE4_IMPORTS_INSTALL_DIR ${IMPORTS_INSTALL_DIR}) make_install_path_absolute(KDE4_LIBEXEC_INSTALL_DIR ${LIBEXEC_INSTALL_DIR}) +make_install_path_absolute(KDE4_LIBKDEINIT_INSTALL_DIR ${LIBKDEINIT_INSTALL_DIR}) make_install_path_absolute(KDE4_INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}) make_install_path_absolute(KDE4_BIN_INSTALL_DIR ${BIN_INSTALL_DIR}) make_install_path_absolute(KDE4_SBIN_INSTALL_DIR ${SBIN_INSTALL_DIR}) @@ -65,6 +66,7 @@ set(KDE4_LIB_INSTALL_DIR \"${KDE4_LIB_INSTALL_DIR}\") set(KDE4_IMPORTS_INSTALL_DIR \"${KDE4_IMPORTS_INSTALL_DIR}\") set(KDE4_LIBEXEC_INSTALL_DIR \"${KDE4_LIBEXEC_INSTALL_DIR}\") +set(KDE4_LIBKDEINIT_INSTALL_DIR \"${KDE4_LIBKDEINIT_INSTALL_DIR}\") set(KDE4_INCLUDE_INSTALL_DIR \"${KDE4_INCLUDE_INSTALL_DIR}\") set(KDE4_BIN_INSTALL_DIR \"${KDE4_BIN_INSTALL_DIR}\") set(KDE4_SBIN_INSTALL_DIR \"${KDE4_SBIN_INSTALL_DIR}\") Index: kde4libs/cmake/modules/FindKDE4Internal.cmake =================================================================== --- kde4libs.orig/cmake/modules/FindKDE4Internal.cmake 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/cmake/modules/FindKDE4Internal.cmake 2015-09-19 02:00:16.613327099 +0200 @@ -843,6 +843,7 @@ _set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix") _set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)") + _set_fancy(LIBKDEINIT_INSTALL_DIR "${LIB_INSTALL_DIR}" "The subdirectory relative to the install prefix where core libraries of the kdeinit based executables may be installed (default is ${LIB_INSTALL_DIR})") _set_fancy(IMPORTS_INSTALL_DIR "${PLUGIN_INSTALL_DIR}/imports" "The subdirectory relative to the install prefix where imports will be installed") _set_fancy(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir") _set_fancy(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data") @@ -1378,6 +1379,10 @@ endif (CMAKE_C_COMPILER MATCHES "icc") +if (CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE STREQUAL "Debian") + set(ENABLE_LIBKDEINIT_RUNPATH ON CACHE BOOL + "Add R(UN)PATH to kdeinit-based shared executables (defaults to ON if build type is Debian)") +endif (CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE STREQUAL "Debian") ########### end of platform specific stuff ########################## Index: kde4libs/cmake/modules/KDE4Macros.cmake =================================================================== --- kde4libs.orig/cmake/modules/KDE4Macros.cmake 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/cmake/modules/KDE4Macros.cmake 2015-09-19 02:00:16.617326937 +0200 @@ -841,6 +841,17 @@ endif(NOT _icon_position EQUAL -1) endif (Q_WS_MAC) kde4_add_executable(${_target_NAME} "${_nogui}" ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ${_resourcefile}) + if (UNIX AND ENABLE_LIBKDEINIT_RUNPATH) + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${LIBKDEINIT_INSTALL_DIR}" _isSystemKdeinitDir) + if("${_isSystemKdeinitDir}" STREQUAL "-1") + if (CMAKE_SKIP_RPATH) + set_target_properties(${_target_NAME} PROPERTIES LINK_FLAGS "-Wl,--enable-new-dtags,-rpath,'${LIBKDEINIT_INSTALL_DIR}'") + else (CMAKE_SKIP_RPATH) + set_target_properties(${_target_NAME} PROPERTIES INSTALL_RPATH "${LIBKDEINIT_INSTALL_DIR}" + LINK_FLAGS "-Wl,--enable-new-dtags") + endif (CMAKE_SKIP_RPATH) + endif("${_isSystemKdeinitDir}" STREQUAL "-1") + endif (UNIX AND ENABLE_LIBKDEINIT_RUNPATH) target_link_libraries(${_target_NAME} kdeinit_${_target_NAME}) endif(WIN32) Index: kde4libs/kinit/CMakeLists.txt =================================================================== --- kde4libs.orig/kinit/CMakeLists.txt 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/kinit/CMakeLists.txt 2015-09-19 02:00:16.641325969 +0200 @@ -58,6 +58,17 @@ install(TARGETS kdeinit4 ${INSTALL_TARGETS_DEFAULT_ARGS} ) +if (UNIX) + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${LIBKDEINIT_INSTALL_DIR}" _isSystemKdeinitDir) + if("${_isSystemKdeinitDir}" STREQUAL "-1") + if (CMAKE_SKIP_RPATH) + set_target_properties(kdeinit4 PROPERTIES LINK_FLAGS "-Wl,--enable-new-dtags,-rpath,'${LIBKDEINIT_INSTALL_DIR}'") + else (CMAKE_SKIP_RPATH) + set_target_properties(kdeinit4 PROPERTIES INSTALL_RPATH "${LIBKDEINIT_INSTALL_DIR}" + LINK_FLAGS "-Wl,--enable-new-dtags") + endif (CMAKE_SKIP_RPATH) + endif("${_isSystemKdeinitDir}" STREQUAL "-1") +endif (UNIX) ########### kwrapper4 ############### if (WIN32) set(kwrapper_SRCS kwrapper_win.cpp ) Index: kde4libs/config-prefix.h.cmake =================================================================== --- kde4libs.orig/config-prefix.h.cmake 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/config-prefix.h.cmake 2015-09-19 02:00:16.641325969 +0200 @@ -12,6 +12,7 @@ #define __KDE_EXECPREFIX "NONE" #define LIBEXEC_INSTALL_DIR "${LIBEXEC_INSTALL_DIR}" +#define LIBKDEINIT_INSTALL_DIR "${LIBKDEINIT_INSTALL_DIR}" #define DATA_INSTALL_DIR "${DATA_INSTALL_DIR}" #define LIB_INSTALL_DIR "${LIB_INSTALL_DIR}" #define INCLUDE_INSTALL_DIR "${INCLUDE_INSTALL_DIR}" Index: kde4libs/kdecore/kde-config.cpp =================================================================== --- kde4libs.orig/kdecore/kde-config.cpp 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/kdecore/kde-config.cpp 2015-09-19 02:00:16.645325808 +0200 @@ -144,6 +144,7 @@ "html", I18N_NOOP("HTML documentation"), "icon", I18N_NOOP("Icons"), "kcfg", I18N_NOOP("Configuration description files"), + "kdeinit", I18N_NOOP("kdeinit shared executables (resource added by Debian)"), "lib", I18N_NOOP("Libraries"), "include", I18N_NOOP("Includes/Headers"), "locale", I18N_NOOP("Translation files for KLocale"), Index: kde4libs/kdecore/kernel/kstandarddirs.cpp =================================================================== --- kde4libs.orig/kdecore/kernel/kstandarddirs.cpp 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/kdecore/kernel/kstandarddirs.cpp 2015-09-19 02:00:16.661325162 +0200 @@ -171,6 +171,8 @@ menus xdgconf-autostart autostart +kdeinit +%lib */ static const char types_string[] = @@ -225,6 +227,8 @@ "menus\0" "xdgconf-autostart\0" "autostart\0" + "kdeinit\0" + "%lib\0" "\0"; static const int types_indices[] = { @@ -234,7 +238,7 @@ 248, 258, 275, 285, 301, 305, 309, 316, 326, 336, 354, 359, 377, 387, 403, 416, 429, 442, 448, 463, 471, 484, 504, 217, - 517, 530, 536, 554, -1 + 517, 530, 536, 554, 564, 572, -1 }; static void tokenize(QStringList& token, const QString& str, Index: kde4libs/kdecore/kernel/kstandarddirs_unix.cpp =================================================================== --- kde4libs.orig/kdecore/kernel/kstandarddirs_unix.cpp 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/kdecore/kernel/kstandarddirs_unix.cpp 2015-09-19 02:00:16.661325162 +0200 @@ -40,6 +40,8 @@ return QFile::decodeName(KCFG_INSTALL_DIR "/"); if (strcmp("kdedir", type) == 0) return QFile::decodeName(KDEDIR "/"); + if (strcmp("kdeinit", type) == 0) + return QFile::decodeName(LIBKDEINIT_INSTALL_DIR "/"); break; case 'd': if (strcmp("data", type) == 0) Index: kde4libs/kdecore/kernel/kstandarddirs_win.cpp =================================================================== --- kde4libs.orig/kdecore/kernel/kstandarddirs_win.cpp 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/kdecore/kernel/kstandarddirs_win.cpp 2015-09-19 02:00:16.661325162 +0200 @@ -47,6 +47,8 @@ return share() + QLatin1String("config.kcfg/"); if (strcmp("kdedir", type) == 0) return prefix(); + if (strcmp("kdeinit", type) == 0) + return prefix() + QString::fromLatin1("lib" KDELIBSUFF "/"); break; case 'd': if (strcmp("data", type) == 0) Index: kde4libs/kdecore/util/kpluginloader.cpp =================================================================== --- kde4libs.orig/kdecore/util/kpluginloader.cpp 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/kdecore/util/kpluginloader.cpp 2015-09-19 02:00:16.673324678 +0200 @@ -113,6 +113,13 @@ libname = fileinfo.path() + QLatin1String("/lib") + fileinfo.fileName(); #endif + if (kdeinit) { + libfile = cData.dirs()->findResource("kdeinit", libname); + if (!libfile.isEmpty()) { + return libfile; + } + } + libfile = cData.dirs()->findResource("lib", libname); if (!libfile.isEmpty()) { if (!kdeinit) { Index: kde4libs/kinit/kinit.cpp =================================================================== --- kde4libs.orig/kinit/kinit.cpp 2015-09-19 02:00:16.681324355 +0200 +++ kde4libs/kinit/kinit.cpp 2015-09-19 02:00:16.677324517 +0200 @@ -498,11 +498,23 @@ // try to match an absolute path to an executable binary (either in bin/ or in libexec/) // to a kdeinit module in the same prefix if( lib.contains( QLatin1String( "/lib" KDELIBSUFF "/kde4/libexec/" ))) { - libpath = QString( lib ).replace( QLatin1String( "/lib" KDELIBSUFF "/kde4/libexec/" ), - QLatin1String("/lib" KDELIBSUFF "/libkdeinit4_")) + QLatin1String(".so"); + if ( lib.contains(KStandardDirs::installPath( "libexec" ))) { + libpath = QString( lib ).replace( KStandardDirs::installPath( "libexec" ), + KStandardDirs::installPath( "kdeinit" )) + QLatin1String(".so"); + } + if (libpath.isEmpty() || !QFile::exists( libpath )) { + libpath = QString( lib ).replace( QLatin1String( "/lib" KDELIBSUFF "/kde4/libexec/" ), + QLatin1String("/lib" KDELIBSUFF "/libkdeinit4_")) + QLatin1String(".so"); + } } else if( lib.contains( QLatin1String( "/bin/" ))) { - libpath = QString( lib ).replace( QLatin1String( "/bin/" ), - QLatin1String("/lib" KDELIBSUFF "/libkdeinit4_")) + QLatin1String(".so"); + if ( lib.contains(KStandardDirs::installPath( "exe" )) ) { + libpath = QString( lib ).replace( KStandardDirs::installPath( "exe" ), + KStandardDirs::installPath( "kdeinit" )) + QLatin1String(".so"); + } + if (libpath.isEmpty() || !QFile::exists( libpath )) { + libpath = QString( lib ).replace( QLatin1String( "/bin/" ), + QLatin1String("/lib" KDELIBSUFF "/libkdeinit4_")) + QLatin1String(".so"); + } } // Don't confuse the user with "Could not load libkdeinit4_foo.so" if it doesn't exist if (!QFile::exists(libpath)) {