rustc: cleanup, use correct llvm version

This commit is contained in:
Luka Blaskovic 2020-12-14 08:40:37 +00:00
parent ec2fa1cee8
commit c73d96f776
5 changed files with 36 additions and 21 deletions

View File

@ -11,15 +11,24 @@
, buildPackages , buildPackages
, newScope, callPackage , newScope, callPackage
, CoreFoundation, Security , CoreFoundation, Security
, llvmPackages , pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost
, pkgsBuildTarget, pkgsBuildBuild
, makeRustPlatform , makeRustPlatform
, llvmPackages_5, llvm_10
} @ args: } @ args:
import ./default.nix { import ./default.nix {
rustcVersion = "1.45.2"; rustcVersion = "1.45.2";
rustcSha256 = "0273a1g3f59plyi1n0azf21qjzwml1yqdnj5z472crz37qggr8xp"; rustcSha256 = "0273a1g3f59plyi1n0azf21qjzwml1yqdnj5z472crz37qggr8xp";
llvmSharedForBuild = pkgsBuildBuild.llvm_10.override { enableSharedLibraries = true; };
llvmSharedForHost = pkgsBuildHost.llvm_10.override { enableSharedLibraries = true; };
llvmSharedForTarget = pkgsBuildTarget.llvm_10.override { enableSharedLibraries = true; };
llvmBootstrapForDarwin = llvmPackages_5;
# For use at runtime
llvmShared = llvm_10.override { enableSharedLibraries = true; };
# Note: the version MUST be one version prior to the version we're # Note: the version MUST be one version prior to the version we're
# building # building
bootstrapVersion = "1.44.1"; bootstrapVersion = "1.44.1";
@ -41,4 +50,4 @@ import ./default.nix {
]; ];
} }
(builtins.removeAttrs args [ "fetchpatch" ]) (builtins.removeAttrs args [ "fetchpatch" "pkgsBuildHost" "llvmPackages_5" "llvm_10" ])

View File

@ -13,15 +13,24 @@
, buildPackages , buildPackages
, newScope, callPackage , newScope, callPackage
, CoreFoundation, Security , CoreFoundation, Security
, llvmPackages , pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost
, pkgsBuildTarget, pkgsBuildBuild
, makeRustPlatform , makeRustPlatform
, llvmPackages_5, llvm_11
} @ args: } @ args:
import ./default.nix { import ./default.nix {
rustcVersion = "1.48.0"; rustcVersion = "1.48.0";
rustcSha256 = "0fz4gbb5hp5qalrl9lcl8yw4kk7ai7wx511jb28nypbxninkwxhf"; rustcSha256 = "0fz4gbb5hp5qalrl9lcl8yw4kk7ai7wx511jb28nypbxninkwxhf";
llvmSharedForBuild = pkgsBuildBuild.llvm_11.override { enableSharedLibraries = true; };
llvmSharedForHost = pkgsBuildHost.llvm_11.override { enableSharedLibraries = true; };
llvmSharedForTarget = pkgsBuildTarget.llvm_11.override { enableSharedLibraries = true; };
llvmBootstrapForDarwin = llvmPackages_5;
# For use at runtime
llvmShared = llvm_11.override { enableSharedLibraries = true; };
# Note: the version MUST be one version prior to the version we're # Note: the version MUST be one version prior to the version we're
# building # building
bootstrapVersion = "1.47.0"; bootstrapVersion = "1.47.0";
@ -43,4 +52,4 @@ import ./default.nix {
]; ];
} }
(builtins.removeAttrs args [ "fetchpatch" ]) (builtins.removeAttrs args [ "fetchpatch" "pkgsBuildHost" "llvmPackages_5" "llvm_11"])

View File

@ -5,12 +5,16 @@
, bootstrapHashes , bootstrapHashes
, selectRustPackage , selectRustPackage
, rustcPatches ? [] , rustcPatches ? []
, llvmBootstrapForDarwin
, llvmShared
, llvmSharedForBuild
, llvmSharedForHost
, llvmSharedForTarget
}: }:
{ stdenv, lib { stdenv, lib
, buildPackages , buildPackages
, newScope, callPackage , newScope, callPackage
, CoreFoundation, Security , CoreFoundation, Security
, llvmPackages
, pkgsBuildTarget, pkgsBuildBuild , pkgsBuildTarget, pkgsBuildBuild
, makeRustPlatform , makeRustPlatform
}: rec { }: rec {
@ -76,16 +80,17 @@
version = rustcVersion; version = rustcVersion;
sha256 = rustcSha256; sha256 = rustcSha256;
inherit enableRustcDev; inherit enableRustcDev;
inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget;
patches = rustcPatches; patches = rustcPatches;
# Use boot package set to break cycle # Use boot package set to break cycle
rustPlatform = bootRustPlatform; rustPlatform = bootRustPlatform;
} // lib.optionalAttrs (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) { } // lib.optionalAttrs (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) {
stdenv = llvmPackages.stdenv; stdenv = llvmBootstrapForDarwin.stdenv;
pkgsBuildBuild = pkgsBuildBuild // { targetPackages.stdenv = llvmPackages.stdenv; }; pkgsBuildBuild = pkgsBuildBuild // { targetPackages.stdenv = llvmBootstrapForDarwin.stdenv; };
pkgsBuildHost = pkgsBuildBuild // { targetPackages.stdenv = llvmPackages.stdenv; }; pkgsBuildHost = pkgsBuildBuild // { targetPackages.stdenv = llvmBootstrapForDarwin.stdenv; };
pkgsBuildTarget = pkgsBuildTarget // { targetPackages.stdenv = llvmPackages.stdenv; }; pkgsBuildTarget = pkgsBuildTarget // { targetPackages.stdenv = llvmBootstrapForDarwin.stdenv; };
}); });
rustfmt = self.callPackage ./rustfmt.nix { inherit Security; }; rustfmt = self.callPackage ./rustfmt.nix { inherit Security; };
cargo = self.callPackage ./cargo.nix { cargo = self.callPackage ./cargo.nix {

View File

@ -1,6 +1,7 @@
{ stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget { stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget
, llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget
, fetchurl, file, python3 , fetchurl, file, python3
, llvm_10, darwin, cmake, rust, rustPlatform , darwin, cmake, rust, rustPlatform
, pkgconfig, openssl , pkgconfig, openssl
, which, libffi , which, libffi
, withBundledLLVM ? false , withBundledLLVM ? false
@ -13,13 +14,6 @@
let let
inherit (stdenv.lib) optionals optional optionalString concatStringsSep; inherit (stdenv.lib) optionals optional optionalString concatStringsSep;
inherit (darwin.apple_sdk.frameworks) Security; inherit (darwin.apple_sdk.frameworks) Security;
llvmSharedForBuild = pkgsBuildBuild.llvm_10.override { enableSharedLibraries = true; };
llvmSharedForHost = pkgsBuildHost.llvm_10.override { enableSharedLibraries = true; };
llvmSharedForTarget = pkgsBuildTarget.llvm_10.override { enableSharedLibraries = true; };
# For use at runtime
llvmShared = llvm_10.override { enableSharedLibraries = true; };
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "rustc"; pname = "rustc";
inherit version; inherit version;

View File

@ -10030,11 +10030,9 @@ in
# So this commit doesn't remove the 1.45.2 release. # So this commit doesn't remove the 1.45.2 release.
rust_1_45 = callPackage ../development/compilers/rust/1_45.nix { rust_1_45 = callPackage ../development/compilers/rust/1_45.nix {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
llvmPackages = if stdenv.cc.isClang then llvmPackages_5 else llvmPackages_10;
}; };
rust_1_48 = callPackage ../development/compilers/rust/1_48.nix { rust_1_48 = callPackage ../development/compilers/rust/1_48.nix {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
llvmPackages = if stdenv.cc.isClang then llvmPackages_5 else llvmPackages_11;
}; };
rust = rust_1_48; rust = rust_1_48;