rustc: add missing xz dependency

The "bootstrap" and "installer" crates depend on lzma-sys, which will
build its own version of xz if it can't find the liblzma.pc through
pkg-config.  Even though it's used as a library, xz here is a native
build input, as it is used by the build system rather than the end
product.
This commit is contained in:
Alyssa Ross 2022-10-15 23:23:42 +00:00 committed by Yureka
parent ab7742206a
commit ada5320ea3

View file

@ -2,7 +2,7 @@
, llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackages
, fetchurl, file, python3
, darwin, cmake, rust, rustPlatform
, pkg-config, openssl
, pkg-config, openssl, xz
, libiconv
, which, libffi
, withBundledLLVM ? false
@ -41,6 +41,13 @@ in stdenv.mkDerivation rec {
# See: https://github.com/NixOS/nixpkgs/pull/56540#issuecomment-471624656
stripDebugList = [ "bin" ];
# The Rust pkg-config crate does not support prefixed pkg-config executables[1],
# but it does support checking these idiosyncratic PKG_CONFIG_${TRIPLE}
# environment variables.
# [1]: https://github.com/rust-lang/pkg-config-rs/issues/53
"PKG_CONFIG_${builtins.replaceStrings ["-"] ["_"] (rust.toRustTarget stdenv.buildPlatform)}" =
"${pkgsBuildHost.stdenv.cc.targetPrefix}pkg-config";
NIX_LDFLAGS = toString (
# when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch'
optional (stdenv.isLinux && !withBundledLLVM) "--push-state --as-needed -lstdc++ --pop-state"
@ -148,9 +155,11 @@ in stdenv.mkDerivation rec {
# use it for the normal build. This disables cmake in Nix.
dontUseCmakeConfigure = true;
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [
file python3 rustPlatform.rust.rustc cmake
which libffi removeReferencesTo pkg-config
which libffi removeReferencesTo pkg-config xz
];
buildInputs = [ openssl ]