Merge pull request #311380 from RaghavSood/cargo-bisect-rustc/fix-build

cargo-bisect-rustc: fix darwin build
This commit is contained in:
Weijia Wang 2024-05-13 23:05:46 +02:00 committed by GitHub
commit 8225d5eaef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 33 deletions

View File

@ -1,13 +1,14 @@
{ stdenv
, lib
, fetchFromGitHub
, rustPlatform
, pkg-config
, openssl
, runCommand
, patchelf
, zlib
, Security
{
stdenv,
lib,
fetchFromGitHub,
darwin,
rustPlatform,
pkg-config,
openssl,
runCommand,
patchelf,
zlib,
}:
rustPlatform.buildRustPackage rec {
@ -23,41 +24,46 @@ rustPlatform.buildRustPackage rec {
patches =
let
patchelfPatch = runCommand "0001-dynamically-patchelf-binaries.patch"
{
CC = stdenv.cc;
patchelf = patchelf;
libPath = "$ORIGIN/../lib:${lib.makeLibraryPath [ zlib ]}";
}
''
export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
--subst-var patchelf \
--subst-var dynamicLinker \
--subst-var libPath
'';
patchelfPatch =
runCommand "0001-dynamically-patchelf-binaries.patch"
{
CC = stdenv.cc;
patchelf = patchelf;
libPath = "$ORIGIN/../lib:${lib.makeLibraryPath [ zlib ]}";
}
''
export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
--subst-var patchelf \
--subst-var dynamicLinker \
--subst-var libPath
'';
in
lib.optionals stdenv.isLinux [ patchelfPatch ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [
openssl
] ++ lib.optionals stdenv.isDarwin [
Security
];
buildInputs =
[ openssl ]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
cargoHash = "sha256-CgEs0cejquFRY3VN6CgbE23Gipg+LEuWp/jSIkITrjw=";
checkFlags = [
"--skip test_github" # requires internet
"--skip test_github" # requires internet
];
meta = with lib; {
description = "Bisects rustc, either nightlies or CI artifacts";
mainProgram = "cargo-bisect-rustc";
homepage = "https://github.com/rust-lang/cargo-bisect-rustc";
license = with licenses; [ asl20 mit ];
license = with licenses; [
asl20
mit
];
maintainers = with maintainers; [ davidtwco ];
};
}

View File

@ -16612,9 +16612,7 @@ with pkgs;
};
cargo-benchcmp = callPackage ../development/tools/rust/cargo-benchcmp { };
cargo-binstall = callPackage ../development/tools/rust/cargo-binstall { };
cargo-bisect-rustc = callPackage ../development/tools/rust/cargo-bisect-rustc {
inherit (darwin.apple_sdk.frameworks) Security;
};
cargo-bisect-rustc = callPackage ../development/tools/rust/cargo-bisect-rustc { };
cargo-bitbake = callPackage ../development/tools/rust/cargo-bitbake { };
cargo-c = callPackage ../development/tools/rust/cargo-c {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;