Skip to content

Commit

Permalink
Merge pull request #243607 from amjoseph-nixpkgs/pr/gcc/toplevel
Browse files Browse the repository at this point in the history
gcc: deduplicate top-level expressions
  • Loading branch information
Adam Joseph committed Jul 28, 2023
2 parents 205b411 + c2d1d8b commit 0174928
Showing 1 changed file with 35 additions and 139 deletions.
174 changes: 35 additions & 139 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15583,145 +15583,41 @@ with pkgs;
extraPackages = [];
};

gcc48 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "4.8");

isl = if !stdenv.isDarwin then isl_0_14 else null;
cloog = if !stdenv.isDarwin then cloog else null;
texinfo = texinfo5; # doesn't validate since 6.1 -> 6.3 bump
}));

gcc49 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.9 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "4.9");

isl = if !stdenv.isDarwin then isl_0_11 else null;

cloog = if !stdenv.isDarwin then cloog_0_18_0 else null;

# Build fails on Darwin with clang
stdenv = if stdenv.isDarwin then gccStdenv else stdenv;
}));

gcc6 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/6 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "6");

# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;

isl = if stdenv.isDarwin
then null
else if stdenv.targetPlatform.isRedox
then isl_0_17
else isl_0_14;
}));

gcc7 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/7 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "7");

# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;

isl = if !stdenv.isDarwin then isl_0_17 else null;
}));

gcc8 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/8 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "8");

# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;

isl = if !stdenv.isDarwin then isl_0_17 else null;
}));

gcc9 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/9 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "9");

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));

gcc10 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/10 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "10");

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));

gcc11 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/11 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "11");

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));

gcc12 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/12 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = lib.optionalAttrs (stdenv.targetPlatform != stdenv.buildPlatform) (threadsCrossFor "12");

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));

gcc13 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/13 {
inherit noSysDirs;

reproducibleBuild = true;
profiledCompiler = false;

libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCrossFor "13" else { };

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
# 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}") ({
inherit noSysDirs;
reproducibleBuild = true;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCrossFor version 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") {
texinfo = texinfo5; # doesn't validate since 6.1 -> 6.3 bump
} // lib.optionalAttrs (version == "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
) [ "4.8" "4.9" "6" "7" "8" "9" "10" "11" "12" "13" ]))
gcc48 gcc49 gcc6 gcc7 gcc8 gcc9 gcc10 gcc11 gcc12 gcc13;

gcc_latest = gcc13;

Expand Down

0 comments on commit 0174928

Please sign in to comment.