about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch')
-rw-r--r--nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch
new file mode 100644
index 000000000000..b949723fb543
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch
@@ -0,0 +1,33 @@
+Index: kinit-5.32.0/src/kdeinit/kinit.cpp
+===================================================================
+--- kinit-5.32.0.orig/src/kdeinit/kinit.cpp
++++ kinit-5.32.0/src/kdeinit/kinit.cpp
+@@ -623,19 +623,15 @@ static pid_t launch(int argc, const char
+ 
+         if (!libpath.isEmpty()) {
+             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 "/");
+-                QString orig_libpath = libpath;
+-                libpath = install_lib_dir + libpath;
+-                l.setFileName(libpath);
+-                if (!l.load()) {
+-                    libpath = orig_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());
++                for (const QByteArray &profile: profiles) {
++                    if (!profile.isEmpty()) {
++                        l.setFileName(QFile::decodeName(profile) + QStringLiteral("/lib/") + libpath);
++                        if (l.load()) break;
++                    }
+                 }
+             } else {
+                 l.load();