Skip to content

Commit

Permalink
qt6.qtwebengine: fix build on darwin
Browse files Browse the repository at this point in the history
- 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
- Drop `autoSignDarwinBinariesHook` on aarch64-darwin, no longer necessary
  • Loading branch information
azuwis committed Jan 5, 2025
1 parent af397f4 commit 85c1c3c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
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
26 changes: 22 additions & 4 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 Down Expand Up @@ -151,6 +165,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!' \
Expand Down

0 comments on commit 85c1c3c

Please sign in to comment.