mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
qt6.qtwebengine: clean up the patch situation
A lot of things that should have been patches were substituteInPlace instead. Some things just did not apply and broke stuff, some things did not apply and somehow did not break stuff, and no one noticed because no one reads warnings. So, move all the substituteInPlace bits that actually matter into proper patches, in some cases with cleaner ways of doing the same thing. Also, patch out debug symbol generation to make it build on Darwin again.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
--- a/configure.cmake
|
||||
+++ b/configure.cmake
|
||||
@@ -434,7 +434,7 @@ qt_webengine_configure_check("compiler"
|
||||
CONDITION MSVC OR
|
||||
(LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
|
||||
(LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
|
||||
- (MACOS AND CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
+ MACOS
|
||||
MESSAGE
|
||||
"${CMAKE_CXX_COMPILER_ID} compiler is not supported."
|
||||
)
|
||||
@@ -443,7 +443,7 @@ qt_webengine_configure_check("compiler"
|
||||
CONDITION MSVC OR
|
||||
(LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
|
||||
(LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
|
||||
- (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") OR
|
||||
+ APPLE OR
|
||||
(ANDROID AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
|
||||
(MINGW AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
|
||||
(MINGW AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
|
||||
--- a/src/gn/CMakeLists.txt
|
||||
+++ b/src/gn/CMakeLists.txt
|
||||
@@ -49,7 +49,7 @@ elseif(MSVC)
|
||||
set(platform msvc)
|
||||
elseif(MINGW)
|
||||
set(platform mingw)
|
||||
-elseif(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
|
||||
+elseif(APPLE)
|
||||
set(platform darwin)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported gn platform !")
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/3rdparty/chromium/build/config/apple/symbols.gni
|
||||
+++ b/src/3rdparty/chromium/build/config/apple/symbols.gni
|
||||
@@ -14,7 +14,7 @@ declare_args() {
|
||||
# the //build/toolchain/apple/linker_driver.py. Enabling this will result in
|
||||
# all shared library, loadable module, and executable targets having a dSYM
|
||||
# generated.
|
||||
- enable_dsyms = is_official_build || using_sanitizer
|
||||
+ enable_dsyms = false
|
||||
|
||||
# Strip symbols from linked targets by default. If this is enabled, the
|
||||
# //build/config/apple:strip_all config will be applied to all linked targets.
|
||||
@@ -0,0 +1,33 @@
|
||||
--- a/configure.cmake
|
||||
+++ b/configure.cmake
|
||||
@@ -533,18 +533,6 @@ qt_webengine_configure_check("windows-sdk"
|
||||
)
|
||||
unset(sdk_minor)
|
||||
|
||||
-if(APPLE)
|
||||
- qt_webengine_check_for_metal_toolchain()
|
||||
-endif()
|
||||
-
|
||||
-qt_webengine_configure_check("metal-toolchain"
|
||||
- MODULES QtWebEngine
|
||||
- CONDITION NOT APPLE OR ${TEST_metal_toolchain}
|
||||
- MESSAGE "Build requires Metal Toolchain to be installed via 'xcodebuild -downloadComponent MetalToolchain'"
|
||||
- DOCUMENTATION "Metal Toolchain needs to be installed"
|
||||
- TAGS APPLE_PLATFORM
|
||||
-)
|
||||
-
|
||||
### Support Checks (optional)
|
||||
|
||||
# Only check for the 'xcb' feature if the Gui targets exists, aka Qt was not configured with
|
||||
--- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/metal_backend.gni
|
||||
+++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/metal_backend.gni
|
||||
@@ -90,8 +90,7 @@ metal_backend_sources = [
|
||||
# We can build the ANGLE internal shaders at build-time if we have access to the Mac SDK in the "build" dir.
|
||||
# Building internal shaders for iOS is not supported. The Chromium Mac SDK does not have all the required files.
|
||||
# This is also an issue when cross-compiling for mac.
|
||||
-metal_internal_shader_compilation_supported =
|
||||
- angle_has_build && !is_ios && target_os == host_os
|
||||
+metal_internal_shader_compilation_supported = false
|
||||
|
||||
metal_internal_shaders_header =
|
||||
"$root_gen_dir/angle/mtl_internal_shaders_metallib.h"
|
||||
@@ -121,57 +121,35 @@ qtModule {
|
||||
# Override locales install path so they go to QtWebEngine's $out
|
||||
./locales-path.patch
|
||||
|
||||
# Look for things in the right places in our split-prefix config
|
||||
./split-prefix.patch
|
||||
|
||||
# Reproducibility QTBUG-136068
|
||||
./gn-object-sorted.patch
|
||||
]
|
||||
# Remove once merged with upstream
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
./clang-base-path-from-cmake-compiler.patch
|
||||
|
||||
# Don't require compiler to identify as AppleClang on Darwin
|
||||
./darwin-compiler.patch
|
||||
|
||||
# Disable Metal shader precompilation, which requires Apple proprietary tools
|
||||
./darwin-no-metal.patch
|
||||
|
||||
# Generating debug symbols fails the build because it can't find dsymutil
|
||||
# FIXME: figure out how to fix this properly
|
||||
./darwin-no-debug-symbols.patch
|
||||
|
||||
# Darwin toolchain fixes
|
||||
# FIXME: do we still need these?
|
||||
./clang-base-path-from-cmake-compiler.patch
|
||||
./lflags-remove-strip-darwin-isysroot.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Patch Chromium build tools
|
||||
(
|
||||
cd src/3rdparty/chromium;
|
||||
|
||||
# Manually fix unsupported shebangs
|
||||
substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \
|
||||
--replace "/usr/bin/env -S make -f" "/usr/bin/make -f" || true
|
||||
substituteInPlace third_party/webgpu-cts/src/tools/run_deno \
|
||||
--replace "/usr/bin/env -S deno" "/usr/bin/deno" || true
|
||||
patchShebangs .
|
||||
)
|
||||
|
||||
substituteInPlace cmake/Functions.cmake \
|
||||
--replace "/bin/bash" "${buildPackages.bash}/bin/bash"
|
||||
|
||||
# Patch library paths in sources
|
||||
substituteInPlace src/core/web_engine_library_info.cpp \
|
||||
--replace "QLibraryInfo::path(QLibraryInfo::DataPath)" "\"$out\"" \
|
||||
--replace "QLibraryInfo::path(QLibraryInfo::TranslationsPath)" "\"$out/translations\"" \
|
||||
--replace "QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)" "\"$out/libexec\""
|
||||
|
||||
substituteInPlace configure.cmake src/gn/CMakeLists.txt \
|
||||
--replace "AppleClang" "Clang"
|
||||
|
||||
# Disable metal shader compilation, Xcode only
|
||||
substituteInPlace src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/metal_backend.gni \
|
||||
--replace-fail 'angle_has_build && !is_ios && target_os == host_os' "false"
|
||||
(cd src/3rdparty/chromium; patchShebangs .)
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace cmake/QtToolchainHelpers.cmake \
|
||||
--replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
|
||||
|
||||
# xcbuild's xcrun doesn't implement the real (proprietary) Metal shader
|
||||
# compiler, so this check always fails. The one build step that actually
|
||||
# invokes it (ANGLE's internal shader precompilation) is already disabled
|
||||
# below, so it's safe to report the toolchain as present.
|
||||
substituteInPlace cmake/QtConfigureHelpers.cmake \
|
||||
--replace-fail 'message(STATUS "Checking for Metal Toolchain")' 'message(STATUS "Checking for Metal Toolchain")
|
||||
set(TEST_metal_toolchain TRUE PARENT_SCOPE)
|
||||
return()'
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt
|
||||
index ed57aa1c8..19c3de0e2 100644
|
||||
--- a/src/core/api/CMakeLists.txt
|
||||
+++ b/src/core/api/CMakeLists.txt
|
||||
@@ -227,7 +227,7 @@ if(QT_FEATURE_framework)
|
||||
@@ -11,17 +9,3 @@ index ed57aa1c8..19c3de0e2 100644
|
||||
install(FILES ${localeFiles}
|
||||
DESTINATION ${locale_install_path}
|
||||
CONFIGURATIONS ${config}
|
||||
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
|
||||
index 5dfb3c042..264510eb0 100644
|
||||
--- a/src/core/web_engine_library_info.cpp
|
||||
+++ b/src/core/web_engine_library_info.cpp
|
||||
@@ -233,7 +233,8 @@ QString localesPath()
|
||||
candidatePaths << getResourcesPath(frameworkBundle()) % QDir::separator()
|
||||
% "qtwebengine_locales"_L1;
|
||||
#endif
|
||||
- for (auto &p : QLibraryInfo::paths(QLibraryInfo::TranslationsPath))
|
||||
+ // Nixpkgs: match the changes made in CMakeLists.txt
|
||||
+ for (auto &p : QLibraryInfo::paths(QLibraryInfo::DataPath))
|
||||
candidatePaths << p % QDir::separator() % "qtwebengine_locales"_L1;
|
||||
candidatePaths << fallbackDir();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
--- a/src/core/CMakeLists.txt
|
||||
+++ b/src/core/CMakeLists.txt
|
||||
@@ -83,6 +83,7 @@ foreach(arch ${archs})
|
||||
QT_USE_QSTRINGBUILDER
|
||||
QTWEBENGINECORE_VERSION_STR=${QT_REPO_MODULE_VERSION}
|
||||
QTWEBENGINEPROCESS_NAME=${qtWebEngineProcessName}
|
||||
+ QTWEBENGINE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
|
||||
"${forwardDeclarationMacro}"
|
||||
CXX_COMPILE_OPTIONS
|
||||
${gnCxxCompileOptions}
|
||||
diff --git a/src/core/api/qtwebenginecoreglobal.h b/src/core/api/qtwebenginecoreglobal.h
|
||||
index 334d53d8e..9df9276bb 100644
|
||||
--- a/src/core/api/qtwebenginecoreglobal.h
|
||||
+++ b/src/core/api/qtwebenginecoreglobal.h
|
||||
@@ -19,6 +19,7 @@ Q_WEBENGINECORE_EXPORT Q_DECL_CONST_FUNCTION const char *qWebEngineVersion() noe
|
||||
Q_WEBENGINECORE_EXPORT Q_DECL_CONST_FUNCTION const char *qWebEngineProcessName() noexcept;
|
||||
Q_WEBENGINECORE_EXPORT Q_DECL_CONST_FUNCTION const char *qWebEngineChromiumVersion() noexcept;
|
||||
Q_WEBENGINECORE_EXPORT Q_DECL_CONST_FUNCTION const char *qWebEngineChromiumSecurityPatchVersion() noexcept;
|
||||
+Q_WEBENGINECORE_EXPORT Q_DECL_CONST_FUNCTION const char *qWebEngineInstallPrefix() noexcept;
|
||||
|
||||
Q_WEBENGINECORE_EXPORT QString qWebEngineGetDomainAndRegistry(const QUrl &url);
|
||||
|
||||
--- a/src/core/web_engine_context.cpp
|
||||
+++ b/src/core/web_engine_context.cpp
|
||||
@@ -1035,4 +1035,8 @@ const char *qWebEngineChromiumSecurityPatchVersion() noexcept
|
||||
return STRINGIFY_EXPANDED(CHROMIUM_SECURITY_PATCH_VERSION);
|
||||
}
|
||||
|
||||
+const char *qWebEngineInstallPrefix() noexcept
|
||||
+{
|
||||
+ return STRINGIFY_EXPANDED(QTWEBENGINE_INSTALL_PREFIX);
|
||||
+}
|
||||
QT_END_NAMESPACE
|
||||
--- a/src/core/web_engine_library_info.cpp
|
||||
+++ b/src/core/web_engine_library_info.cpp
|
||||
@@ -172,6 +172,7 @@ QString subProcessPath()
|
||||
candidatePaths << p % QLatin1Char('/') % processBinary;
|
||||
for (auto &p : QLibraryInfo::paths(QLibraryInfo::BinariesPath))
|
||||
candidatePaths << p % QLatin1Char('/') % processBinary;
|
||||
+ candidatePaths << QString(qWebEngineInstallPrefix()) % "/libexec/"_L1 % processBinary;
|
||||
#endif
|
||||
candidatePaths << QCoreApplication::applicationDirPath()
|
||||
% QLatin1Char('/') % processBinary;
|
||||
@@ -235,6 +236,7 @@ QString localesPath()
|
||||
#endif
|
||||
for (auto &p : QLibraryInfo::paths(QLibraryInfo::TranslationsPath))
|
||||
candidatePaths << p % QDir::separator() % "qtwebengine_locales"_L1;
|
||||
+ candidatePaths << QString(qWebEngineInstallPrefix()) % QDir::separator() % "qtwebengine_locales"_L1;
|
||||
candidatePaths << fallbackDir();
|
||||
}
|
||||
|
||||
@@ -358,7 +360,7 @@ QString resourcesPath()
|
||||
candidatePaths << p % QDir::separator() % "resources"_L1;
|
||||
candidatePaths << p;
|
||||
}
|
||||
-
|
||||
+ candidatePaths << QString(qWebEngineInstallPrefix()) % QDir::separator() % "resources"_L1;
|
||||
candidatePaths << QCoreApplication::applicationDirPath();
|
||||
candidatePaths << fallbackDir();
|
||||
}
|
||||
Reference in New Issue
Block a user