diff --git a/pkgs/development/libraries/qt-6/default.nix b/pkgs/development/libraries/qt-6/default.nix index 1126c520acc3..074da9adb401 100644 --- a/pkgs/development/libraries/qt-6/default.nix +++ b/pkgs/development/libraries/qt-6/default.nix @@ -40,10 +40,12 @@ let inherit developerBuild; inherit (darwin.apple_sdk_11_0.frameworks) AGL AVFoundation AppKit GSS MetalKit; patches = [ - ./patches/qtbase-qmake-mkspecs-mac.patch - ./patches/qtbase-qmake-pkg-config.patch - ./patches/qtbase-tzdir.patch - ./patches/qtbase-variable-fonts.patch + ./patches/0001-qtbase-qmake-always-use-libname-instead-of-absolute-.patch + ./patches/0002-qtbase-qmake-fix-mkspecs-for-darwin.patch + ./patches/0003-qtbase-qmake-fix-includedir-in-generated-pkg-config.patch + ./patches/0004-qtbase-fix-locating-tzdir-on-NixOS.patch + ./patches/0005-qtbase-deal-with-a-font-face-at-index-0-as-Regular-f.patch + ./patches/0006-qtbase-qt-cmake-always-use-cmake-from-path.patch # Remove symlink check causing build to bail out and fail. # https://gitlab.kitware.com/cmake/cmake/-/issues/23251 (fetchpatch { diff --git a/pkgs/development/libraries/qt-6/patches/0001-qtbase-qmake-always-use-libname-instead-of-absolute-.patch b/pkgs/development/libraries/qt-6/patches/0001-qtbase-qmake-always-use-libname-instead-of-absolute-.patch new file mode 100644 index 000000000000..5a13930024fb --- /dev/null +++ b/pkgs/development/libraries/qt-6/patches/0001-qtbase-qmake-always-use-libname-instead-of-absolute-.patch @@ -0,0 +1,50 @@ +From 8880bc263a366aeb82056f0bf3f1b17b6ec26900 Mon Sep 17 00:00:00 2001 +From: Nick Cao +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/pkgs/development/libraries/qt-6/patches/qtbase-qmake-mkspecs-mac.patch b/pkgs/development/libraries/qt-6/patches/0002-qtbase-qmake-fix-mkspecs-for-darwin.patch similarity index 96% rename from pkgs/development/libraries/qt-6/patches/qtbase-qmake-mkspecs-mac.patch rename to pkgs/development/libraries/qt-6/patches/0002-qtbase-qmake-fix-mkspecs-for-darwin.patch index 0830a4432bf2..c628f9f25071 100644 --- a/pkgs/development/libraries/qt-6/patches/qtbase-qmake-mkspecs-mac.patch +++ b/pkgs/development/libraries/qt-6/patches/0002-qtbase-qmake-fix-mkspecs-for-darwin.patch @@ -1,5 +1,19 @@ +From 034db4e75ec749ac78fcf8235fa659b0eca83c30 Mon Sep 17 00:00:00 2001 +From: Nick Cao +Date: Fri, 14 Apr 2023 09:34:08 +0800 +Subject: [PATCH 2/6] qtbase: qmake: fix mkspecs for darwin + +--- + mkspecs/common/mac.conf | 2 +- + mkspecs/features/mac/default_post.prf | 263 -------------------------- + mkspecs/features/mac/default_pre.prf | 58 ------ + mkspecs/features/mac/sdk.mk | 27 --- + mkspecs/features/mac/sdk.prf | 61 ------ + mkspecs/features/mac/toolchain.prf | 5 - + 6 files changed, 1 insertion(+), 415 deletions(-) + diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf -index 61bea952..9909dae7 100644 +index 61bea952b2..9909dae726 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL = \ @@ -12,7 +26,7 @@ index 61bea952..9909dae7 100644 QMAKE_LFLAGS_REL_RPATH = diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf -index 09db1764..aadfce87 100644 +index 09db1764b1..aadfce875e 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -1,9 +1,5 @@ @@ -299,7 +313,7 @@ index 09db1764..aadfce87 100644 generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS generate_xcode_project.target = xcodeproj diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf -index e3534561..3b01424e 100644 +index e3534561a5..3b01424e67 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -1,60 +1,2 @@ @@ -364,7 +378,7 @@ index e3534561..3b01424e 100644 -xcode_copy_phase_strip_setting.value = NO -QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk -index a32ceacb..e69de29b 100644 +index a32ceacb6c..e69de29bb2 100644 --- a/mkspecs/features/mac/sdk.mk +++ b/mkspecs/features/mac/sdk.mk @@ -1,27 +0,0 @@ @@ -396,7 +410,7 @@ index a32ceacb..e69de29b 100644 - endif -endif diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf -index 3a9c2778..e69de29b 100644 +index 3a9c2778bb..e69de29bb2 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -1,61 +0,0 @@ @@ -462,7 +476,7 @@ index 3a9c2778..e69de29b 100644 - cache($$tool_variable, set stash, $$tool) -} diff --git a/mkspecs/features/mac/toolchain.prf b/mkspecs/features/mac/toolchain.prf -index df191eb1..e69de29b 100644 +index df191eb13c..e69de29bb2 100644 --- a/mkspecs/features/mac/toolchain.prf +++ b/mkspecs/features/mac/toolchain.prf @@ -1,5 +0,0 @@ @@ -471,3 +485,6 @@ index df191eb1..e69de29b 100644 -sdk: load(sdk) - -load(toolchain) +-- +2.39.2 + diff --git a/pkgs/development/libraries/qt-6/patches/qtbase-qmake-pkg-config.patch b/pkgs/development/libraries/qt-6/patches/0003-qtbase-qmake-fix-includedir-in-generated-pkg-config.patch similarity index 58% rename from pkgs/development/libraries/qt-6/patches/qtbase-qmake-pkg-config.patch rename to pkgs/development/libraries/qt-6/patches/0003-qtbase-qmake-fix-includedir-in-generated-pkg-config.patch index 90caaea1cf4d..df1effff83ef 100644 --- a/pkgs/development/libraries/qt-6/patches/qtbase-qmake-pkg-config.patch +++ b/pkgs/development/libraries/qt-6/patches/0003-qtbase-qmake-fix-includedir-in-generated-pkg-config.patch @@ -1,7 +1,17 @@ +From bc91f05db85b774f26d6bce86e2e618dfc7a6883 Mon Sep 17 00:00:00 2001 +From: Nick Cao +Date: Fri, 14 Apr 2023 09:34:46 +0800 +Subject: [PATCH 3/6] qtbase: qmake: fix includedir in generated pkg-config + +--- + qmake/generators/makefile.cpp | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp +index da585bd9b2..3abf9cee83 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp -@@ -3390,8 +3390,7 @@ MakefileGenerator::writePkgConfigFile() +@@ -3402,8 +3402,7 @@ MakefileGenerator::writePkgConfigFile() << varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ") // << varGlue("DEFINES","-D"," -D"," ") ; @@ -11,4 +21,6 @@ diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle") && libDir != QLatin1String("/Library/Frameworks")) { t << " -F${libdir}"; +-- +2.39.2 diff --git a/pkgs/development/libraries/qt-6/patches/qtbase-tzdir.patch b/pkgs/development/libraries/qt-6/patches/0004-qtbase-fix-locating-tzdir-on-NixOS.patch similarity index 84% rename from pkgs/development/libraries/qt-6/patches/qtbase-tzdir.patch rename to pkgs/development/libraries/qt-6/patches/0004-qtbase-fix-locating-tzdir-on-NixOS.patch index fc36130c7aad..1e66804a5c10 100644 --- a/pkgs/development/libraries/qt-6/patches/qtbase-tzdir.patch +++ b/pkgs/development/libraries/qt-6/patches/0004-qtbase-fix-locating-tzdir-on-NixOS.patch @@ -1,5 +1,14 @@ +From d612c1d7161f95864b9383df84b16d8c24fbcc9b Mon Sep 17 00:00:00 2001 +From: Nick Cao +Date: Fri, 14 Apr 2023 09:35:25 +0800 +Subject: [PATCH 4/6] qtbase: fix locating tzdir on NixOS + +--- + src/corelib/time/qtimezoneprivate_tz.cpp | 27 +++++++++++++++--------- + 1 file changed, 17 insertions(+), 10 deletions(-) + diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp -index 627a4a81..a5f50acc 100644 +index e87e34f76d..39bd79d4a4 100644 --- a/src/corelib/time/qtimezoneprivate_tz.cpp +++ b/src/corelib/time/qtimezoneprivate_tz.cpp @@ -51,7 +51,11 @@ typedef QHash QTzTimeZoneHash; @@ -15,7 +24,7 @@ index 627a4a81..a5f50acc 100644 if (!QFile::exists(path)) path = QStringLiteral("/usr/lib/zoneinfo/zone.tab"); -@@ -727,18 +731,21 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId) +@@ -729,18 +733,21 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId) if (!tzif.open(QIODevice::ReadOnly)) return ret; } else { @@ -46,3 +55,6 @@ index 627a4a81..a5f50acc 100644 } } } +-- +2.39.2 + diff --git a/pkgs/development/libraries/qt-6/patches/qtbase-variable-fonts.patch b/pkgs/development/libraries/qt-6/patches/0005-qtbase-deal-with-a-font-face-at-index-0-as-Regular-f.patch similarity index 83% rename from pkgs/development/libraries/qt-6/patches/qtbase-variable-fonts.patch rename to pkgs/development/libraries/qt-6/patches/0005-qtbase-deal-with-a-font-face-at-index-0-as-Regular-f.patch index 96952d1ad160..121fc09b6451 100644 --- a/pkgs/development/libraries/qt-6/patches/qtbase-variable-fonts.patch +++ b/pkgs/development/libraries/qt-6/patches/0005-qtbase-deal-with-a-font-face-at-index-0-as-Regular-f.patch @@ -1,8 +1,8 @@ -From 9ba9c690fb16188ff524b53def104e68e45cf5c3 Mon Sep 17 00:00:00 2001 +From 5bd3672c7870b2e46e2a734dc9a9cb1837375a1c Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Tue, 21 Mar 2023 15:48:49 +0800 -Subject: [PATCH] Deal with a font face at index 0 as Regular for Variable - fonts +Subject: [PATCH 5/6] qtbase: deal with a font face at index 0 as Regular for + Variable fonts Reference: https://bugreports.qt.io/browse/QTBUG-111994 --- diff --git a/pkgs/development/libraries/qt-6/patches/0006-qtbase-qt-cmake-always-use-cmake-from-path.patch b/pkgs/development/libraries/qt-6/patches/0006-qtbase-qt-cmake-always-use-cmake-from-path.patch new file mode 100644 index 000000000000..addd7a868317 --- /dev/null +++ b/pkgs/development/libraries/qt-6/patches/0006-qtbase-qt-cmake-always-use-cmake-from-path.patch @@ -0,0 +1,32 @@ +From f0017e872297168ab616096180891c7f312ef1a1 Mon Sep 17 00:00:00 2001 +From: Nick Cao +Date: Wed, 12 Apr 2023 10:13:50 +0800 +Subject: [PATCH 6/6] qtbase: qt-cmake: always use cmake from path + +The generated qt-cmake scripts embeds the absolute path of cmake used +during the build of qtbase, bloating the runtime closure of qtbase. +--- + bin/qt-cmake.in | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/bin/qt-cmake.in b/bin/qt-cmake.in +index f719257f60..571ffe788f 100755 +--- a/bin/qt-cmake.in ++++ b/bin/qt-cmake.in +@@ -4,12 +4,7 @@ + script_dir_path=`dirname $0` + script_dir_path=`(cd "$script_dir_path"; /bin/pwd)` + +-# Try to use original cmake, otherwise to make it relocatable, use any cmake found in PATH. +-original_cmake_path="@CMAKE_COMMAND@" +-cmake_path=$original_cmake_path +-if ! test -f "$cmake_path"; then +- cmake_path="cmake" +-fi ++cmake_path="cmake" + + toolchain_path="$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake" + +-- +2.39.2 +