gcc: move version-map out of all-packages.nix, into pkgs/

This commit is contained in:
Adam Joseph 2023-08-17 02:06:50 -07:00
parent 911452ccbd
commit 30171782b7
2 changed files with 24 additions and 27 deletions

View file

@ -31,7 +31,7 @@
, disableGdbPlugin ? !enablePlugin
, nukeReferences
, callPackage
, version
, majorMinorVersion
# only for gcc<=6.x
, langJava ? false
@ -46,6 +46,20 @@
}:
let
version = {
"13" = "13.2.0";
"12" = "12.3.0";
"11" = "11.4.0";
"10" = "10.5.0";
"9" = "9.5.0";
"8" = "8.5.0";
"7" = "7.5.0";
"6" = "6.5.0";
"4.9"= "4.9.4";
"4.8"= "4.8.5";
}."${majorMinorVersion}";
majorVersion = lib.versions.major version;
atLeast13 = lib.versionAtLeast version "13";
atLeast12 = lib.versionAtLeast version "12";
atLeast11 = lib.versionAtLeast version "11";
@ -231,7 +245,7 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
then "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz"
else "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
${if majorVersion == "11" then "hash" else "sha256"} = {
"13.1.0" = "sha256-YdaE8Kpedqxlha2ImKJCeq3ol57V5/hUkihsTfwT7oY=";
"13.2.0" = "sha256-4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
"12.3.0" = "sha256-lJpdT5nnhkIak7Uysi/6tVeN5zITaZdbka7Jet/ajDs=";
"11.4.0" = "sha256-Py2yIrAH6KSiPNW6VnJu8I6LHx6yBV7nLBQCzqc6jdk=";
"10.5.0" = "sha256-JRCVQ/30bzl8NHtdi3osflaUpaUczkucbh6opxyjB8E=";

View file

@ -15797,40 +15797,25 @@ with pkgs;
# This expression will be pushed into pkgs/development/compilers/gcc/common
# once the top-level gcc/${version}/default.nix files are deduplicated.
inherit
(lib.listToAttrs (map (version:
let atLeast = lib.versionAtLeast version;
attrName = "gcc${lib.replaceStrings ["."] [""] version}";
deduplicatedVersions = { # map from majorVersion to exact version
"13" = "13.1.0";
"12" = "12.3.0";
"11" = "11.4.0";
"10" = "10.4.0";
"9" = "9.5.0";
"8" = "8.5.0";
"7" = "7.5.0";
"6" = "6.5.0";
"4.9"= "4.9.4";
"4.8"= "4.8.5";
};
deduplicated = deduplicatedVersions ? "${version}";
path = if deduplicated
then ../development/compilers/gcc/default.nix
else ../development/compilers/gcc + "/${version}";
pkg = lowPrio (wrapCC (callPackage path ({
(lib.listToAttrs (map (majorMinorVersion:
let atLeast = lib.versionAtLeast majorMinorVersion;
attrName = "gcc${lib.replaceStrings ["."] [""] majorMinorVersion}";
pkg = lowPrio (wrapCC (callPackage ../development/compilers/gcc/default.nix ({
inherit noSysDirs;
inherit majorMinorVersion;
reproducibleBuild = true;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCrossFor version else { };
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCrossFor majorMinorVersion else { };
isl = if stdenv.isDarwin then null
else if atLeast "9" then isl_0_20
else if atLeast "7" then isl_0_17
else if atLeast "6" then (if stdenv.targetPlatform.isRedox then isl_0_17 else isl_0_14)
else if atLeast "4.9" then isl_0_11
else /* "4.8" */ isl_0_14;
} // lib.optionalAttrs (version == "4.8") {
} // lib.optionalAttrs (majorMinorVersion == "4.8") {
texinfo = texinfo5; # doesn't validate since 6.1 -> 6.3 bump
} // lib.optionalAttrs (version == "4.9") {
} // lib.optionalAttrs (majorMinorVersion == "4.9") {
# Build fails on Darwin with clang
stdenv = if stdenv.isDarwin then gccStdenv else stdenv;
} // lib.optionalAttrs (!(atLeast "6")) {
@ -15841,8 +15826,6 @@ with pkgs;
} // lib.optionalAttrs (atLeast "6" && !(atLeast "9")) {
# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;
} // lib.optionalAttrs deduplicated {
version = deduplicatedVersions."${version}";
})));
in lib.nameValuePair attrName pkg
) [ "4.8" "4.9" "6" "7" "8" "9" "10" "11" "12" "13" ]))