summary refs log tree commit diff
path: root/pkgs/top-level
diff options
context:
space:
mode:
authorAdam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>2023-08-21 09:17:48 +0000
committerGitHub <noreply@github.com>2023-08-21 09:17:48 +0000
commited70e8c52dbe98f130fad2c011f1084f53c45118 (patch)
tree651c23b5be7973e3c03d67f377fbeac2e901da26 /pkgs/top-level
parent92ccc5f48b4f59e36175115abf334a1cc7d2c48e (diff)
parentb955304456e58c3be8df824d7ad2ffc997411945 (diff)
downloadnixpkgs-ed70e8c52dbe98f130fad2c011f1084f53c45118.tar
nixpkgs-ed70e8c52dbe98f130fad2c011f1084f53c45118.tar.gz
nixpkgs-ed70e8c52dbe98f130fad2c011f1084f53c45118.tar.bz2
nixpkgs-ed70e8c52dbe98f130fad2c011f1084f53c45118.tar.lz
nixpkgs-ed70e8c52dbe98f130fad2c011f1084f53c45118.tar.xz
nixpkgs-ed70e8c52dbe98f130fad2c011f1084f53c45118.tar.zst
nixpkgs-ed70e8c52dbe98f130fad2c011f1084f53c45118.zip
Merge pull request #250489 from amjoseph-nixpkgs/pr/gcc/deduplicate-staging
gcc: deduplicate version expressions

The last merge of `staging` into `master` caused a really nasty merge conflict here.

Since this is strictly cleanup (no change after eval), in order to prevent that from happening again I am merging this to both `master` and `staging`.  It's much easier to rebase other patches past this one than it is to rebase this one past other patches.
Diffstat (limited to 'pkgs/top-level')
-rw-r--r--pkgs/top-level/all-packages.nix30
1 files changed, 15 insertions, 15 deletions
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 808845cf401..db45bf56ef1 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15664,14 +15664,12 @@ with pkgs;
 
   gbforth = callPackage ../development/compilers/gbforth { };
 
-  inherit (let
-      num =
-        if (with stdenv.targetPlatform; isVc4 || libc == "relibc") then 6
-        else 12;
-      numS = toString num;
-    in {
-      gcc = pkgs.${"gcc${numS}"};
-      gccFun = callPackage (../development/compilers/gcc + "/${numS}");
+  default-gcc-version =
+    if (with stdenv.targetPlatform; isVc4 || libc == "relibc") then 6
+    else 12;
+  inherit ({
+      gcc = pkgs.${"gcc${toString default-gcc-version}"};
+      gccFun = callPackage ../development/compilers/gcc;
     }) gcc gccFun;
   gcc-unwrapped = gcc.cc;
 
@@ -15772,6 +15770,7 @@ with pkgs;
       cc = gccFun {
         # copy-pasted
         inherit noSysDirs;
+        majorMinorVersion = toString default-gcc-version;
 
         reproducibleBuild = true;
         profiledCompiler = false;
@@ -15799,24 +15798,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}";
-          pkg = lowPrio (wrapCC (callPackage (../development/compilers/gcc + "/${version}") ({
+    (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")) {