buildRustCrate: Fix extra cross args

Do proper list separation, use ld not cc because rustc doesn't `-Wl,`.
This commit is contained in:
John Ericson 2021-06-30 15:49:15 +00:00
parent 1d88d6faed
commit 0ee5640d78

@ -15,8 +15,10 @@
"--remap-path-prefix=$NIX_BUILD_TOP=/"
(mkRustcDepArgs dependencies crateRenames)
(mkRustcFeatureArgs crateFeatures)
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"--target" (rust.toRustTargetSpec stdenv.hostPlatform)
"-C" "linker=${stdenv.hostPlatform.config}-ld"
] ++ extraRustcOpts
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--target ${rust.toRustTargetSpec stdenv.hostPlatform} -C linker=${stdenv.hostPlatform.config}-gcc"
# since rustc 1.42 the "proc_macro" crate is part of the default crate prelude
# https://github.com/rust-lang/cargo/commit/4d64eb99a4#diff-7f98585dbf9d30aa100c8318e2c77e79R1021-R1022
++ lib.optional (lib.elem "proc-macro" crateType) "--extern proc_macro"