From 3bed3d5fcdf9dbb2ebd7e5d3b46e3fa6744dc7c4 Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Tue, 31 Dec 2024 20:26:40 +0800 Subject: [PATCH] qt6.qtwebengine: fix build on darwin - Disable metal shader compilation - Apply upstream zutil.h patch that fixes clang 18 and later - Apply upstream libpng patch that fixes clang 18 and later --- .../qt-6/modules/qtwebengine/default.nix | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pkgs/development/libraries/qt-6/modules/qtwebengine/default.nix b/pkgs/development/libraries/qt-6/modules/qtwebengine/default.nix index 7fee7eb7866de4..ea14cfd8cb9316 100644 --- a/pkgs/development/libraries/qt-6/modules/qtwebengine/default.nix +++ b/pkgs/development/libraries/qt-6/modules/qtwebengine/default.nix @@ -124,6 +124,24 @@ qtModule { extraPrefix = "src/3rdparty/chromium/third_party/xnnpack/src/"; hash = "sha256-GUESVNR88I1K2V5xr0e09ec4j2eselMhNN06+PCcINM="; }) + + # The latest version of Clang changed what macros it predefines on Apple + # targets, causing errors about predefined macros in zlib. + (fetchpatch { + url = "https://github.com/chromium/chromium/commit/2f39ac8d0a414dd65c0e1d5aae38c8f97aa06ae9.patch"; + stripLen = 1; + extraPrefix = "src/3rdparty/chromium/"; + hash = "sha256-07hWANY9JGFmqvjdOD6SFmVI6sQRRyvW+7wxGZF5GVo="; + }) + + # The latest version of Clang changed what macros it predefines on Apple + # targets, causing errors about predefined macros in libpng. + (fetchpatch { + url = "https://github.com/chromium/chromium/commit/66defc14abe47c0494da9faebebfa0a5b6efcf38.patch"; + stripLen = 1; + extraPrefix = "src/3rdparty/chromium/"; + hash = "sha256-FWIi1VsBZFqOoPIkPxPkcfexPkx1458rB5ldtA7T2uE="; + }) ]; postPatch = @@ -151,6 +169,10 @@ qtModule { 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" '' + lib.optionalString stdenv.hostPlatform.isLinux '' sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \