From 02198751fa6a44b9c4a74c5d0bbcc0d75918db87 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Thu, 17 Aug 2023 02:06:50 -0700 Subject: [PATCH] gcc: move version-map out of all-packages.nix, into pkgs/ --- pkgs/development/compilers/gcc/default.nix | 18 ++++++++++-- pkgs/top-level/all-packages.nix | 33 ++++++---------------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index 1c2bf9d46b91..2aef3007cbf9 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -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="; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8fa72ea5ef2d..262728e914c6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15795,40 +15795,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")) { @@ -15839,8 +15824,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" ]))