about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/qt-6/patches/0001-qtbase-qmake-always-use-libname-instead-of-absolute-.patch
blob: a0ee1e11b068e3af5baf25c44373cdc21fae0677 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From afbe4002948e60ee3b27cb9be9e549ae416373f8 Mon Sep 17 00:00:00 2001
From: Nick Cao <nickcao@nichi.co>
Date: Thu, 13 Apr 2023 23:42:29 +0800
Subject: [PATCH 01/11] qtbase: qmake: always use libname instead of absolute
 path in qmake files

In generated qmake files, absolute paths to qt libraries are embedded
and then used in linker flags. However as the libraries can be provided
by qt modules other than the one currently being built, the ebedded
paths can be incorrect.
---
 cmake/QtFinishPrlFile.cmake      | 7 ++++---
 cmake/QtGenerateLibHelpers.cmake | 3 ---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/cmake/QtFinishPrlFile.cmake b/cmake/QtFinishPrlFile.cmake
index 1cf9377e6ce..ac4428bd7a1 100644
--- a/cmake/QtFinishPrlFile.cmake
+++ b/cmake/QtFinishPrlFile.cmake
@@ -64,9 +64,10 @@ foreach(line ${lines})
                         endif()
                         list(APPEND adjusted_libs "-framework" "${CMAKE_MATCH_1}")
                     else()
-                        # Not a framework, transform the Qt module into relocatable relative path.
-                        qt_strip_library_version_suffix(relative_lib "${relative_lib}")
-                        list(APPEND adjusted_libs "$$[QT_INSTALL_LIBS]/${relative_lib}")
+                        # Not a framework, extract the library name and prepend an -l to make
+                        # it relocatable.
+                        qt_transform_absolute_library_paths_to_link_flags(lib_with_link_flag "${lib}")
+                        list(APPEND adjusted_libs "${lib_with_link_flag}")
                     endif()
                 endif()
             else()
diff --git a/cmake/QtGenerateLibHelpers.cmake b/cmake/QtGenerateLibHelpers.cmake
index 3ffe354fd8d..441332d4582 100644
--- a/cmake/QtGenerateLibHelpers.cmake
+++ b/cmake/QtGenerateLibHelpers.cmake
@@ -73,9 +73,6 @@ function(qt_transform_absolute_library_paths_to_link_flags out_var library_path_
             string(TOLOWER "${dir}" dir_lower)
             # If library_path isn't in default link directories, we should add it to link flags.
             list(FIND IMPLICIT_LINK_DIRECTORIES_LOWER "${dir_lower}" index)
-            if(${index} EQUAL -1)
-                list(APPEND out_list "-L\"${dir}\"")
-            endif()
             list(APPEND out_list "${lib_name_with_link_flag}")
         else()
             list(APPEND out_list "${library_path}")
-- 
2.42.0