Skip to content

Commit

Permalink
Merge pull request #243394 from amjoseph-nixpkgs/pr/threadsCross/dedu…
Browse files Browse the repository at this point in the history
…plicate

threadsCross: factor out copy-and-pasted code
  • Loading branch information
Adam Joseph committed Jul 15, 2023
2 parents 23fae57 + ffd7dbc commit 1f0d951
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15418,7 +15418,7 @@ with pkgs;
profiledCompiler = false;

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

isl = if !stdenv.isDarwin then isl_0_14 else null;
cloog = if !stdenv.isDarwin then cloog else null;
Expand All @@ -15432,7 +15432,7 @@ with pkgs;
profiledCompiler = false;

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

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

Expand All @@ -15449,7 +15449,7 @@ with pkgs;
profiledCompiler = false;

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

# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;
Expand All @@ -15468,7 +15468,7 @@ with pkgs;
profiledCompiler = false;

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

# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;
Expand All @@ -15483,7 +15483,7 @@ with pkgs;
profiledCompiler = false;

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

# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;
Expand All @@ -15498,7 +15498,7 @@ with pkgs;
profiledCompiler = false;

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

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
Expand All @@ -15510,7 +15510,7 @@ with pkgs;
profiledCompiler = false;

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

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
Expand All @@ -15522,7 +15522,7 @@ with pkgs;
profiledCompiler = false;

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

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
Expand All @@ -15534,7 +15534,7 @@ with pkgs;
profiledCompiler = false;

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

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
Expand All @@ -15546,7 +15546,7 @@ with pkgs;
profiledCompiler = false;

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

isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
Expand Down Expand Up @@ -17154,10 +17154,7 @@ with pkgs;
# want the C++ library to be explicitly chosen by the caller, and null by
# default.
libcxx ? null
, extraPackages ? lib.optional (cc.isGNU or false && stdenv.targetPlatform.isMinGW)
(if lib.versionAtLeast cc.version "13"
then threadsCross.package
else threadsCross_pre_gcc_13.package)
, extraPackages ? lib.optional (cc.isGNU or false && stdenv.targetPlatform.isMinGW) ((threadsCrossFor cc.version).package)
, nixSupport ? {}
, ...
} @ extraArgs:
Expand Down Expand Up @@ -21189,20 +21186,17 @@ with pkgs;

libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;

threadsCross_pre_gcc_13 = if stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)
threadsCross = threadsCrossFor null;
threadsCrossFor = cc_version:
if stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)
then {
# other possible values: win32 or posix
model = "mcf";
# For win32 or posix set this to null
package = targetPackages.windows.mcfgthreads_pre_gcc_13 or windows.mcfgthreads_pre_gcc_13;
} else { };

threadsCross = if stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)
then {
# other possible values: win32 or posix
model = "mcf";
# For win32 or posix set this to null
package = targetPackages.windows.mcfgthreads or windows.mcfgthreads;
package =
if cc_version == null || lib.versionAtLeast cc_version "13"
then targetPackages.windows.mcfgthreads or windows.mcfgthreads
else targetPackages.windows.mcfgthreads_pre_gcc_13 or windows.mcfgthreads_pre_gcc_13;
} else { };

wasilibc = callPackage ../development/libraries/wasilibc {
Expand Down

0 comments on commit 1f0d951

Please sign in to comment.