rustc: don't patch precompiled binaries on darwin

This doesn't work anymore since 1.35.0 because the load commands end up
being too large, but this is a precompiled binary anyway so it's not
really needed or more impure to use the expected system versions.
This commit is contained in:
Daiderd Jordan 2019-06-28 20:42:12 +02:00 committed by Frederik Rietdijk
parent 3a0b18054f
commit 368c415a01

View File

@ -31,7 +31,8 @@ rec {
license = [ licenses.mit licenses.asl20 ];
};
buildInputs = [ bash ] ++ stdenv.lib.optional stdenv.isDarwin Security;
buildInputs = [ bash ]
++ stdenv.lib.optional stdenv.isDarwin Security;
postPatch = ''
patchShebangs .
@ -53,17 +54,6 @@ rec {
"$out/bin/cargo"
''}
${optionalString (stdenv.isDarwin && bootstrapping) ''
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/rustc"
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/rustdoc"
install_name_tool -change /usr/lib/libiconv.2.dylib '${darwin.libiconv}/lib/libiconv.2.dylib' "$out/bin/cargo"
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/cargo"
install_name_tool -change /usr/lib/libcurl.4.dylib '${stdenv.lib.getLib curl}/lib/libcurl.4.dylib' "$out/bin/cargo"
for f in $out/lib/lib*.dylib; do
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$f"
done
''}
# 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
@ -85,7 +75,8 @@ rec {
license = [ licenses.mit licenses.asl20 ];
};
buildInputs = [ makeWrapper bash ] ++ stdenv.lib.optional stdenv.isDarwin Security;
buildInputs = [ makeWrapper bash ]
++ stdenv.lib.optional stdenv.isDarwin Security;
postPatch = ''
patchShebangs .
@ -102,12 +93,6 @@ rec {
"$out/bin/cargo"
''}
${optionalString (stdenv.isDarwin && bootstrapping) ''
install_name_tool -change /usr/lib/libiconv.2.dylib '${darwin.libiconv}/lib/libiconv.2.dylib' "$out/bin/cargo"
install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/cargo"
install_name_tool -change /usr/lib/libcurl.4.dylib '${stdenv.lib.getLib curl}/lib/libcurl.4.dylib' "$out/bin/cargo"
''}
wrapProgram "$out/bin/cargo" \
--suffix PATH : "${rustc}/bin"
'';