Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt6.qtwebengine: fix build on darwin, disable metal shader compilation #359755

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/development/libraries/qt-6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ let
qtwayland = callPackage ./modules/qtwayland.nix { };
qtwebchannel = callPackage ./modules/qtwebchannel.nix { };
qtwebengine = callPackage ./modules/qtwebengine {
inherit (darwin) autoSignDarwinBinariesHook bootstrap_cmds;
inherit (darwin) bootstrap_cmds;
};
qtwebsockets = callPackage ./modules/qtwebsockets.nix { };
qtwebview = callPackage ./modules/qtwebview.nix { };
Expand Down
31 changes: 25 additions & 6 deletions pkgs/development/libraries/qt-6/modules/qtwebengine/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
libgbm,
enableProprietaryCodecs ? true,
# darwin
autoSignDarwinBinariesHook,
bootstrap_cmds,
cctools,
xcbuild,
Expand All @@ -85,9 +84,6 @@ qtModule {
gn
nodejs
]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
autoSignDarwinBinariesHook
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
bootstrap_cmds
cctools
Expand Down Expand Up @@ -124,6 +120,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 =
Expand All @@ -148,6 +162,13 @@ qtModule {
--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"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \
Expand All @@ -157,8 +178,6 @@ qtModule {
src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace configure.cmake src/gn/CMakeLists.txt \
--replace "AppleClang" "Clang"
substituteInPlace cmake/Functions.cmake \
--replace "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
'';
Expand Down