Merge pull request #145704 from uri-canva/darwin-writers

writers: fix writeRust on darwin
This commit is contained in:
Jörg Thalheim 2021-11-13 11:18:25 +00:00 committed by GitHub
commit a33e09d1d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
{ pkgs, buildPackages, lib, gawk, gnused, gixy }:
{ pkgs, buildPackages, lib, stdenv, libiconv, gawk, gnused, gixy }:
with lib;
rec {
@ -150,10 +150,13 @@ rec {
rustcArgs ? [],
strip ? true
}:
let
darwinArgs = lib.optionals stdenv.isDarwin [ "-L${lib.getLib libiconv}/lib" ];
in
makeBinWriter {
compileScript = ''
cp "$contentPath" tmp.rs
PATH=${makeBinPath [pkgs.gcc]} ${lib.getBin rustc}/bin/rustc ${lib.escapeShellArgs rustcArgs} -o "$out" tmp.rs
PATH=${makeBinPath [pkgs.gcc]} ${lib.getBin rustc}/bin/rustc ${lib.escapeShellArgs rustcArgs} ${lib.escapeShellArgs darwinArgs} -o "$out" tmp.rs
'';
inherit strip;
} name;