Skip to content

Commit

Permalink
rust_1_66: Init via backport from master
Browse files Browse the repository at this point in the history
Supporting the latest firefox versions via a source build every once in
a while requires a newer rust ecosystem.
  • Loading branch information
mweinelt committed Feb 15, 2023
1 parent df707bf commit 6dcefc9
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
64 changes: 64 additions & 0 deletions pkgs/development/compilers/rust/1_66.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# New rust versions should first go to staging.
# Things to check after updating:
# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin:
# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github
# This testing can be also done by other volunteers as part of the pull
# request review, in case platforms cannot be covered.
# 2. The LLVM version used for building should match with rust upstream.
# Check the version number in the src/llvm-project git submodule in:
# https://github.com/rust-lang/rust/blob/<version-tag>/.gitmodules
# 3. Firefox and Thunderbird should still build on x86_64-linux.

{ stdenv, lib
, buildPackages
, newScope, callPackage
, CoreFoundation, Security, SystemConfiguration
, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost
, makeRustPlatform
, llvmPackages_11
, llvmPackages_14, llvm_14
} @ args:

import ./default.nix {
rustcVersion = "1.66.1";
rustcSha256 = "sha256-WzyTOpTHIYdwXU7ikxmLq/3QlEL1k3+9aF2zqB9JWbo=";

llvmSharedForBuild = pkgsBuildBuild.llvmPackages_14.libllvm.override { enableSharedLibraries = true; };
llvmSharedForHost = pkgsBuildHost.llvmPackages_14.libllvm.override { enableSharedLibraries = true; };
llvmSharedForTarget = pkgsBuildTarget.llvmPackages_14.libllvm.override { enableSharedLibraries = true; };

llvmBootstrapForDarwin = llvmPackages_11;

# For use at runtime
llvmShared = llvm_14.override { enableSharedLibraries = true; };

# Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
llvmPackages = llvmPackages_14;

# Note: the version MUST be one version prior to the version we're
# building
bootstrapVersion = "1.65.0";

# fetch hashes by running `print-hashes.sh ${bootstrapVersion}`
bootstrapHashes = {
i686-unknown-linux-gnu = "b29869f8e2c7029150a929b2c4e26843f363846ad99253a25be6abcfa8e84f46";
x86_64-unknown-linux-gnu = "8f754fdd5af783fe9020978c64e414cb45f3ad0a6f44d045219bbf2210ca3cb9";
x86_64-unknown-linux-musl = "716984def5509a844c2dde1c7be42bfadeb179f751d5c1a30c9c7198c8c089cd";
arm-unknown-linux-gnueabihf = "e27f835c16bfcb66ad022a17d5c4602899e021e483a432ca4cc2cb4ecd39e938";
armv7-unknown-linux-gnueabihf = "5376d467a29b32cacb771e0c76dc280bd623852709e7ffd92caabab076d5475f";
aarch64-unknown-linux-gnu = "f406136010e6a1cdce3fb6573506f00d23858af49dd20a46723c3fa5257b7796";
aarch64-unknown-linux-musl = "4b701dc3cbac04ebf0e336cff2f4ce5fc1a1984c183226863c9ed911eb00b07e";
x86_64-apple-darwin = "139087a3937799415fd829e5a88162a69a32c23725a44457f9c96b98e4d64a7c";
aarch64-apple-darwin = "7ddc335bd10fc32d3039ef36248a5d0c4865db2437c8aad20a2428a6cf41df09";
powerpc64le-unknown-linux-gnu = "3f1d0d5bb13213348dc65e373f8c412fc0a12ee55abc1c864f7e0300932fc687";
riscv64gc-unknown-linux-gnu = "aac7067348d218faa452b4bdc735778a51570a310ad645313ec767b5d7c88492";
mips64el-unknown-linux-gnuabi64 = "d91ed3857c5256720da890f6533684b684e880bf9006dc4e4f4181213a5c4a09";
};

selectRustPackage = pkgs: pkgs.rust_1_66;

rustcPatches = [
];
}

(builtins.removeAttrs args [ "fetchpatch" "pkgsBuildHost" "llvmPackages_11" "llvmPackages_14" "llvm_14"])
3 changes: 2 additions & 1 deletion pkgs/development/compilers/rust/rustc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ in stdenv.mkDerivation rec {
# when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch'
optional (stdenv.isLinux && !withBundledLLVM) "--push-state --as-needed -lstdc++ --pop-state"
++ optional (stdenv.isDarwin && !withBundledLLVM) "-lc++"
++ optional stdenv.isDarwin "-rpath ${llvmSharedForHost}/lib");
++ optional stdenv.isDarwin "-rpath ${llvmSharedForHost}/lib"
++ optional ((lib.versionAtLeast version "1.66") && stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU) "-lgcc");

# Increase codegen units to introduce parallelism within the compiler.
RUSTFLAGS = "-Ccodegen-units=10";
Expand Down
7 changes: 7 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15013,6 +15013,12 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security SystemConfiguration;
llvm_14 = llvmPackages_14.libllvm;
};
rust_1_66 = callPackage ../development/compilers/rust/1_66.nix {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security SystemConfiguration;
llvm_14 = llvmPackages_14.libllvm;
# https://github.com/NixOS/nixpkgs/issues/201254
stdenv = if stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU then gcc11Stdenv else stdenv;
};
rust = rust_1_64;

mrustc = callPackage ../development/compilers/mrustc { };
Expand All @@ -15023,6 +15029,7 @@ with pkgs;
};

rustPackages_1_64 = rust_1_64.packages.stable;
rustPackages_1_66 = rust_1_66.packages.stable;
rustPackages = rustPackages_1_64;

inherit (rustPackages) cargo clippy rustc rustPlatform;
Expand Down

0 comments on commit 6dcefc9

Please sign in to comment.