Merge pull request #108632 from fanzeyi/wezterm-darwin

This commit is contained in:
Sandro 2021-01-07 21:41:57 +01:00 committed by GitHub
commit b139de1c5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 5 deletions

View File

@ -1,4 +1,5 @@
{ rustPlatform { stdenv
, rustPlatform
, lib , lib
, fetchFromGitHub , fetchFromGitHub
@ -8,6 +9,11 @@
, openssl , openssl
, perl , perl
# Apple frameworks
, CoreGraphics
, Cocoa
, Foundation
, dbus , dbus
, libX11 , libX11
, xcbutil , xcbutil
@ -25,6 +31,10 @@
}: }:
let let
runtimeDeps = [ runtimeDeps = [
zlib
fontconfig
freetype
] ++ stdenv.lib.optionals (stdenv.isLinux) [
libX11 libX11
xcbutil xcbutil
libxcb libxcb
@ -33,13 +43,14 @@ let
libxkbcommon libxkbcommon
dbus dbus
libglvnd libglvnd
zlib
egl-wayland egl-wayland
wayland wayland
libGLU libGLU
libGL libGL
fontconfig ] ++ stdenv.lib.optionals (stdenv.isDarwin) [
freetype Foundation
CoreGraphics
Cocoa
]; ];
pname = "wezterm"; pname = "wezterm";
in in
@ -67,10 +78,21 @@ rustPlatform.buildRustPackage {
buildInputs = runtimeDeps; buildInputs = runtimeDeps;
installPhase = '' installPhase = ''
'' + stdenv.lib.optionalString stdenv.isLinux ''
for artifact in wezterm wezterm-gui wezterm-mux-server strip-ansi-escapes; do for artifact in wezterm wezterm-gui wezterm-mux-server strip-ansi-escapes; do
patchelf --set-rpath "${lib.makeLibraryPath runtimeDeps}" $releaseDir/$artifact patchelf --set-rpath "${lib.makeLibraryPath runtimeDeps}" $releaseDir/$artifact
install -D $releaseDir/$artifact -t $out/bin install -D $releaseDir/$artifact -t $out/bin
done done
'' + stdenv.lib.optionalString stdenv.isDarwin ''
mkdir -p "$out/Applications"
OUT_APP="$out/Applications/WezTerm.app"
cp -r assets/macos/WezTerm.app "$OUT_APP"
rm $OUT_APP/*.dylib
cp -r assets/shell-integration/* "$OUT_APP"
cp $releaseDir/wezterm "$OUT_APP"
cp $releaseDir/wezterm-mux-server "$OUT_APP"
cp $releaseDir/wezterm-gui "$OUT_APP"
cp $releaseDir/strip-ansi-escapes "$OUT_APP"
''; '';
# prevent further changes to the RPATH # prevent further changes to the RPATH

View File

@ -813,7 +813,9 @@ in
wayst = callPackage ../applications/terminal-emulators/wayst { }; wayst = callPackage ../applications/terminal-emulators/wayst { };
wezterm = callPackage ../applications/terminal-emulators/wezterm { }; wezterm = callPackage ../applications/terminal-emulators/wezterm {
inherit (darwin.apple_sdk.frameworks) Cocoa CoreGraphics Foundation;
};
x3270 = callPackage ../applications/terminal-emulators/x3270 { }; x3270 = callPackage ../applications/terminal-emulators/x3270 { };