From f252c582ef91f430172de41d603e3fc2e9f0e893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Fri, 20 Dec 2024 15:33:39 +0100 Subject: [PATCH 1/2] wezterm: patch vendored deps for clang 19 --- .../terminal-emulators/wezterm/default.nix | 16 +++++++++++++ .../wezterm/zlib-fdopen.patch | 24 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 pkgs/applications/terminal-emulators/wezterm/zlib-fdopen.patch diff --git a/pkgs/applications/terminal-emulators/wezterm/default.nix b/pkgs/applications/terminal-emulators/wezterm/default.nix index 00117185c5564..83700cb41e25b 100644 --- a/pkgs/applications/terminal-emulators/wezterm/default.nix +++ b/pkgs/applications/terminal-emulators/wezterm/default.nix @@ -29,6 +29,7 @@ nixosTests, runCommand, vulkan-loader, + fetchpatch2, }: rustPlatform.buildRustPackage rec { @@ -43,6 +44,21 @@ rustPlatform.buildRustPackage rec { hash = "sha256-Az+HlnK/lRJpUSGm5UKyma1l2PaBKNCGFiaYnLECMX8="; }; + patches = [ + # Remove unused `fdopen` in vendored zlib, which causes compilation failures with clang 19 on Darwin. + # Ref: https://github.com/madler/zlib/commit/4bd9a71f3539b5ce47f0c67ab5e01f3196dc8ef9 + ./zlib-fdopen.patch + + # Fix platform check in vendored libpng with clang 19 on Darwin. + (fetchpatch2 { + url = "https://github.com/pnggroup/libpng/commit/893b8113f04d408cc6177c6de19c9889a48faa24.patch?full_index=1"; + extraPrefix = "deps/freetype/libpng/"; + stripLen = 1; + excludes = [ "deps/freetype/libpng/AUTHORS" ]; + hash = "sha256-zW/oUo2EGcnsxAfbbbhTKGui/lwCqovyrvUnylfRQzc="; + }) + ]; + postPatch = '' cp ${./Cargo.lock} Cargo.lock diff --git a/pkgs/applications/terminal-emulators/wezterm/zlib-fdopen.patch b/pkgs/applications/terminal-emulators/wezterm/zlib-fdopen.patch new file mode 100644 index 0000000000000..c4f78035e01d9 --- /dev/null +++ b/pkgs/applications/terminal-emulators/wezterm/zlib-fdopen.patch @@ -0,0 +1,24 @@ +Submodule deps/freetype/zlib contains modified content +diff --git a/deps/freetype/zlib/zutil.h b/deps/freetype/zlib/zutil.h +index b079ea6..4e94f2f 100644 +--- a/deps/freetype/zlib/zutil.h ++++ b/deps/freetype/zlib/zutil.h +@@ -130,17 +130,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif + + #ifdef __acorn From d064fbc2d90d8091a42e28f23a8f29cc0bf818e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Fri, 20 Dec 2024 15:35:28 +0100 Subject: [PATCH 2/2] wezterm: clean up old Darwin SDK pattern --- .../terminal-emulators/wezterm/default.nix | 16 ---------------- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/pkgs/applications/terminal-emulators/wezterm/default.nix b/pkgs/applications/terminal-emulators/wezterm/default.nix index 83700cb41e25b..e00f8ede1e05d 100644 --- a/pkgs/applications/terminal-emulators/wezterm/default.nix +++ b/pkgs/applications/terminal-emulators/wezterm/default.nix @@ -20,12 +20,6 @@ xcbutilwm, wayland, zlib, - CoreGraphics, - Cocoa, - Foundation, - System, - libiconv, - UserNotifications, nixosTests, runCommand, vulkan-loader, @@ -104,20 +98,10 @@ rustPlatform.buildRustPackage rec { xcbutilimage xcbutilkeysyms xcbutilwm # contains xcb-ewmh among others - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - Cocoa - CoreGraphics - Foundation - libiconv - System - UserNotifications ]; buildFeatures = [ "distro-defaults" ]; - env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-framework System"; - postInstall = '' mkdir -p $out/nix-support echo "${passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ad5ea0cb82d90..e4f2e6d12b884 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1583,9 +1583,7 @@ with pkgs; }; termite-unwrapped = callPackage ../applications/terminal-emulators/termite { }; - wezterm = darwin.apple_sdk_11_0.callPackage ../applications/terminal-emulators/wezterm { - inherit (darwin.apple_sdk_11_0.frameworks) Cocoa CoreGraphics Foundation UserNotifications System; - }; + wezterm = callPackage ../applications/terminal-emulators/wezterm { }; twine = with python3Packages; toPythonApplication twine;