| 1 | Patch retrieved from NixOS
|
| 2 | https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/development/libraries/qt-6/patches/0001-qtbase-qmake-always-use-libname-instead-of-absolute-.patch
|
| 3 |
|
| 4 | From 8880bc263a366aeb82056f0bf3f1b17b6ec26900 Mon Sep 17 00:00:00 2001
|
| 5 | From: Nick Cao <[email protected]>
|
| 6 | Date: Thu, 13 Apr 2023 23:42:29 +0800
|
| 7 | Subject: [PATCH 1/6] qtbase: qmake: always use libname instead of absolute
|
| 8 | path in qmake files
|
| 9 |
|
| 10 | In generated qmake files, absolute paths to qt libraries are embedded
|
| 11 | and then used in linker flags. However as the libraries can be provided
|
| 12 | by qt modules other than the one currently being built, the ebedded
|
| 13 | paths can be incorrect.
|
| 14 | ---
|
| 15 | diff --git a/cmake/QtFinishPrlFile.cmake b/cmake/QtFinishPrlFile.cmake
|
| 16 | index 32169e418c..4e754af367 100644
|
| 17 | |
| 18 | |
| 19 | @@ -69,9 +69,10 @@ foreach(line ${lines})
|
| 20 | endif()
|
| 21 | list(APPEND adjusted_libs "-framework" "${CMAKE_MATCH_1}")
|
| 22 | else()
|
| 23 | - # Not a framework, transform the Qt module into relocatable relative path.
|
| 24 | - qt_strip_library_version_suffix(relative_lib "${relative_lib}")
|
| 25 | - list(APPEND adjusted_libs "$$[QT_INSTALL_LIBS]/${relative_lib}")
|
| 26 | + # Not a framework, extract the library name and prepend an -l to make
|
| 27 | + # it relocatable.
|
| 28 | + qt_transform_absolute_library_paths_to_link_flags(lib_with_link_flag "${lib}")
|
| 29 | + list(APPEND adjusted_libs "${lib_with_link_flag}")
|
| 30 | endif()
|
| 31 | endif()
|
| 32 | else()
|
| 33 | diff --git a/cmake/QtGenerateLibHelpers.cmake b/cmake/QtGenerateLibHelpers.cmake
|
| 34 | index e3f4bbf881..f8bd26acc7 100644
|
| 35 | |
| 36 | |
| 37 | @@ -82,9 +82,6 @@ function(qt_transform_absolute_library_paths_to_link_flags out_var library_path_
|
| 38 | # If library_path isn't in default link directories, we should add it to link flags.
|
| 39 | # But we shouldn't add it duplicately.
|
| 40 | list(FIND IMPLICIT_LINK_DIRECTORIES_LOWER "${dir_lower}" index)
|
| 41 | - if(index EQUAL -1 AND NOT "-L\"${dir}\"" IN_LIST out_list)
|
| 42 | - list(APPEND out_list "-L\"${dir}\"")
|
| 43 | - endif()
|
| 44 | endif()
|
| 45 | list(APPEND out_list "${lib_name_with_link_flag}")
|
| 46 | else()
|