Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/development/compilers/rust/1_78.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import ./default.nix {
aarch64-apple-darwin = "415bb2bc198feb0f2d8329e33c57d0890bbd57977d1ae48b17f6c7e1f632eaa7";
powerpc64le-unknown-linux-gnu = "79582acb339bd2d79fef095b977049049ffa04616011f1af1793fb8e98194b19";
riscv64gc-unknown-linux-gnu = "300fe4861e2d1f6e4c4f5e36ae7997beca8a979343a7f661237ab78a37a54648";
x86_64-unknown-freebsd = "72f49040fc2ed4492cddfaef3b4a9cb28d008f9f5ce5cac50802a5fca910f58c";
};

selectRustPackage = pkgs: pkgs.rust_1_78;
Expand Down
5 changes: 3 additions & 2 deletions pkgs/development/compilers/rust/binary.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ rec {

nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook;
buildInputs = [ bash ]
++ lib.optionals (!stdenv.isDarwin) [ gcc.cc.lib zlib ]
++ lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) gcc.cc.lib
++ lib.optional (!stdenv.isDarwin) zlib
++ lib.optional stdenv.isDarwin Security;

postPatch = ''
Expand Down Expand Up @@ -81,7 +82,7 @@ rec {
nativeBuildInputs = [ makeWrapper ]
++ lib.optional (!stdenv.isDarwin) autoPatchelfHook;
buildInputs = [ bash ]
++ lib.optional (!stdenv.isDarwin) gcc.cc.lib
++ lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) gcc.cc.lib
++ lib.optional stdenv.isDarwin Security;

postPatch = ''
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/rust/print-hashes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PLATFORMS=(
aarch64-apple-darwin
powerpc64le-unknown-linux-gnu
riscv64gc-unknown-linux-gnu
x86_64-unknown-freebsd
)
BASEURL=https://static.rust-lang.org/dist
VERSION=${1:-}
Expand Down
10 changes: 9 additions & 1 deletion pkgs/development/compilers/rust/rustc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ in stdenv.mkDerivation (finalAttrs: {

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"
# This doesn't apply to cross-building for FreeBSD because the host
# uses libstdc++, but the target (used for building std) uses libc++
optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD) "--push-state --as-needed -lstdc++ --pop-state"
++ optional (stdenv.isDarwin && !withBundledLLVM) "-lc++ -lc++abi"
++ optional stdenv.isFreeBSD "-rpath ${llvmPackages.libunwind}/lib"
++ optional stdenv.isDarwin "-rpath ${llvmSharedForHost}/lib");

# Increase codegen units to introduce parallelism within the compiler.
Expand Down Expand Up @@ -214,6 +217,11 @@ in stdenv.mkDerivation (finalAttrs: {
[source.vendored-sources]
directory = "vendor"
EOF
'' + lib.optionalString (stdenv.isFreeBSD) ''
# lzma-sys bundles an old version of xz that doesn't build
# on modern FreeBSD, use the system one instead
substituteInPlace src/bootstrap/src/core/build_steps/tool.rs \
--replace 'cargo.env("LZMA_API_STATIC", "1");' ' '
'';

# rustc unfortunately needs cmake to compile llvm-rt but doesn't
Expand Down