3
0
Fork 0
forked from mirrors/nixpkgs

kde5.kinit: get library path from NIX_PROFILES

This commit is contained in:
Thomas Tuegel 2016-04-11 08:26:50 -05:00
parent 57474b7d4a
commit afe5a05c93
4 changed files with 34 additions and 44 deletions

View file

@ -1,42 +0,0 @@
From 723c9b1268a04127647a1c20eebe9804150566dd Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@gmail.com>
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

View file

@ -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 ];
};

View file

@ -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()) {

View file

@ -0,0 +1 @@
kinit-libpath.patch