Skip to content

Commit 122bd81

Browse files
hamishmackkayhide
andauthored
Add ghc 8.8.1 to the supported compilers (#342)
* Add ghc 8.8.1 to the supported compilers The `overlays/ghc.nix` overrides were not applied to the `ghc` used to by the `exactDeps` and `envDeps` `passthru` derivations. This resulted in each ghc building twice with only one of them being cached by hydra. This change fixes this by moving the exactDeps and envDeps for ghc into sub directories of the output of the ghc derivation itself. Co-authored-by: Hideaki KAWAI <[email protected]>
1 parent b147d50 commit 122bd81

11 files changed

+10869
-671
lines changed

builder/make-config-files.nix

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ in { identifier, component, fullName, flags ? {} }:
114114
#
115115
# NOTE [ln -s -f]: we force link, as we may have dependencies that contain shared deps
116116
# (e.g. libiconv), and thus we don't want to fail, but just link it again.
117+
#
118+
# Confusing sed stuff:
119+
# '/^ ./{H;$!d} ; x' Groups lines that start with a space with the initial
120+
# line of a block. Needs a blank line added to the file
121+
# to terminate the last block.
122+
# 's/ /\n/g ; s/\n\n*/\n/g; s/^\n//;' Puts each field on its own line.
117123
+ lib.optionalString stdenv.isDarwin ''
118124
# Work around a limit in the macOS Sierra linker on the number of paths
119125
# referenced by any one dynamic library:
@@ -122,12 +128,19 @@ in { identifier, component, fullName, flags ? {} }:
122128
# libraries) from all the dependencies.
123129
local dynamicLinksDir="$out/lib/links"
124130
mkdir -p $dynamicLinksDir
125-
for d in $(grep dynamic-library-dirs "$out/package.conf.d/"*|awk '{print $2}'|sort -u); do
131+
local dirsToLink=$(
132+
for f in "$out/package.conf.d/"*.conf; do
133+
(cat $f; echo) | sed -En '/^ ./{H;$!d} ; x ; /^dynamic-library-dirs:/ {s/^dynamic-library-dirs:// ; s/ /\n/g ; s/\n\n*/\n/g; s/^\n//; p}'
134+
done | sort -u
135+
)
136+
for d in $dirsToLink; do
126137
ln -f -s "$d/"*.dylib $dynamicLinksDir
127138
done
128139
# Edit the local package DB to reference the links directory.
129140
for f in "$out/package.conf.d/"*.conf; do
130-
sed -i "s,dynamic-library-dirs: .*,dynamic-library-dirs: $dynamicLinksDir," $f
141+
chmod +w $f
142+
echo >> $f
143+
sed -i -E "/^ ./{H;$!d} ; x ; s,^dynamic-library-dirs:.*,dynamic-library-dirs: $dynamicLinksDir," $f
131144
done
132145
'' + ''
133146
${target-pkg} -v0 --package-db $out/package.conf.d recache

nix-tools/default.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,17 @@ let
4242
}
4343

4444
{
45-
reinstallableLibGhc = true;
45+
# Make Cabal reinstallable
46+
nonReinstallablePkgs =
47+
[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
48+
"deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
49+
"ghc-boot"
50+
"ghc" "Win32" "array" "binary" "bytestring" "containers"
51+
"directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim"
52+
"hpc"
53+
"mtl" "parsec" "process" "text" "time" "transformers"
54+
"unix" "xhtml"
55+
];
4656
}
4757
] ++ pkgs.lib.optional (args ? ghc) { ghc.package = args.ghc; };
4858
};

overlays/bootstrap.nix

Lines changed: 79 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -57,51 +57,58 @@ in {
5757
};
5858
ghc-patches = version: let
5959
# Returns true iff this derivation's version is strictly older than ver.
60-
versionOlder = ver: builtins.compareVersions ver version == 1;
60+
versionLessThan = ver: builtins.compareVersions ver version == 1;
6161
# Returns true iff this derivation's verion is greater than or equal to ver.
62-
versionAtLeast = ver: !versionOlder ver;
63-
# Patches for which we know they have been merged into a public release already
64-
in self.lib.optional (versionAtLeast "8.4.4" && versionOlder "8.6") ./patches/ghc/ghc-8.4.4-reinstallable-lib-ghc.patch
65-
++ self.lib.optional (versionOlder "8.6") ./patches/ghc/move-iserv-8.4.2.patch
66-
++ self.lib.optional (versionOlder "8.6") ./patches/ghc/hsc2hs-8.4.2.patch
67-
++ self.lib.optional (versionOlder "8.6") ./patches/ghc/various-8.4.2.patch
68-
++ self.lib.optional (versionOlder "8.6") ./patches/ghc/lowercase-8.4.2.patch
69-
++ self.lib.optional (versionOlder "8.6") ./patches/ghc/cabal-exe-ext-8.4.2.patch
70-
++ self.lib.optional (versionOlder "8.6") ./patches/ghc/ghc-8.4.3-Cabal2201-SMP-test-fix.patch
71-
++ self.lib.optional (versionOlder "8.6") ./patches/ghc/outputtable-assert-8.4.patch
72-
++ self.lib.optional (versionAtLeast "8.6" && versionOlder "8.6.4") ./patches/ghc/MR148--T16104-GhcPlugins.patch
73-
++ self.lib.optional (versionOlder "8.6.4") ./patches/ghc/MR95--ghc-pkg-deadlock-fix.patch
74-
75-
# Patches for which we only know a lower bound.
76-
++ self.lib.optional (versionAtLeast "8.6") ./patches/ghc/iserv-proxy-cleanup.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/250 -- merged; ghc-8.8.1
77-
++ self.lib.optional (versionAtLeast "8.2") ./patches/ghc/MR545--ghc-pkg-databases.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/545 -- merged; ghc-8.8.1
78-
++ self.lib.optional (versionAtLeast "8.6") ./patches/ghc/outputtable-assert-8.6.patch
79-
++ self.lib.optional (versionAtLeast "8.6") ./patches/ghc/mistuke-ghc-err_clean_up_error_handler-8ab1a89af89848f1713e6849f189de66c0ed7898.diff # this is part of Phyx- revamped io-manager.
80-
++ self.lib.optional (versionAtLeast "8.6.4") ./patches/ghc/ghc-8.6.4-reenable-th-qq-in-stage1.patch
81-
++ [
82-
./patches/ghc/ghc-add-keepCAFs-to-rts.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/950 -- open
83-
./patches/ghc/lowercase-8.6.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/949 -- merged; ghc-8.8.1
84-
./patches/ghc/dll-loader-8.4.2.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/949 -- open
85-
./patches/ghc/0001-Stop-the-linker-panic.patch # https://phabricator.haskell.org/D5012 -- merged; ghc-8.8.1
86-
./patches/ghc/ghc-8.4.3-Cabal2201-no-hackage-tests.patch # ?
87-
./patches/ghc/ghc-8.4.3-Cabal2201-allow-test-wrapper.patch # https://github.com/haskell/cabal/pulls/5995 -- merged; cabal-3.0.0 (ghc-8.8.1)
88-
./patches/ghc/ghc-8.4.3-Cabal2201-response-file-support.patch # https://github.com/haskell/cabal/pulls/5996 -- merged; cabal-3.0.0 (ghc-8.8.1)
89-
./patches/ghc/ghc-8.6-Cabal-fix-datadir.patch # https://github.com/haskell/cabal/issues/5862
90-
./patches/ghc/MR196--ghc-pkg-shut-up.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/196 -- merged; ghc-8.8.1
91-
./patches/ghc/MR948--32bit-cross-th.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/948 -- open
92-
]
62+
versionAtLeast = ver: !versionLessThan ver;
63+
from = start: self.lib.optional (versionAtLeast start);
64+
fromUntil = start: end: self.lib.optional (versionAtLeast start && versionLessThan end);
65+
until = end: self.lib.optional (versionLessThan end);
66+
always = self.lib.optional true;
67+
# Try to avoid reordering the patches unless a patch is added or changed that
68+
# will be applied to most versions of the GHC anyway (reordering the patches
69+
# results in rebuilds of GHC and reduces sharing in /nix/store).
70+
in fromUntil "8.4.4" "8.6" ./patches/ghc/ghc-8.4.4-reinstallable-lib-ghc.patch
71+
++ until "8.6" ./patches/ghc/move-iserv-8.4.2.patch
72+
++ until "8.6" ./patches/ghc/hsc2hs-8.4.2.patch
73+
++ until "8.6" ./patches/ghc/various-8.4.2.patch
74+
++ until "8.6" ./patches/ghc/lowercase-8.4.2.patch
75+
++ until "8.6" ./patches/ghc/cabal-exe-ext-8.4.2.patch
76+
++ until "8.6" ./patches/ghc/ghc-8.4.3-Cabal2201-SMP-test-fix.patch
77+
++ until "8.6" ./patches/ghc/outputtable-assert-8.4.patch
78+
++ fromUntil "8.6" "8.6.4" ./patches/ghc/MR148--T16104-GhcPlugins.patch
79+
++ until "8.6.4" ./patches/ghc/MR95--ghc-pkg-deadlock-fix.patch
80+
++ fromUntil "8.6" "8.8" ./patches/ghc/iserv-proxy-cleanup.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/250 -- merged; ghc-8.8.1
81+
++ from "8.6" ./patches/ghc/iserv-proxy-cleanup-2.patch
82+
++ from "8.8" ./patches/ghc/iserv-proxy-cleanup-3.patch
83+
++ fromUntil "8.2" "8.8" ./patches/ghc/MR545--ghc-pkg-databases.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/545 -- merged; ghc-8.8.1
84+
++ fromUntil "8.6" "8.8" ./patches/ghc/outputtable-assert-8.6.patch
85+
++ fromUntil "8.6.4" "8.8" ./patches/ghc/ghc-8.6.4-reenable-th-qq-in-stage1.patch
86+
++ until "8.8" ./patches/ghc/0001-Stop-the-linker-panic.patch # https://phabricator.haskell.org/D5012 -- merged; ghc-8.8.1
87+
++ until "8.8" ./patches/ghc/ghc-8.4.3-Cabal2201-allow-test-wrapper.patch # https://github.com/haskell/cabal/pulls/5995 -- merged; cabal-3.0.0 (ghc-8.8.1)
88+
++ until "8.8" ./patches/ghc/ghc-8.4.3-Cabal2201-response-file-support.patch # https://github.com/haskell/cabal/pulls/5996 -- merged; cabal-3.0.0 (ghc-8.8.1)
89+
++ until "8.8" ./patches/ghc/ghc-8.6-Cabal-fix-datadir.patch # https://github.com/haskell/cabal/issues/5862
90+
++ until "8.8" ./patches/ghc/MR196--ghc-pkg-shut-up.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/196 -- merged; ghc-8.8.1
91+
++ from "8.6" ./patches/ghc/mistuke-ghc-err_clean_up_error_handler-8ab1a89af89848f1713e6849f189de66c0ed7898.diff # this is part of Phyx- revamped io-manager.
92+
++ always ./patches/ghc/ghc-add-keepCAFs-to-rts.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/950 -- open
93+
++ always ./patches/ghc/lowercase-8.6.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/949 -- merged; ghc-8.8.1
94+
++ always ./patches/ghc/dll-loader-8.4.2.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/949 -- open
95+
++ always ./patches/ghc/ghc-8.4.3-Cabal2201-no-hackage-tests.patch # ?
96+
++ always ./patches/ghc/MR948--32bit-cross-th.patch # https://gitlab.haskell.org/ghc/ghc/merge_requests/948 -- open
97+
++ from "8.8" ./patches/ghc/cabal-host.patch # https://github.com/haskell/cabal/issues/5887
98+
++ fromUntil "8.6.4" "8.8" ./patches/ghc/ghc-8.6.4-prim-no-arm-atomics.patch
99+
++ fromUntil "8.6.4" "8.8" ./patches/ghc/global-offset-table.patch
100+
++ fromUntil "8.6.4" "8.8" ./patches/ghc/global-offset-table-2.patch
93101

94102
# Patches for specific ghc versions.
95-
++ self.lib.optional (version == "8.6.3") ./patches/ghc/T16057--ghci-doa-on-windows.patch
96-
++ self.lib.optional (version == "8.6.3") ./patches/ghc/ghc-8.6.3-reinstallable-lib-ghc.patch
97-
++ self.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-reinstallable-lib-ghc.patch
98-
++ self.lib.optional (version == "8.6.5") ./patches/ghc/ghc-8.6.5-reinstallable-lib-ghc.patch
99-
++ self.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-better-plusSimplCountErrors.patch
103+
++ self.lib.optional (version == "8.6.3") ./patches/ghc/T16057--ghci-doa-on-windows.patch
104+
++ self.lib.optional (version == "8.6.3") ./patches/ghc/ghc-8.6.3-reinstallable-lib-ghc.patch
105+
++ self.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-reinstallable-lib-ghc.patch
106+
++ self.lib.optional (version == "8.6.5") ./patches/ghc/ghc-8.6.5-reinstallable-lib-ghc.patch
107+
++ self.lib.optional (version == "8.8.1") ./patches/ghc/ghc-8.8.1-reinstallable-lib-ghc.patch
108+
++ self.lib.optional (version == "8.8.2") ./patches/ghc/ghc-8.8.2-reinstallable-lib-ghc.patch
109+
++ self.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-better-plusSimplCountErrors.patch
100110
++ self.lib.optional (versionAtLeast "8.6.4" && self.stdenv.isDarwin) ./patches/ghc/ghc-macOS-loadArchive-fix.patch
101111
++ self.lib.optional (versionAtLeast "8.4.4" && self.stdenv.isDarwin) ./patches/ghc/ghc-darwin-gcc-version-fix.patch
102-
++ self.lib.optional (versionAtLeast "8.6.4" && versionOlder "8.8") ./patches/ghc/ghc-8.6.4-prim-no-arm-atomics.patch
103-
++ self.lib.optional (versionAtLeast "8.6.4" && versionOlder "8.8") ./patches/ghc/global-offset-table.patch
104-
++ self.lib.optional (versionAtLeast "8.6.4" && versionOlder "8.8") ./patches/ghc/global-offset-table-2.patch
105112
;
106113
in ({
107114
ghc844 = self.callPackage ../compiler/ghc {
@@ -206,6 +213,38 @@ in {
206213
ghc-patches = ghc-patches "8.6.5"
207214
++ [ D5123-patch haddock-900-patch ];
208215
};
216+
ghc881 = self.callPackage ../compiler/ghc {
217+
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc881; };
218+
219+
inherit bootPkgs sphinx installDeps;
220+
221+
buildLlvmPackages = self.buildPackages.llvmPackages_7;
222+
llvmPackages = self.llvmPackages_7;
223+
224+
src-spec = rec {
225+
version = "8.8.1";
226+
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
227+
sha256 = "06kj4fhvijinjafiy4s873n60qly323rdlz9bmc79nhlp3cq72lh";
228+
};
229+
230+
ghc-patches = ghc-patches "8.8.1";
231+
};
232+
ghc882 = self.callPackage ../compiler/ghc {
233+
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc882; };
234+
235+
inherit bootPkgs sphinx installDeps;
236+
237+
buildLlvmPackages = self.buildPackages.llvmPackages_7;
238+
llvmPackages = self.llvmPackages_7;
239+
240+
src-spec = rec {
241+
version = "8.8.2";
242+
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
243+
sha256 = "02qa6wgjpxgakg7hv4zfdlrx9k7zxa5i02wnr6y9fsv8j16sbkh1";
244+
};
245+
246+
ghc-patches = ghc-patches "8.8.2";
247+
};
209248
} // self.lib.optionalAttrs (self.targetPlatform.isGhcjs or false) {
210249
ghc865 = let ghcjs865 = self.callPackage ../compiler/ghcjs/ghcjs.nix {
211250
ghcjsSrcJson = ../compiler/ghcjs/ghcjs-src.json;

overlays/ghc-packages.nix

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ let
3838

3939
ghc-extra-pkgs = {
4040
ghc = "compiler";
41+
base = "libraries/base";
42+
bytestring = "libraries/bytestring";
4143
ghci = "libraries/ghci";
4244
ghc-boot = "libraries/ghc-boot";
45+
ghc-heap = "libraries/ghc-heap";
4346
libiserv = "libraries/libiserv";
4447
iserv = "utils/iserv";
4548
remote-iserv = "utils/remote-iserv";
@@ -67,8 +70,13 @@ in rec {
6770
(pkgName: dir: importCabal "${name}-${pkgName}" "${value.passthru.configured-src}/${dir}") ghc-extra-pkgs)
6871
self.buildPackages.haskell-nix.compiler;
6972

70-
ghc-extra-pkgs-cabal-projects = builtins.mapAttrs (name: value: let package-locs = builtins.mapAttrs (_: dir: "${value.passthru.configured-src}/${dir}") ghc-extra-pkgs; in
71-
self.writeTextFile {
73+
ghc-extra-pkgs-cabal-projects = builtins.mapAttrs (name: value:
74+
let package-locs =
75+
builtins.mapAttrs (_: dir: "${value.passthru.configured-src}/${dir}")
76+
# TODO ghc-heap.cabal requires cabal 3. We should update the cabalProject' call
77+
# in `ghc-extra-projects` below to work with this.
78+
(self.lib.filterAttrs (n: _: n != "base" && n != "ghc-heap") ghc-extra-pkgs);
79+
in self.writeTextFile {
7280
name = "ghc-extra-pkgs-cabal-project-${name}";
7381
destination = "/cabal.project";
7482
text = ''
@@ -86,6 +94,7 @@ in rec {
8694
src = proj;
8795
index-state = "2019-10-31T00:00:00Z";
8896
ghc = self.buildPackages.haskell-nix.compiler.${name};
97+
configureArgs = "--disable-tests"; # avoid failures satisfying bytestring package tests dependencies
8998
})
9099
ghc-extra-pkgs-cabal-projects;
91100

overlays/haskell.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ self: super: {
131131
}@args:
132132

133133
let
134-
pkg-def = plan-pkgs.pkgs;
134+
pkg-def = excludeBootPackages plan-pkgs.pkgs;
135135
# The compiler referenced in the stack config
136136
compiler = (plan-pkgs.extras hackage).compiler or (pkg-def hackage).compiler;
137137
patchesModule = ghcHackagePatches.${compiler.nix-name} or {};
@@ -472,7 +472,7 @@ self: super: {
472472
};
473473

474474
haskellNixRoots' = ifdLevel:
475-
let filterSupportedGhc = self.lib.filterAttrs (n: _: n == "ghc865");
475+
let filterSupportedGhc = self.lib.filterAttrs (n: _: n == "ghc865" || n == "ghc882");
476476
in self.recurseIntoAttrs ({
477477
# Things that require no IFD to build
478478
inherit (self.buildPackages.haskell-nix) nix-tools source-pins;
@@ -486,6 +486,7 @@ self: super: {
486486
happy = self.buildPackages.haskell-nix.bootstrap.packages.happy;
487487
hscolour = self.buildPackages.haskell-nix.bootstrap.packages.hscolour;
488488
ghc865 = self.buildPackages.haskell-nix.compiler.ghc865;
489+
ghc882 = self.buildPackages.haskell-nix.compiler.ghc882;
489490
ghc-extra-projects = self.recurseIntoAttrs (builtins.mapAttrs (_: proj: withInputs proj.plan-nix)
490491
(filterSupportedGhc self.ghc-extra-projects));
491492
} // self.lib.optionalAttrs (ifdLevel > 1) {

overlays/patches/ghc/cabal-host.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/libraries/Cabal/Cabal/Distribution/Simple.hs b/libraries/Cabal/Cabal/Distribution/Simple.hs
2+
index e632acc88..1a687bb2e 100644
3+
--- a/libraries/Cabal/Cabal/Distribution/Simple.hs
4+
+++ b/libraries/Cabal/Cabal/Distribution/Simple.hs
5+
@@ -755,7 +755,7 @@ runConfigureScript verbosity backwardsCompatHack flags lbi = do
6+
[("PATH", Just pathEnv) | not (null extraPath)]
7+
hp = hostPlatform lbi
8+
maybeHostFlag = if hp == buildPlatform then [] else ["--host=" ++ show (pretty hp)]
9+
- args' = configureFile':args ++ ["CC=" ++ ccProgShort] ++ maybeHostFlag
10+
+ args' = configureFile':maybeHostFlag ++ args ++ ["CC=" ++ ccProgShort]
11+
shProg = simpleProgram "sh"
12+
progDb = modifyProgramSearchPath
13+
(\p -> map ProgramSearchPathDir extraPath ++ p) emptyProgramDb

0 commit comments

Comments
 (0)