Merge pull request #40752 from TravisWhitaker/alacritty-darwin

alacritty: Fix darwin.
This commit is contained in:
Jörg Thalheim 2018-05-19 14:25:13 +01:00 committed by GitHub
commit 4c132c40bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 7 deletions

View File

@ -1,4 +1,5 @@
{ stdenv, { stdenv,
lib,
fetchgit, fetchgit,
rustPlatform, rustPlatform,
cmake, cmake,
@ -14,7 +15,15 @@
libXi, libXi,
libXrandr, libXrandr,
libGL, libGL,
xclip }: xclip,
# Darwin Frameworks
AppKit,
CoreFoundation,
CoreGraphics,
CoreServices,
CoreText,
Foundation,
OpenGL }:
with rustPlatform; with rustPlatform;
@ -30,20 +39,29 @@ let
libGL libGL
libXi libXi
]; ];
darwinFrameworks = [
AppKit
CoreFoundation
CoreGraphics
CoreServices
CoreText
Foundation
OpenGL
];
in buildRustPackage rec { in buildRustPackage rec {
name = "alacritty-unstable-${version}"; name = "alacritty-unstable-${version}";
version = "2018-04-16"; version = "2018-05-09";
# At the moment we cannot handle git dependencies in buildRustPackage. # At the moment we cannot handle git dependencies in buildRustPackage.
# This fork only replaces rust-fontconfig/libfontconfig with a git submodules. # This fork only replaces rust-fontconfig/libfontconfig with a git submodules.
src = fetchgit { src = fetchgit {
url = https://github.com/Mic92/alacritty.git; url = https://github.com/Mic92/alacritty.git;
rev = "rev-${version}"; rev = "rev-${version}";
sha256 = "14qsfaij631pk0gxrhmp594f72v0z7kzymf4hnqv4k5w9xlxciwx"; sha256 = "0mgi4niy40zz80k2ammbzdw9d8flvfkwlxkjnbpwrrldd0sj8dlz";
fetchSubmodules = true; fetchSubmodules = true;
}; };
cargoSha256 = "0gg28fbx0kisv7hqxgzqhv4z4ikk074djfjlj90nmmi4nddp017p"; cargoSha256 = "0d6bqfnwqfxqllrf00p1djlxdvnhrahgnyqv842qjn94j3wf0fym";
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
@ -51,20 +69,28 @@ in buildRustPackage rec {
pkgconfig pkgconfig
]; ];
buildInputs = rpathLibs; buildInputs = rpathLibs
++ lib.optionals stdenv.isDarwin darwinFrameworks;
postPatch = '' postPatch = ''
substituteInPlace copypasta/src/x11.rs \ substituteInPlace copypasta/src/x11.rs \
--replace Command::new\(\"xclip\"\) Command::new\(\"${xclip}/bin/xclip\"\) --replace Command::new\(\"xclip\"\) Command::new\(\"${xclip}/bin/xclip\"\)
''; '';
postBuild = lib.optionalString stdenv.isDarwin "make app";
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
install -D target/release/alacritty $out/bin/alacritty install -D target/release/alacritty $out/bin/alacritty
patchelf --set-rpath "${stdenv.lib.makeLibraryPath rpathLibs}" $out/bin/alacritty
'' + (if stdenv.isDarwin then ''
mkdir $out/Applications
cp -r target/release/osx/Alacritty.app $out/Applications/Alacritty.app
'' else ''
install -D Alacritty.desktop $out/share/applications/alacritty.desktop install -D Alacritty.desktop $out/share/applications/alacritty.desktop
patchelf --set-rpath "${stdenv.lib.makeLibraryPath rpathLibs}" $out/bin/alacritty
'') + ''
runHook postInstall runHook postInstall
''; '';
@ -76,6 +102,5 @@ in buildRustPackage rec {
homepage = https://github.com/jwilm/alacritty; homepage = https://github.com/jwilm/alacritty;
license = with licenses; [ asl20 ]; license = with licenses; [ asl20 ];
maintainers = with maintainers; [ mic92 ]; maintainers = with maintainers; [ mic92 ];
platforms = platforms.linux;
}; };
} }

View File

@ -484,6 +484,7 @@ with pkgs;
alacritty = callPackage ../applications/misc/alacritty { alacritty = callPackage ../applications/misc/alacritty {
inherit (xorg) libXcursor libXxf86vm libXi; inherit (xorg) libXcursor libXxf86vm libXi;
inherit (darwin.apple_sdk.frameworks) AppKit CoreFoundation CoreGraphics CoreServices CoreText Foundation OpenGL;
}; };
amazon-glacier-cmd-interface = callPackage ../tools/backup/amazon-glacier-cmd-interface { }; amazon-glacier-cmd-interface = callPackage ../tools/backup/amazon-glacier-cmd-interface { };