diff --git a/pkgs/desktops/kde-5/frameworks-5.19/kinit/0001-kinit-libpath.patch b/pkgs/desktops/kde-5/frameworks-5.19/kinit/0001-kinit-libpath.patch deleted file mode 100644 index 9c76079a382a..000000000000 --- a/pkgs/desktops/kde-5/frameworks-5.19/kinit/0001-kinit-libpath.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 723c9b1268a04127647a1c20eebe9804150566dd Mon Sep 17 00:00:00 2001 -From: Thomas Tuegel -Date: Sat, 13 Jun 2015 08:57:55 -0500 -Subject: [PATCH] kinit libpath - ---- - src/kdeinit/kinit.cpp | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp -index 9e775b6..0ac5646 100644 ---- a/src/kdeinit/kinit.cpp -+++ b/src/kdeinit/kinit.cpp -@@ -660,15 +660,17 @@ static pid_t launch(int argc, const char *_name, const char *args, - if (!libpath.isEmpty()) { - if (!l.load()) { - if (libpath_relative) { -- // NB: Because Qt makes the actual dlopen() call, the -- // RUNPATH of kdeinit is *not* respected - see -- // https://sourceware.org/bugzilla/show_bug.cgi?id=13945 -- // - so we try hacking it in ourselves -- QString install_lib_dir = QFile::decodeName( -- CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/"); -- libpath = install_lib_dir + libpath; -- l.setFileName(libpath); -+ // Use QT_PLUGIN_PATH to find shared library directories -+ // For KF5, the plugin path is /lib/qt5/plugins/, so kdeinit5 -+ // shared libraries should be in /lib/qt5/plugins/../../ -+ const QRegExp pathSepRegExp(QString::fromLatin1("[:\b]")); -+ const QString up = QString::fromLocal8Bit("/../../"); -+ const QStringList paths = QString::fromLocal8Bit(qgetenv("QT_PLUGIN_PATH")).split(pathSepRegExp, QString::KeepEmptyParts); -+ Q_FOREACH (const QString &path, paths) { -+ l.setFileName(path + up + libpath); - l.load(); -+ if (l.isLoaded()) break; -+ } - } - } - if (!l.isLoaded()) { --- -2.4.2 - diff --git a/pkgs/desktops/kde-5/frameworks-5.19/kinit/default.nix b/pkgs/desktops/kde-5/frameworks-5.19/kinit/default.nix index 5f644d7c424e..64210ca76051 100644 --- a/pkgs/desktops/kde-5/frameworks-5.19/kinit/default.nix +++ b/pkgs/desktops/kde-5/frameworks-5.19/kinit/default.nix @@ -1,4 +1,4 @@ -{ kdeFramework, lib, extra-cmake-modules, kconfig, kcrash +{ kdeFramework, lib, copyPathsToStore, extra-cmake-modules, kconfig, kcrash , kdoctools, ki18n, kio, kservice, kwindowsystem, libcap , libcap_progs }: @@ -10,7 +10,7 @@ kdeFramework { nativeBuildInputs = [ extra-cmake-modules kdoctools libcap_progs ]; buildInputs = [ kconfig kcrash kservice libcap ]; propagatedBuildInputs = [ ki18n kio kwindowsystem ]; - patches = [ ./0001-kinit-libpath.patch ]; + patches = copyPathsToStore (lib.readPathsFromFile ./. ./series); meta = { maintainers = [ lib.maintainers.ttuegel ]; }; diff --git a/pkgs/desktops/kde-5/frameworks-5.19/kinit/kinit-libpath.patch b/pkgs/desktops/kde-5/frameworks-5.19/kinit/kinit-libpath.patch new file mode 100644 index 000000000000..52c5563ea581 --- /dev/null +++ b/pkgs/desktops/kde-5/frameworks-5.19/kinit/kinit-libpath.patch @@ -0,0 +1,31 @@ +Index: kinit-5.19.0/src/kdeinit/kinit.cpp +=================================================================== +--- kinit-5.19.0.orig/src/kdeinit/kinit.cpp ++++ kinit-5.19.0/src/kdeinit/kinit.cpp +@@ -658,15 +658,17 @@ static pid_t launch(int argc, const char + if (!libpath.isEmpty()) { + if (!l.load()) { + if (libpath_relative) { +- // NB: Because Qt makes the actual dlopen() call, the +- // RUNPATH of kdeinit is *not* respected - see +- // https://sourceware.org/bugzilla/show_bug.cgi?id=13945 +- // - so we try hacking it in ourselves +- QString install_lib_dir = QFile::decodeName( +- CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/"); +- libpath = install_lib_dir + libpath; +- l.setFileName(libpath); +- l.load(); ++ // Try to load the library relative to the active profiles. ++ QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' '); ++ // Reverse the profile list. ++ std::reverse(profiles.begin(), profiles.end()); ++ const QString libdir = QString::fromLatin1("/lib/"); ++ Q_FOREACH (const QByteArray &profile, profiles) { ++ if (!profile.isEmpty()) { ++ l.setFileName(QFile::decodeName(profile) + libdir + libpath); ++ if (l.load()) break; ++ } ++ } + } + } + if (!l.isLoaded()) { diff --git a/pkgs/desktops/kde-5/frameworks-5.19/kinit/series b/pkgs/desktops/kde-5/frameworks-5.19/kinit/series new file mode 100644 index 000000000000..5faa456366b9 --- /dev/null +++ b/pkgs/desktops/kde-5/frameworks-5.19/kinit/series @@ -0,0 +1 @@ +kinit-libpath.patch