rustc: use autoPatchelfHook for bootstrap binaries
This is both simpler and works in more cases, e.g. for the bootstrap binaries linked against musl libc.
This commit is contained in:
parent
b1d515d7c4
commit
fb7811bf03
1 changed files with 8 additions and 26 deletions
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv, makeWrapper, bash, curl, darwin, zlib
|
||||
, autoPatchelfHook, gcc
|
||||
, version
|
||||
, src
|
||||
, platform
|
||||
|
@ -31,7 +32,9 @@ rec {
|
|||
license = [ licenses.mit licenses.asl20 ];
|
||||
};
|
||||
|
||||
nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook;
|
||||
buildInputs = [ bash ]
|
||||
++ lib.optionals (!stdenv.isDarwin) [ gcc.cc.lib zlib ]
|
||||
++ lib.optional stdenv.isDarwin Security;
|
||||
|
||||
postPatch = ''
|
||||
|
@ -42,24 +45,6 @@ rec {
|
|||
./install.sh --prefix=$out \
|
||||
--components=${installComponents}
|
||||
|
||||
${optionalString (stdenv.isLinux && bootstrapping) (''
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/rustc"
|
||||
'' + optionalString (lib.versionAtLeast version "1.46")
|
||||
# rustc bootstrap needs libz starting from 1.46
|
||||
''
|
||||
ln -s ${zlib}/lib/libz.so.1 $out/lib/libz.so.1
|
||||
ln -s ${zlib}/lib/libz.so $out/lib/libz.so
|
||||
'' + ''
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/rustdoc"
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/cargo"
|
||||
'')}
|
||||
|
||||
# Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc
|
||||
# (or similar) here. It causes strange effects where rustc loads
|
||||
# the wrong libraries in a bootstrap-build causing failures that
|
||||
|
@ -83,8 +68,11 @@ rec {
|
|||
license = [ licenses.mit licenses.asl20 ];
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [ bash ] ++ lib.optional stdenv.isDarwin Security;
|
||||
nativeBuildInputs = [ makeWrapper ]
|
||||
++ lib.optional (!stdenv.isDarwin) autoPatchelfHook;
|
||||
buildInputs = [ bash ]
|
||||
++ lib.optional (!stdenv.isDarwin) gcc.cc.lib
|
||||
++ lib.optional stdenv.isDarwin Security;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
@ -95,12 +83,6 @@ rec {
|
|||
./install.sh --prefix=$out \
|
||||
--components=cargo
|
||||
|
||||
${optionalString (stdenv.isLinux && bootstrapping) ''
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/cargo"
|
||||
''}
|
||||
|
||||
wrapProgram "$out/bin/cargo" \
|
||||
--suffix PATH : "${rustc}/bin"
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue