gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / kinit-kdeinit-libpath.patch
1 Search libraries in GUIX_KF5INIT_LIB_PATH.
2
3 Based on an idea by NixOs
4 pkgs/development/libraries/kde-frameworks/kinit/kinit-libpath.patch
5
6 ===================================================================
7 --- kinit-5.32.0/src/kdeinit/kinit.cpp.orig 2017-10-22 21:02:20.908765455 +0200
8 +++ kinit-5.32.0/src/kdeinit/kinit.cpp 2017-10-22 21:03:25.312818248 +0200
9 @@ -623,20 +623,18 @@
10 if (libpath_relative) {
11 // NB: Because Qt makes the actual dlopen() call, the
12 // RUNPATH of kdeinit is *not* respected - see
13 // https://sourceware.org/bugzilla/show_bug.cgi?id=13945
14 // - so we try hacking it in ourselves
15 - QString install_lib_dir = QFile::decodeName(
16 - CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/");
17 - QString orig_libpath = libpath;
18 - libpath = install_lib_dir + libpath;
19 - l.setFileName(libpath);
20 - if (!l.load()) {
21 - libpath = orig_libpath;
22 - l.setFileName(libpath);
23 - l.load();
24 - }
25 + // Try to load the library relative to the active profiles.
26 + QByteArrayList profiles = qgetenv("KDEINIT5_LIBRARY_PATH").split(':');
27 + for (const QByteArray &profile: profiles) {
28 + if (!profile.isEmpty()) {
29 + l.setFileName(QFile::decodeName(profile) + QStringLiteral("/") + libpath);
30 + if (l.load()) break;
31 + }
32 + }
33 } else {
34 l.load();
35 }
36 if (!l.isLoaded()) {
37 QString ltdlError(l.errorString());