[qt5] MinGW build fixes (#29505)

* [qt5] MinGW build fixes

* [qt5] Remove e-mail headers from mingw9.patch

* [qt5] Run vcpkg x-add-version

* Cleanup qt5-base icu libs setup

Windows-shared needs different options. Patch obsolete.

* Check early for mingw32-make

* Revise make install path fixup

---------

Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
Todor Prokopov 2023-02-22 23:17:37 +02:00 committed by GitHub
parent 90e3d2b253
commit 82e03905f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 79 additions and 54 deletions

View File

@ -3,7 +3,9 @@ function(find_qt_mkspec TARGET_PLATFORM_MKSPEC_OUT HOST_PLATFORM_MKSPEC_OUT EXT_
if(NOT DEFINED VCPKG_QT_TARGET_MKSPEC)
message(STATUS "Figuring out qt target mkspec. Target arch ${VCPKG_TARGET_ARCHITECTURE}")
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_IS_UWP)
if(VCPKG_TARGET_IS_MINGW)
set(_tmp_targ_out "win32-g++")
elseif(VCPKG_TARGET_IS_UWP)
if(VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
set(msvc_year "2015")
elseif(VCPKG_PLATFORM_TOOLSET STREQUAL "v141")

View File

@ -2,7 +2,11 @@ include(qt_fix_makefile_install)
function(install_qt)
if(CMAKE_HOST_WIN32)
if (VCPKG_QMAKE_USE_NMAKE)
if(VCPKG_TARGET_IS_MINGW)
find_program(MINGW32_MAKE mingw32-make REQUIRED)
set(INVOKE "${MINGW32_MAKE}" -j${VCPKG_CONCURRENCY})
set(INVOKE_SINGLE "${MINGW32_MAKE}" -j1)
elseif (VCPKG_QMAKE_USE_NMAKE)
find_program(NMAKE nmake REQUIRED)
set(INVOKE "${NMAKE}")
set(INVOKE_SINGLE "${NMAKE}")

View File

@ -1,30 +1,33 @@
#Could probably be a vcpkg_fix_makefile_install for other ports?
function(qt_fix_makefile_install BUILD_DIR)
#Fix the installation location
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR)
if(WIN32)
string(SUBSTRING "${NATIVE_INSTALLED_DIR}" 2 -1 INSTALLED_DIR_WITHOUT_DRIVE)
string(SUBSTRING "${NATIVE_PACKAGES_DIR}" 2 -1 PACKAGES_DIR_WITHOUT_DRIVE)
set(MSYS_HACK "")
if(VCPKG_HOST_IS_WINDOWS)
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR)
if(VCPKG_TARGET_IS_MINGW)
set(MSYS_HACK ":@msyshack@%=%")
file(STRINGS "${BUILD_DIR}/Makefile" using_sh REGEX "= rm -f")
if(using_sh)
set(NATIVE_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}")
set(NATIVE_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}")
endif()
endif()
string(SUBSTRING "${NATIVE_INSTALLED_DIR}" 0 2 INSTALLED_DRIVE)
string(SUBSTRING "${NATIVE_PACKAGES_DIR}" 0 2 PACKAGES_DRIVE)
string(SUBSTRING "${NATIVE_INSTALLED_DIR}" 2 -1 INSTALLED_DIR_WITHOUT_DRIVE)
string(SUBSTRING "${NATIVE_PACKAGES_DIR}" 2 -1 PACKAGES_DIR_WITHOUT_DRIVE)
else()
set(INSTALLED_DRIVE)
set(PACKAGES_DRIVE)
set(INSTALLED_DIR_WITHOUT_DRIVE ${NATIVE_INSTALLED_DIR})
set(PACKAGES_DIR_WITHOUT_DRIVE ${NATIVE_PACKAGES_DIR})
set(INSTALLED_DRIVE "")
set(PACKAGES_DRIVE "")
set(INSTALLED_DIR_WITHOUT_DRIVE "${CURRENT_INSTALLED_DIR}")
set(PACKAGES_DIR_WITHOUT_DRIVE "${CURRENT_PACKAGES_DIR}")
endif()
set(installed "${INSTALLED_DRIVE}$(INSTALL_ROOT${MSYS_HACK})${INSTALLED_DIR_WITHOUT_DRIVE}")
set(packages "${PACKAGES_DRIVE}$(INSTALL_ROOT${MSYS_HACK})${PACKAGES_DIR_WITHOUT_DRIVE}")
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR)
file(GLOB_RECURSE MAKEFILES "${BUILD_DIR}/*Makefile*")
foreach(MAKEFILE ${MAKEFILES})
file(READ "${MAKEFILE}" _contents)
#Set the correct install directory to packages
string(REPLACE "${INSTALLED_DRIVE}$(INSTALL_ROOT)${INSTALLED_DIR_WITHOUT_DRIVE}" "${PACKAGES_DRIVE}$(INSTALL_ROOT)${PACKAGES_DIR_WITHOUT_DRIVE}" _contents "${_contents}")
file(WRITE "${MAKEFILE}" "${_contents}")
vcpkg_replace_string("${MAKEFILE}" "${installed}" "${packages}")
endforeach()
endfunction()
endfunction()

View File

@ -1,24 +0,0 @@
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index de8d26a12..068b80c51 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -106,13 +106,17 @@
"headers": [ "unicode/utypes.h", "unicode/ucol.h", "unicode/ustring.h" ],
"sources": [
{
+ "libs": "",
"builds": {
- "debug": "-lsicuind -lsicuucd -lsicudtd",
- "release": "-lsicuin -lsicuuc -lsicudt"
+ "debug": "-licuind -licuucd -licudtd",
+ "release": "-licuin -licuuc -licudt"
},
"condition": "config.win32 && !features.shared"
},
+ { "libs": "-licuind -licuucd -licudtd", "condition": "config.win32 && !features.shared"},
+ { "libs": "-licuin -licuuc -licudt", "condition": "config.win32 && !features.shared"},
{ "libs": "-licuin -licuuc -licudt", "condition": "config.win32 && features.shared" },
+ { "libs": "-licuind -licuucd -licudtd", "condition": "config.win32 && features.shared" },
{ "libs": "-licui18n -licuuc -licudata", "condition": "!config.win32" }
],
"use": [

View File

@ -0,0 +1,21 @@
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 075ce0ffac..0d3dd2e0b2 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -627,14 +627,14 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
return QFileSystemEntry(ret, QFileSystemEntry::FromInternalPath());
}
-#if defined(Q_CC_MINGW) && WINVER < 0x0602 // Windows 8 onwards
+#if defined(Q_CC_MINGW) && WINVER < 0x0602 && _WIN32_WINNT < _WIN32_WINNT_WIN8 // Windows 8 onwards
typedef struct _FILE_ID_INFO {
ULONGLONG VolumeSerialNumber;
FILE_ID_128 FileId;
} FILE_ID_INFO, *PFILE_ID_INFO;
-#endif // if defined (Q_CC_MINGW) && WINVER < 0x0602
+#endif // if defined(Q_CC_MINGW) && WINVER < 0x0602 && _WIN32_WINNT < _WIN32_WINNT_WIN8
// File ID for Windows up to version 7 and FAT32 drives
static inline QByteArray fileId(HANDLE handle)

View File

@ -9,6 +9,8 @@ qt5-base for qt5-x11extras requires several libraries from the system package ma
for a complete list of them.
]]
)
elseif(VCPKG_TARGET_IS_MINGW AND CMAKE_HOST_WIN32)
find_program(MINGW32_MAKE mingw32-make PATHS ENV PATH NO_DEFAULT_PATH REQUIRED)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
@ -50,7 +52,6 @@ qt_download_submodule( OUT_SOURCE_PATH SOURCE_PATH
patches/windows_prf.patch #fixes the qtmain dependency due to the above move
patches/qt_app.patch #Moves the target location of qt5 host apps to always install into the host dir.
patches/gui_configure.patch #Patches the gui configure.json to break freetype/fontconfig autodetection because it does not include its dependencies.
patches/icu.patch #Help configure find static icu builds in vcpkg on windows
patches/xlib.patch #Patches Xlib check to actually use Pkgconfig instead of makeSpec only
patches/egl.patch #Fix egl detection logic.
patches/mysql_plugin_include.patch #Fix include path of mysql plugin
@ -65,6 +66,7 @@ qt_download_submodule( OUT_SOURCE_PATH SOURCE_PATH
patches/create_cmake.patch
patches/Qt5GuiConfigExtras.patch # Patches the library search behavior for EGL since angle is not build with Qt
patches/fix_angle.patch # Failed to create OpenGL context for format QSurfaceFormat ...
patches/mingw9.patch # Fix compile with MinGW-W64 9.0.0: Redefinition of 'struct _FILE_ID_INFO'
)
# Remove vendored dependencies to ensure they are not picked up by the build
@ -173,8 +175,8 @@ find_library(ICUDATA_DEBUG NAMES icudatad libicudatad icudata libicudata icudtd
set(ICU_RELEASE "${ICUIN_RELEASE} ${ICULX_RELEASE} ${ICUUC_RELEASE} ${ICUIO_RELEASE} ${ICUDATA_RELEASE}")
set(ICU_DEBUG "${ICUIN_DEBUG} ${ICULX_DEBUG} ${ICUUC_DEBUG} ${ICUIO_DEBUG} ${ICUDATA_DEBUG}")
if(VCPKG_TARGET_IS_WINDOWS)
set(ICU_RELEASE "${ICU_RELEASE} Advapi32.lib")
set(ICU_DEBUG "${ICU_DEBUG} Advapi32.lib" )
set(ICU_RELEASE "${ICU_RELEASE} -ladvapi32")
set(ICU_DEBUG "${ICU_DEBUG} -ladvapi32" )
endif()
find_library(FONTCONFIG_RELEASE NAMES fontconfig PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
@ -204,7 +206,6 @@ set(RELEASE_OPTIONS
"LIBPNG_LIBS=${LIBPNG_RELEASE} ${ZLIB_RELEASE}"
"PCRE2_LIBS=${PCRE2_RELEASE}"
"FREETYPE_LIBS=${FREETYPE_RELEASE_ALL}"
"ICU_LIBS=${ICU_RELEASE}"
"QMAKE_LIBS_PRIVATE+=${BZ2_RELEASE}"
"QMAKE_LIBS_PRIVATE+=${LIBPNG_RELEASE}"
"QMAKE_LIBS_PRIVATE+=${ICU_RELEASE}"
@ -216,13 +217,23 @@ set(DEBUG_OPTIONS
"LIBPNG_LIBS=${LIBPNG_DEBUG} ${ZLIB_DEBUG}"
"PCRE2_LIBS=${PCRE2_DEBUG}"
"FREETYPE_LIBS=${FREETYPE_DEBUG_ALL}"
"ICU_LIBS=${ICU_DEBUG}"
"QMAKE_LIBS_PRIVATE+=${BZ2_DEBUG}"
"QMAKE_LIBS_PRIVATE+=${LIBPNG_DEBUG}"
"QMAKE_LIBS_PRIVATE+=${ICU_DEBUG}"
"QMAKE_LIBS_PRIVATE+=${ZSTD_DEBUG}"
)
# This if/else corresponds to icu setup in src/corelib/configure.json.
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND CORE_OPTIONS
"ICU_LIBS_RELEASE=${ICU_RELEASE}"
"ICU_LIBS_DEBUG=${ICU_DEBUG}"
)
else()
list(APPEND RELEASE_OPTIONS "ICU_LIBS=${ICU_RELEASE}")
list(APPEND DEBUG_OPTIONS "ICU_LIBS=${ICU_DEBUG}")
endif()
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_IS_UWP)
list(APPEND CORE_OPTIONS -appstore-compliant)
@ -232,7 +243,7 @@ if(VCPKG_TARGET_IS_WINDOWS)
else()
list(APPEND CORE_OPTIONS -opengl dynamic) # other possible option without moving angle dlls: "-opengl desktop". "-opengel es2" only works with commented patch
endif()
set(ADDITIONAL_WINDOWS_LIBS "ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib")
set(ADDITIONAL_WINDOWS_LIBS "-lws2_32 -lsecur32 -ladvapi32 -lshell32 -lcrypt32 -luser32 -lgdi32")
list(APPEND RELEASE_OPTIONS
"SQLITE_LIBS=${SQLITE_RELEASE}"
"HARFBUZZ_LIBS=${harfbuzz_LIBRARIES_RELEASE}"

View File

@ -1,7 +1,7 @@
{
"name": "qt5-base",
"version": "5.15.8",
"port-version": 3,
"port-version": 4,
"description": "Qt5 Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.",
"homepage": "https://www.qt.io/",
"license": null,

View File

@ -23,7 +23,10 @@ function(vcpkg_build_qmake)
set(ENV{_CL_} "/utf-8")
if(CMAKE_HOST_WIN32)
if (VCPKG_QMAKE_USE_NMAKE)
if(VCPKG_TARGET_IS_MINGW)
find_program(MINGW32_MAKE mingw32-make REQUIRED)
set(invoke_command "${MINGW32_MAKE}")
elseif (VCPKG_QMAKE_USE_NMAKE)
find_program(NMAKE nmake)
set(invoke_command "${NMAKE}")
get_filename_component(nmake_exe_path "${NMAKE}" DIRECTORY)

View File

@ -6314,7 +6314,7 @@
},
"qt5-base": {
"baseline": "5.15.8",
"port-version": 3
"port-version": 4
},
"qt5-canvas3d": {
"baseline": "0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1528baab40fce203129dc361128135b453e1ecb1",
"version": "5.15.8",
"port-version": 4
},
{
"git-tree": "6784bfaa6ca1ddf15b673165041defe84f289a9c",
"version": "5.15.8",