on iko/ghcjs-patch-master help sign in
Better error when GHC is too old to build (#1411)
a4da3faHamish Mackenzie
overlays/bootstrap.nix+28−20
@@ -62,6 +62,7 @@ let
62 then final.buildPackages.buildPackages.haskell-nix.compiler.ghc8107
62 then final.buildPackages.buildPackages.haskell-nix.compiler.ghc8107
63 else final.buildPackages.buildPackages.haskell-nix.compiler.ghc884;
63 else final.buildPackages.buildPackages.haskell-nix.compiler.ghc884;
64 latestVer = {
64 latestVer = {
65+ "8.4" = "8.4.4";
65 "8.6" = "8.6.5";
66 "8.6" = "8.6.5";
66 "8.8" = "8.8.4";
67 "8.8" = "8.8.4";
67 "8.10" = "8.10.7";
68 "8.10" = "8.10.7";
@@ -69,11 +70,18 @@ let
69 "9.2" = "9.2.2";
70 "9.2" = "9.2.2";
70 };
71 };
71 traceWarnOld = v: x:
72 traceWarnOld = v: x:
73+ let
74+ bootstrapGhc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
75+ in
76+ if builtins.compareVersions x.src-spec.version bootstrapGhc.version < 0 then
77+ throw "Desired GHC (${x.src-spec.version}) is older than the bootstrap GHC (${bootstrapGhc.version}) for this platform (${final.targetPlatform.config})."
72− # There is no binary for aarch64-linux ghc 8.8.4 so don't warn about 8.8.3
78+ # There is no binary for aarch64-linux ghc 8.8.4 so don't warn about 8.8.3 not being the latest version
73− if x.src-spec.version == "8.8.3" && (final.targetPlatform.isAarch64 || final.buildPlatform.isAarch64)
79+ else if x.src-spec.version == "8.8.3" && (final.targetPlatform.isAarch64 || final.buildPlatform.isAarch64)
74 then x
80 then x
81+ else if builtins.compareVersions x.src-spec.version latestVer.${v} < 0
75− else __trace
82+ then __trace
76− "WARNING: ${x.src-spec.version} is out of date, consider using ${latestVer.${v}}." x;
83+ "WARNING: ${x.src-spec.version} is out of date, consider using ${latestVer.${v}}." x
84+ else x;
77 errorOldGhcjs = v: up: throw "ghcjs ${v} is no longer supported by haskell.nix. Consider using ${latestVer.${up}}";
85 errorOldGhcjs = v: up: throw "ghcjs ${v} is no longer supported by haskell.nix. Consider using ${latestVer.${up}}";
78in {
86in {
79 haskell-nix = prev.haskell-nix // {
87 haskell-nix = prev.haskell-nix // {
@@ -213,7 +221,7 @@ in {
213 ++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.targetPlatform.isAndroid) ./patches/ghc/android-base-needs-iconv.patch
221 ++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.targetPlatform.isAndroid) ./patches/ghc/android-base-needs-iconv.patch
214 ;
222 ;
215 in ({
223 in ({
216− ghc844 = final.callPackage ../compiler/ghc {
224+ ghc844 = final.callPackage ../compiler/ghc (traceWarnOld "8.4" {
217 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc844; };
225 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc844; };
218
226
219 inherit sphinx installDeps;
227 inherit sphinx installDeps;
@@ -234,7 +242,7 @@ in {
234 ghc-patches = ghc-patches "8.4.4"
242 ghc-patches = ghc-patches "8.4.4"
235 ++ [ hsc2hs-align-conditionals-patch D5123-patch ]
243 ++ [ hsc2hs-align-conditionals-patch D5123-patch ]
236 ++ final.lib.optional final.stdenv.isDarwin ./patches/ghc/ghc-8.4.4-backport-dylib-command-size-limit.patch;
244 ++ final.lib.optional final.stdenv.isDarwin ./patches/ghc/ghc-8.4.4-backport-dylib-command-size-limit.patch;
237− };
245+ });
238 ghc861 = final.callPackage ../compiler/ghc (traceWarnOld "8.6" {
246 ghc861 = final.callPackage ../compiler/ghc (traceWarnOld "8.6" {
239 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc861; };
247 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc861; };
240
248
@@ -318,7 +326,7 @@ in {
318 ghc-patches = ghc-patches "8.6.4"
326 ghc-patches = ghc-patches "8.6.4"
319 ++ [ D5123-patch ];
327 ++ [ D5123-patch ];
320 });
328 });
321− ghc865 = final.callPackage ../compiler/ghc {
329+ ghc865 = final.callPackage ../compiler/ghc (traceWarnOld "8.6" {
322 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc865; };
330 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc865; };
323
331
324 inherit sphinx installDeps;
332 inherit sphinx installDeps;
@@ -338,7 +346,7 @@ in {
338
346
339 ghc-patches = ghc-patches "8.6.5"
347 ghc-patches = ghc-patches "8.6.5"
340 ++ [ D5123-patch haddock-900-patch ];
348 ++ [ D5123-patch haddock-900-patch ];
341− };
349+ });
342 ghc881 = final.callPackage ../compiler/ghc (traceWarnOld "8.8" {
350 ghc881 = final.callPackage ../compiler/ghc (traceWarnOld "8.8" {
343 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc881; };
351 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc881; };
344
352
@@ -387,7 +395,7 @@ in {
387
395
388 ghc-patches = ghc-patches "8.8.3";
396 ghc-patches = ghc-patches "8.8.3";
389 });
397 });
390− ghc884 = final.callPackage ../compiler/ghc {
398+ ghc884 = final.callPackage ../compiler/ghc (traceWarnOld "8.8" {
391 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc884; };
399 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc884; };
392
400
393 inherit bootPkgs sphinx installDeps;
401 inherit bootPkgs sphinx installDeps;
@@ -402,7 +410,7 @@ in {
402 };
410 };
403
411
404 ghc-patches = ghc-patches "8.8.4";
412 ghc-patches = ghc-patches "8.8.4";
405− };
413+ });
406 ghc8101 = final.callPackage ../compiler/ghc (traceWarnOld "8.10" {
414 ghc8101 = final.callPackage ../compiler/ghc (traceWarnOld "8.10" {
407 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc8101; };
415 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc8101; };
408
416
@@ -517,7 +525,7 @@ in {
517
525
518 ghc-patches = ghc-patches "8.10.6";
526 ghc-patches = ghc-patches "8.10.6";
519 });
527 });
520− ghc8107 = final.callPackage ../compiler/ghc {
528+ ghc8107 = final.callPackage ../compiler/ghc (traceWarnOld "8.10" {
521 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc8107; };
529 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc8107; };
522
530
523 bootPkgs = bootPkgs // {
531 bootPkgs = bootPkgs // {
@@ -535,8 +543,8 @@ in {
535 };
543 };
536
544
537 ghc-patches = ghc-patches "8.10.7";
545 ghc-patches = ghc-patches "8.10.7";
538− };
546+ });
539− ghc901 = final.callPackage ../compiler/ghc {
547+ ghc901 = final.callPackage ../compiler/ghc (traceWarnOld "9.0" {
540 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc901; };
548 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc901; };
541
549
542 bootPkgs = bootPkgs // {
550 bootPkgs = bootPkgs // {
@@ -554,8 +562,8 @@ in {
554 };
562 };
555
563
556 ghc-patches = ghc-patches "9.0.1";
564 ghc-patches = ghc-patches "9.0.1";
557− };
565+ });
558− ghc902 = final.callPackage ../compiler/ghc {
566+ ghc902 = final.callPackage ../compiler/ghc (traceWarnOld "9.0" {
559 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc902; };
567 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc902; };
560
568
561 bootPkgs = bootPkgs // {
569 bootPkgs = bootPkgs // {
@@ -573,8 +581,8 @@ in {
573 };
581 };
574
582
575 ghc-patches = ghc-patches "9.0.2";
583 ghc-patches = ghc-patches "9.0.2";
576− };
584+ });
577− ghc921 = final.callPackage ../compiler/ghc {
585+ ghc921 = final.callPackage ../compiler/ghc (traceWarnOld "9.2" {
578 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc921; };
586 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc921; };
579
587
580 bootPkgs = bootPkgs // {
588 bootPkgs = bootPkgs // {
@@ -593,8 +601,8 @@ in {
593 };
601 };
594
602
595 ghc-patches = ghc-patches "9.2.1";
603 ghc-patches = ghc-patches "9.2.1";
596− };
604+ });
597− ghc922 = final.callPackage ../compiler/ghc {
605+ ghc922 = final.callPackage ../compiler/ghc (traceWarnOld "9.2" {
598 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc922; };
606 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc922; };
599
607
600 bootPkgs = bootPkgs // {
608 bootPkgs = bootPkgs // {
@@ -613,7 +621,7 @@ in {
613 };
621 };
614
622
615 ghc-patches = ghc-patches "9.2.2";
623 ghc-patches = ghc-patches "9.2.2";
616− };
624+ });
617 # ghc 8.10.4 with patches needed by plutus
625 # ghc 8.10.4 with patches needed by plutus
618 ghc810420210212 = final.callPackage ../compiler/ghc {
626 ghc810420210212 = final.callPackage ../compiler/ghc {
619 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc810420210212; };
627 extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc810420210212; };