mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
rustc: Fix cross build for FreeBSD (#339909)
This commit is contained in:
commit
d4f265a2ed
@ -20,6 +20,7 @@
|
||||
pkgsBuildTarget,
|
||||
pkgsBuildBuild,
|
||||
pkgsBuildHost,
|
||||
pkgsHostTarget,
|
||||
pkgsTargetTarget,
|
||||
makeRustPlatform,
|
||||
wrapRustcWith,
|
||||
@ -40,7 +41,7 @@ let
|
||||
# Force LLVM to compile using clang + LLVM libs when targeting pkgsLLVM
|
||||
stdenv = pkgSet.stdenv.override {
|
||||
allowedRequisites = null;
|
||||
cc = pkgSet.llvmPackages_18.clangUseLLVM;
|
||||
cc = pkgSet.pkgsBuildHost.llvmPackages_18.clangUseLLVM;
|
||||
};
|
||||
}
|
||||
);
|
||||
@ -55,7 +56,7 @@ import ./default.nix
|
||||
llvmSharedForTarget = llvmSharedFor pkgsBuildTarget;
|
||||
|
||||
# For use at runtime
|
||||
llvmShared = llvmSharedFor { inherit llvmPackages_18 stdenv; };
|
||||
llvmShared = llvmSharedFor pkgsHostTarget;
|
||||
|
||||
# Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
|
||||
llvmPackages =
|
||||
@ -74,7 +75,7 @@ import ./default.nix
|
||||
pkg.override {
|
||||
stdenv = stdenv.override {
|
||||
allowedRequisites = null;
|
||||
cc = llvmPackages.clangUseLLVM;
|
||||
cc = pkgsBuildHost.llvmPackages_18.clangUseLLVM;
|
||||
};
|
||||
};
|
||||
in
|
||||
@ -87,7 +88,7 @@ import ./default.nix
|
||||
libcxx = llvmPackages.libcxx.override {
|
||||
stdenv = stdenv.override {
|
||||
allowedRequisites = null;
|
||||
cc = llvmPackages.clangNoLibcxx;
|
||||
cc = pkgsBuildHost.llvmPackages_18.clangNoLibcxx;
|
||||
hostPlatform = stdenv.hostPlatform // {
|
||||
useLLVM = !stdenv.hostPlatform.isDarwin;
|
||||
};
|
||||
@ -142,5 +143,6 @@ import ./default.nix
|
||||
"wrapCCWith"
|
||||
"overrideCC"
|
||||
"fetchpatch"
|
||||
"pkgsHostTarget"
|
||||
]
|
||||
)
|
||||
|
@ -172,7 +172,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||
] ++ optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
|
||||
# https://github.com/rust-lang/rust/issues/92173
|
||||
"--set rust.jemalloc"
|
||||
] ++ optionals useLLVM [
|
||||
] ++ optionals (useLLVM && !stdenv.targetPlatform.isFreeBSD) [
|
||||
# https://github.com/NixOS/nixpkgs/issues/311930
|
||||
"--llvm-libunwind=${if withBundledLLVM then "in-tree" else "system"}"
|
||||
"--enable-use-libcxx"
|
||||
@ -262,7 +262,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||
buildInputs = [ openssl ]
|
||||
++ optionals stdenv.hostPlatform.isDarwin [ libiconv Security zlib ]
|
||||
++ optional (!withBundledLLVM) llvmShared.lib
|
||||
++ optional (useLLVM && !withBundledLLVM) [
|
||||
++ optional (useLLVM && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD) [
|
||||
llvmPackages.libunwind
|
||||
# Hack which is used upstream https://github.com/gentoo/gentoo/blob/master/dev-lang/rust/rust-1.78.0.ebuild#L284
|
||||
(runCommandLocal "libunwind-libgcc" {} ''
|
||||
|
Loading…
Reference in New Issue
Block a user