diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-11-07 12:00:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-07 12:00:57 +0000 |
commit | bed56440cbc230c9858b0aee045ac5ae9a8ff2c7 (patch) | |
tree | 8249a7e712815f4dc707c05a56daa472e181e722 /pkgs/development/compilers/gcc | |
parent | 7eb07191a5fa3207605d78777b95dd70f237fa71 (diff) | |
parent | 11e04c904399271e608ecc68c0405ad70ce622a7 (diff) | |
download | nixlib-bed56440cbc230c9858b0aee045ac5ae9a8ff2c7.tar nixlib-bed56440cbc230c9858b0aee045ac5ae9a8ff2c7.tar.gz nixlib-bed56440cbc230c9858b0aee045ac5ae9a8ff2c7.tar.bz2 nixlib-bed56440cbc230c9858b0aee045ac5ae9a8ff2c7.tar.lz nixlib-bed56440cbc230c9858b0aee045ac5ae9a8ff2c7.tar.xz nixlib-bed56440cbc230c9858b0aee045ac5ae9a8ff2c7.tar.zst nixlib-bed56440cbc230c9858b0aee045ac5ae9a8ff2c7.zip |
Merge master into staging-next
Diffstat (limited to 'pkgs/development/compilers/gcc')
-rw-r--r-- | pkgs/development/compilers/gcc/all.nix | 53 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/default.nix | 28 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/versions.nix | 38 |
3 files changed, 95 insertions, 24 deletions
diff --git a/pkgs/development/compilers/gcc/all.nix b/pkgs/development/compilers/gcc/all.nix new file mode 100644 index 000000000000..82a64f48c37e --- /dev/null +++ b/pkgs/development/compilers/gcc/all.nix @@ -0,0 +1,53 @@ +{ lib +, stdenv +, gccStdenv +, gcc7Stdenv +, callPackage +, isl_0_11, isl_0_14, isl_0_17, isl_0_20 +, libcCross +, threadsCrossFor +, noSysDirs +, texinfo5 +, cloog_0_18_0, cloog +, lowPrio +, wrapCC +}@args: + +let + versions = import ./versions.nix; + gccForMajorMinorVersion = majorMinorVersion: + let + atLeast = lib.versionAtLeast majorMinorVersion; + attrName = "gcc${lib.replaceStrings ["."] [""] majorMinorVersion}"; + pkg = lowPrio (wrapCC (callPackage ./default.nix ({ + inherit noSysDirs; + inherit majorMinorVersion; + reproducibleBuild = true; + profiledCompiler = false; + libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then args.libcCross else null; + 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 (majorMinorVersion == "4.8") { + texinfo = texinfo5; # doesn't validate since 6.1 -> 6.3 bump + } // lib.optionalAttrs (majorMinorVersion == "4.9") { + # Build fails on Darwin with clang + stdenv = if stdenv.isDarwin then gccStdenv else stdenv; + } // lib.optionalAttrs (!(atLeast "6")) { + cloog = if stdenv.isDarwin + then null + else if atLeast "4.9" then cloog_0_18_0 + else /* 4.8 */ cloog; + } // 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; + }))); + in + lib.nameValuePair attrName pkg; +in +lib.listToAttrs (map gccForMajorMinorVersion versions.allMajorVersions) + diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index 4544f3862fea..0980944dfc29 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -47,18 +47,8 @@ }: 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}"; + versions = import ./versions.nix; + version = versions.fromMajorMinor majorMinorVersion; majorVersion = lib.versions.major version; atLeast13 = lib.versionAtLeast version "13"; @@ -255,18 +245,8 @@ lib.pipe ((callFile ./common/builder.nix {}) ({ else if atLeast6 then "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz" else "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2"; - ${if is10 || is11 || is13 then "hash" else "sha256"} = { - "13.2.0" = "sha256-4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o="; - "12.3.0" = "sha256-lJpdT5nnhkIak7Uysi/6tVeN5zITaZdbka7Jet/ajDs="; - "11.4.0" = "sha256-Py2yIrAH6KSiPNW6VnJu8I6LHx6yBV7nLBQCzqc6jdk="; - "10.5.0" = "sha256-JRCVQ/30bzl8NHtdi3osflaUpaUczkucbh6opxyjB8E="; - "9.5.0" = "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7"; - "8.5.0" = "0l7d4m9jx124xsk6xardchgy2k5j5l2b15q322k31f0va4d8826k"; - "7.5.0" = "0qg6kqc5l72hpnj4vr6l0p69qav0rh4anlkk3y55540zy3klc6dq"; - "6.5.0" = "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby"; - "4.9.4" = "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc"; - "4.8.5" = "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2"; - }."${version}"; + ${if is10 || is11 || is13 then "hash" else "sha256"} = + versions.srcHashForVersion version; }; inherit patches; diff --git a/pkgs/development/compilers/gcc/versions.nix b/pkgs/development/compilers/gcc/versions.nix new file mode 100644 index 000000000000..261ffc634544 --- /dev/null +++ b/pkgs/development/compilers/gcc/versions.nix @@ -0,0 +1,38 @@ +let + majorMinorToVersionMap = { + "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"; + }; + + fromMajorMinor = majorMinorVersion: + majorMinorToVersionMap."${majorMinorVersion}"; + + # TODO(amjoseph): convert older hashes to SRI form + srcHashForVersion = version: { + # NOTE: there is no need to remove hashes of obsolete minor + # versions when adding a new minor version. + "13.2.0" = "sha256-4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o="; + "12.3.0" = "sha256-lJpdT5nnhkIak7Uysi/6tVeN5zITaZdbka7Jet/ajDs="; + "11.4.0" = "sha256-Py2yIrAH6KSiPNW6VnJu8I6LHx6yBV7nLBQCzqc6jdk="; + "10.5.0" = "sha256-JRCVQ/30bzl8NHtdi3osflaUpaUczkucbh6opxyjB8E="; + "9.5.0" = "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7"; + "8.5.0" = "0l7d4m9jx124xsk6xardchgy2k5j5l2b15q322k31f0va4d8826k"; + "7.5.0" = "0qg6kqc5l72hpnj4vr6l0p69qav0rh4anlkk3y55540zy3klc6dq"; + "6.5.0" = "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby"; + "4.9.4" = "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc"; + "4.8.5" = "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2"; + }."${version}"; + +in { + inherit fromMajorMinor; + inherit srcHashForVersion; + allMajorVersions = builtins.attrNames majorMinorToVersionMap; +} |