File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
pkgs/development/compilers/rust Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,17 @@ rustPlatform.buildRustPackage rec {
15
15
rustc . llvm
16
16
] ++ lib . optional stdenv . isDarwin Security ;
17
17
18
+ # rustfmt uses the rustc_driver and std private libraries, and Rust's build process forces them to have
19
+ # an install name of `@rpath/...` [0] [1] instead of the standard on macOS, which is an absolute path
20
+ # to itself.
21
+ #
22
+ # [0]: https://github.com/rust-lang/rust/blob/f77f4d55bdf9d8955d3292f709bd9830c2fdeca5/src/bootstrap/builder.rs#L1543
23
+ # [1]: https://github.com/rust-lang/rust/blob/f77f4d55bdf9d8955d3292f709bd9830c2fdeca5/compiler/rustc_codegen_ssa/src/back/linker.rs#L323-L331
24
+ preFixup = lib . optionalString stdenv . isDarwin ''
25
+ install_name_tool -add_rpath "${ rustPlatform . rust . rustc } /lib" "$out/bin/rustfmt"
26
+ install_name_tool -add_rpath "${ rustPlatform . rust . rustc } /lib" "$out/bin/git-rustfmt"
27
+ '' ;
28
+
18
29
# As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler
19
30
RUSTC_BOOTSTRAP = 1 ;
20
31
You can’t perform that action at this time.
0 commit comments