From 045e9ce66300d1cb8bc4d58610b4b1f63d859875 Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Sun, 30 Oct 2022 14:47:39 +0100
Subject: [PATCH 7/8] ! gnu: qtbase-5: Apply qtbase-cmake.patch.
* gnu/packages/qt.scm (qtbase-5)[source]: Apply qtbase-cmake.patch.
* gnu/local.mk: Add patch.
* gnu/packages/patches/qtbase-cmake.patch: New file.
@@ -1751,6 +1751,7 @@ dist_patch_DATA = \
%D%/packages/patches/qrcodegen-cpp-make-install.patch \
%D%/packages/patches/qtbase-absolute-runpath.patch \
%D%/packages/patches/qtbase-assert.patch \
+ %D%/packages/patches/qtbase-cmake.patch \
%D%/packages/patches/qtbase-moc-ignore-gcc-macro.patch \
%D%/packages/patches/qtbase-qtpluginpath.patch \
%D%/packages/patches/qtbase-replace-libdir.patch \
new file mode 100644
@@ -0,0 +1,195 @@
+From 7871fbcefc7596a458cec005edafd9d4962baea3 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:34:28 -0500
+Subject: [PATCH 05/11] qtbase-cmake
+
+---
+ mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in | 2 +-
+ mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in | 4 ++--
+ src/corelib/Qt5CoreConfigExtras.cmake.in | 10 +++++-----
+ src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in | 2 +-
+ .../Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in | 2 +-
+ src/dbus/Qt5DBusConfigExtras.cmake.in | 12 ++----------
+ src/gui/Qt5GuiConfigExtras.cmake.in | 6 +++---
+ src/widgets/Qt5WidgetsConfigExtras.cmake.in | 2 +-
+ 8 files changed, 16 insertions(+), 24 deletions(-)
+
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index b6c3ab8609..edb6a89316 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -574,7 +574,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+ !!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++ set(imported_location \"$$NIX_OUTPUT_DEV/${PLUGIN_LOCATION}\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+ !!ENDIF
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index b550a52c60..dbd3243885 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -53,10 +53,10 @@ set_property(TARGET Qt5::$$CMAKE_PLUGIN_NAME PROPERTY INTERFACE_SOURCES
+ !!ENDIF
+
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF
+
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
+diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
+index 4c1c3a612b..bb8ab08143 100644
+--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -6,7 +6,7 @@ if (NOT TARGET Qt5::qmake)
+ add_executable(Qt5::qmake IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++ set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -21,7 +21,7 @@ if (NOT TARGET Qt5::moc)
+ add_executable(Qt5::moc IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++ set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -38,7 +38,7 @@ if (NOT TARGET Qt5::rcc)
+ add_executable(Qt5::rcc IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++ set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -121,7 +121,7 @@ if (NOT TARGET Qt5::WinMain)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+ set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++ set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -135,7 +135,7 @@ if (NOT TARGET Qt5::WinMain)
+ set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++ set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+index c357237d0e..6f0c75de3c 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+@@ -1,6 +1,6 @@
+
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+index 706304cf34..546420f6ad 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+@@ -1,6 +1,6 @@
+
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
+index a814678f7b..b13b964ec8 100644
+--- a/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -2,11 +2,7 @@
+ if (NOT TARGET Qt5::qdbuscpp2xml)
+ add_executable(Qt5::qdbuscpp2xml IMPORTED)
+
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+- set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++ set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ _qt5_DBus_check_file_exists(${imported_location})
+
+ set_target_properties(Qt5::qdbuscpp2xml PROPERTIES
+@@ -17,11 +13,7 @@ endif()
+ if (NOT TARGET Qt5::qdbusxml2cpp)
+ add_executable(Qt5::qdbusxml2cpp IMPORTED)
+
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+- set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++ set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ _qt5_DBus_check_file_exists(${imported_location})
+
+ set_target_properties(Qt5::qdbusxml2cpp PROPERTIES
+diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
+index 84dbbfebd4..8ad0720c5c 100644
+--- a/src/gui/Qt5GuiConfigExtras.cmake.in
++++ b/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"$$NIX_OUTPUT_DEV/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATIO
+ set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++ set(imported_location \"$$NIX_OUTPUT_OUT/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+- set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++ set(imported_implib \"$$NIX_OUTPUT_OUT/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+ set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+index 83d8004a08..ca0b8e4bfb 100644
+--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
+ add_executable(Qt5::uic IMPORTED)
+
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++ set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+--
+2.25.4
+
+
@@ -299,6 +299,7 @@ (define-public qtbase-5
;; Use TZDIR to avoid depending on package "tzdata".
(patches (search-patches "qtbase-use-TZDIR.patch"
"qtbase-assert.patch"
+ "qtbase-cmake.patch"
"qtbase-qtpluginpath.patch"
"qtbase-replace-libdir.patch"
"qtbase-tbd-frameworks.patch"
@@ -436,6 +437,19 @@ (define-public qtbase-5
(substitute* '("mkspecs/features/qt_common.prf"
"mkspecs/features/qt_module.prf") (("..NIX_OUTPUT_OUT") #$output))
+ ;; qtbase-cmake.patch
+ (substitute* (list
+ "mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in"
+ "mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in"
+ "src/corelib/Qt5CoreConfigExtras.cmake.in"
+ "src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in"
+ "src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in"
+ "src/dbus/Qt5DBusConfigExtras.cmake.in"
+ "src/gui/Qt5GuiConfigExtras.cmake.in"
+ "src/widgets/Qt5WidgetsConfigExtras.cmake.in")
+ (("..NIX_OUTPUT_OUT") #$output)
+ (("..NIX_OUTPUT_DEV") #$output))
+
;; qtbase-qtpluginpath.patch
(substitute* "src/corelib/kernel/qcoreapplication.cpp"
(("NIXPKGS_QT_PLUGIN_PREFIX") (string-append "\"" #$output "/lib/qt5/qml\"")))))
--
2.37.2