guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: gnu: qtbase: Fix qmake link directives.


From: guix-commits
Subject: 01/02: gnu: qtbase: Fix qmake link directives.
Date: Mon, 7 Aug 2023 23:36:51 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit 7c3df13f220157d2f432a9daf2a168eb954cbbef
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Mon Aug 7 16:42:24 2023 -0400

    gnu: qtbase: Fix qmake link directives.
    
    * gnu/packages/qt.scm (qtbase) [origin]: Add patch, specifying patches
    explicitly.
    [arguments] <phases>: Augment LIBRARY_PATH in check phase.
    * gnu/packages/patches/qtbase-qmake-use-libname.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                       |  1 +
 .../patches/qtbase-qmake-use-libname.patch         | 53 ++++++++++++++++++++++
 gnu/packages/qt.scm                                | 11 ++++-
 3 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 77707127a7..9d00596f39 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1870,6 +1870,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/qrcodegen-cpp-make-install.patch                \
   %D%/packages/patches/qtbase-absolute-runpath.patch           \
   %D%/packages/patches/qtbase-moc-ignore-gcc-macro.patch       \
+  %D%/packages/patches/qtbase-qmake-use-libname.patch          \
   %D%/packages/patches/qtbase-use-TZDIR.patch                  \
   %D%/packages/patches/qtscript-disable-tests.patch            \
   %D%/packages/patches/quagga-reproducible-build.patch          \
diff --git a/gnu/packages/patches/qtbase-qmake-use-libname.patch 
b/gnu/packages/patches/qtbase-qmake-use-libname.patch
new file mode 100644
index 0000000000..0bc2094d86
--- /dev/null
+++ b/gnu/packages/patches/qtbase-qmake-use-libname.patch
@@ -0,0 +1,53 @@
+Patch retrieved from NixOS
+https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/development/libraries/qt-6/patches/0001-qtbase-qmake-always-use-libname-instead-of-absolute-.patch
+
+From 8880bc263a366aeb82056f0bf3f1b17b6ec26900 Mon Sep 17 00:00:00 2001
+From: Nick Cao <nickcao@nichi.co>
+Date: Thu, 13 Apr 2023 23:42:29 +0800
+Subject: [PATCH 1/6] 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 32169e418c..4e754af367 100644
+--- a/cmake/QtFinishPrlFile.cmake
++++ b/cmake/QtFinishPrlFile.cmake
+@@ -61,9 +61,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 e3f4bbf881..f8bd26acc7 100644
+--- a/cmake/QtGenerateLibHelpers.cmake
++++ b/cmake/QtGenerateLibHelpers.cmake
+@@ -70,9 +70,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.39.2
+
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index e8654eee44..cecd6d13a1 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -609,7 +609,11 @@ developers using C++ or QML, a CSS & JavaScript like 
language.")
                             ;; are required by some internal bootstrap target
                             ;; used for the tools.
                             (list "double-conversion" "freetype" "harfbuzz-ng"
-                                  "libpng" "libjpeg" "sqlite" "xcb" 
"zlib"))))))
+                                  "libpng" "libjpeg" "sqlite" "xcb" "zlib"))))
+              (patches (search-patches "qtbase-use-TZDIR.patch"
+                                       "qtbase-moc-ignore-gcc-macro.patch"
+                                       "qtbase-absolute-runpath.patch"
+                                       "qtbase-qmake-use-libname.patch"))))
     (build-system cmake-build-system)
     (arguments
      (substitute-keyword-arguments (package-arguments qtbase-5)
@@ -716,6 +720,11 @@ developers using C++ or QML, a CSS & JavaScript like 
language.")
                           (string-append #$output
                                          ":" (getenv "CMAKE_PREFIX_PATH")))
                   (setenv "QMAKEPATH" (string-append #$output "/lib/qt6"))
+                  ;; It is necessary to augment LIBRARY_PATH with that of the
+                  ;; freshly installed qtbase because of the
+                  ;; 'qtbase-qmake-use-libname.patch' patch.
+                  (setenv "LIBRARY_PATH" (string-append #$output "/lib:"
+                                                        (getenv 
"LIBRARY_PATH")))
                   (setenv "QML2_IMPORT_PATH"
                           (string-append #$output "/lib/qt6/qml"))
                   (setenv "QT_PLUGIN_PATH"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]