Commit Graph

29 Commits

Author SHA1 Message Date
maralorn
a7baccff6f Merge branch 'master' into haskell-updates 2024-01-01 14:25:26 +01:00
maralorn
0bd0847ecd
Merge pull request #275616 from sternenseemann/ghc-cross-docs
haskell.compiler: also build manual for cross-compilers
2024-01-01 14:22:20 +01:00
sternenseemann
7998143a43 haskell.compiler: also build manual for cross-compilers
The reasoning given for disabling it is flawed: In most cases, sphinx
and its dependencies are already in the binary cache, since we only need
them as build tools—sphinx for the build platform is just the normal
pkgs.sphinx, since it doesn't care about targetPlatform.

We just need to disable it when the buildPlatform is also musl, so we
avoid pulling in sphinx in pkgsMusl.
2023-12-20 14:12:32 +01:00
sternenseemann
ce5cbc4465 haskell.packages.{ghc96,ghc98}: disable haddock for cross
In this situation, haddock would not be built by hadrian, as there is no
stage0:exe:haddock target by default. (We should eventually try adding
one.) If haddock is enabled and the build->host haddock missing, Cabal
tries using the build->build haddock which may fail to load the
documentation from the interface files produced by the build->host
GHC (e.g. due to a mismatch between dynamic and static linking).

Add regression tests to haskell-updates jobset.

Resolves #275304.
2023-12-20 11:09:45 +01:00
Marc Scholten
54fc9f6356 haskell.packages.ghc9{6,8}: work around aarch64-darwin output cycles
This ports our infamous patch for `Cabal` which cheesily prevents an
output cycle for derivations that use separate bin outputs where
references caused by the `Paths_*` module can't be eliminated by the GHC
aarch64-darwin codegen backend.

See also

- the original issue #140774,
- the original patch for GHC 9.2 #216857
- the ported patch for GHC 9.4
  f6f780f129

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2023-12-13 00:16:18 +01:00
Claudio Bley
2af613b58c haskell.compiler.ghc*: set abs paths for cctools bintools w/ hadrian
Fixes #267250.

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2023-11-21 18:19:27 +01:00
sternenseemann
2fd7fa6fbe haskell.compiler: link upstream issue for sphinx 7 patch 2023-11-17 12:52:04 +01:00
Alyssa Ross
afabc4a15d
Merge remote-tracking branch 'origin/master' into HEAD
Conflicts:
	pkgs/development/libraries/SDL2/default.nix
2023-11-10 15:18:19 +01:00
sternenseemann
2ec6f63534 haskell.compiler.ghcHEAD: 9.7.20230527 -> 9.9.20231014 2023-11-06 15:26:58 +01:00
Vladimír Čunát
176ccbcda8
ghc*: patch build of docs after sphinx update
The 8.x versions don't seem to need this (and the patch wouldn't apply).
2023-10-28 12:50:03 +02:00
Vaibhav Sagar
a63c085661 haskell.compiler.ghc98: init at 9.8.1
https://www.haskell.org/ghc/blog/20231009-ghc-9.8.1-released.html

- Use source-built GHC 9.4.7, pending packaging of bindist.
- The aarch64-linux space saving strategy via disabling hyperlinked
  source is disabled for now, pending either an updated patch or
  an user defined flavour using
  https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10850.

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2023-10-15 00:43:20 +02:00
sternenseemann
59ee081663 haskell.compiler.*: don't unnecessarily include LLVM for GHC >= 9.2
When 9.2.1 was [released], I apparently was confused by the wording. The
NCG (-fasm) codegen backend for aarch64 not only works on
aarch64-darwin, but also aarch64-linux. `useLLVM` being enabled on
aarch64-linux had no adverse effect, as GHC used -fasm anyways, but it
did inflate closure size unnecessarily which we can rectify now.

[released]: https://www.haskell.org/ghc/blog/20211029-ghc-9.2.1-released.html
2023-10-04 20:17:17 +02:00
github-actions[bot]
8ad2926229
Merge master into haskell-updates 2023-07-16 00:16:59 +00:00
Randy Eckenrode
6454fb1bc0
haskell.compiler.ghc962: fix build on Darwin after stdenv rework merge
The switch to cctools-llvm made several LLVM tools the default on
Darwin, which includes llvm-ar. GHC will try to use `-L` with `ar` when
it is `llvm-ar`, but that doesn’t work currently on Darwin.

See https://gitlab.haskell.org/ghc/ghc/-/issues/23188.
2023-07-14 10:51:29 -06:00
sternenseemann
1eddb04ac9 haskell.compiler.{ghc962,ghcHEAD}: no rendered src on aarch64-linux
This saves just enough space on aarch64-linux so that the hadrian built
GHCs are under the 3GB Hydra output limit:

| compiler | before     | after      | Δ          |
|----------|------------|------------|------------|
| ghc962   | 3241234736 | 2810740560 | -430494176 |
| ghcHEAD  | 3341288328 | 2902760872 | -438527456 |

The total output size can be calculated using (don't forget to use
aarch64-linux):

```
nix-build -A <compiler> | xargs nix path-info -s | awk '{ s += $2 }; END { print s }'
```
2023-07-10 23:14:54 +02:00
sternenseemann
8aeb0de93d haskell: re-enable profiling on aarch64
The main problem was GHC exceeding the Hydra output limit with profiling
libs on aarch64-linux which made us disable the feature. Nowadays the
limit is 3GB, the GHC output is a bit over 2GB, so easily under the
limit.

aarch64-darwin uses a different codegen backend and was never really
affected by the problem: Its output with profiling enabled is around
1.6GB.

Consequently we can enable profiling for all platforms again, as we have
no output size issues for those we build on Hydra.

Thanks to flokli for helping me track down these up to date numbers.
2023-07-04 15:29:40 +02:00
Rebecca Turner
17d63282b2 haskell.compiler: allow overriding source with hadrian
Hadrian (the GHC build tool) is built separately from GHC. This means
that if `haskell.compiler.ghc961` is overridden to add patches, those
patches will _only_ be applied to the GHC portion of the build, and not
the Hadrian build. For example, backporting this patch to GHC 9.6.1
failed because the changes to `hadrian/` files were not reflected in the
Nix build:

5ed77deb1b

By lifting `src` and `hadrian` from variables defined in the function
body to parameters with default values, the `hadrian/` files can be
overridden using the `haskell.compiler.ghc961.override` function. For
example:

   self.haskell.compiler.ghc961.override {
     # The GHC 9.6 builder in nixpkgs first builds hadrian with the
     # source tree provided here and then uses the built hadrian to
     # build the rest of GHC. We need to make sure our patches get
     # included in this `src`, then, rather than modifying the tree in
     # the `patchPhase` or `postPatch` of the outer builder.
     src = self.applyPatches {
       src = let
         version = "9.6.1";
       in
         self.fetchurl {
           url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
           sha256 = "fe5ac909cb8bb087e235de97fa63aff47a8ae650efaa37a2140f4780e21f34cb";
         };

       patches = [
         # Enable response files for linker if supported
         (self.fetchpatch {
           url = "5ed77deb1b.patch";
           hash = "sha256-dvenK+EPTZJYXnyfKPdkvLp+zeUmsY9YrWpcGCzYStM=";
         })
       ];
     };
   }

Note that we do have to re-declare the `src` we want, but I'm not sure
of a good way to avoid this while also sharing one set of patches
between the GHC and Hadrian builds.
2023-06-08 20:11:52 +02:00
fetsorn
560123c482 ghc: fix typos
"depedendency" -> "dependency"
2023-05-08 20:12:24 +04:00
sternenseemann
b2c570ec43 haskell.compiler: always include python when building with hadrian
We previously thought that we only need python if we were going to run
./boot or using emscripten which implements all its wrappers in
python (and likes to reinvoke them). As it turns out, though, hadrian
likes to invoke python itself for generating certain headers of rts
using a script shipped with the GHC source. This fact was obscured
before, since (presumably) sphinx would propagate python into PATH.
2023-03-13 01:58:09 +01:00
sternenseemann
f07d4d077e haskell.compiler.ghc961: init at 9.6.1
xhtml seems to be built unconditionally now which is at least one thing
improved by hadrian.
2023-03-12 13:16:26 +01:00
sternenseemann
97d55ec923 haskell.compiler.ghcHEAD: drop malformed/redundant hadrian setting
`*.*.rts.*.opts` is actually copied from the migration GHC blog post,
but does not, actually, parse: The format is
`<stage>.<package>.<program>.<filetype>.<setting>`, so it would need to
be `*.rts.ghc.opts`. This is already achieved by the broader rule on the
next line.
2023-03-08 17:12:18 +01:00
sternenseemann
23dc76fd22 haskell.compiler.ghcHEAD: fix hadrianFlagsArray handling 2023-03-08 17:12:18 +01:00
sternenseemann
faa92cd30b pkgsCross.ghcjs.haskellPackages.ghc: formally disable shared libs
Hadrian does this automatically unfortunately, but unless we correctly
set enableShared as well, mkDerivation will try building shared libs
which will inevitably fail due to missing shared core packages.

Let's stay away from fully_static which does a lot of funky stuff and
was not working before anyways for pkgsStatic.
2023-03-08 17:12:18 +01:00
sternenseemann
0aa01bef76 pkgsCross.ghcjs.haskellPackages.ghc: don't revert edited config.sub
GHC ships a [modified] config.sub so that js-unknown-ghcjs is accepted
by autotools. For some platforms, we automatically update config.sub
from upstream's source in order to prevent that builds fail when we use
an outdated config.sub. In this case of course the perfectly up to date
config.sub would reject the target platform we are trying to use, so we
must disable this mechanism for now.

I have asked in the GHC IRC channel if there are any plans on
upstreaming the platform. It would be nice if were able to drop this
change in the future.
2023-01-07 18:33:36 +01:00
sternenseemann
6392c21c1f haskell.compiler.ghcHEAD: allow building the JavaScript backend
This is now possible by building a cross compiler for js-unknown-ghjs
using `pkgsCross.ghcjs.buildPackages.haskell.compiler.ghcHEAD`.

To allow this, the following things needed to be done:

* Disable dependencies that wouldn't work:

  - Don't pull in ncurses for terminfo
  - Don't pull in libffi
  - Don't pull in libiconv
  - Don't enable the LLVM backend
  - Enable gmp-less native-bignum backend

* Use emscripten instead of a C compiler. The way this works is inspired
  by emscriptenPackages, but avoids the following flaws:

  - Instead of using a custom configurePhase, just set
    `configureScript = "emconfigure ./configure";` which is much simpler.

  - Create writable EM_CACHE before configuring, as configure scripts
    want to compile test programs.

  Additionally, we need to disable the targetCC check, as it is not
  applicable with emscripten which never appears as part of stdenv.

* Use generic $configureScript in installPhase to be able to work with
  our emconfigure trick.

Note that the corresponding Haskell package set does not work yet. Cabal
doesn't seem to like GHC 9.7 yet and the generic-builder is clueless
about the JS backend.
2023-01-04 00:02:29 +01:00
sternenseemann
de8e0bfaa7 haskell.compiler: also check targetPlatform for gmp compat
gmp is part of buildInputs _and_ depsTargetTarget, so we need to check
the host and target platform to be correct. In practice this doesn't
change much though, as gmp.meta.platforms is _quite_ liberal.
2023-01-04 00:01:25 +01:00
sternenseemann
3665c429d3 haskell.compiler.ghcHEAD: 9.5.20220921 -> 9.7.20221224
Finally building a cross compiler using hadrian is possible, but there
are some outstanding issues regarding external libraries in the package
db which causes issues with ghc-bignum.
2023-01-03 15:23:53 +01:00
sternenseemann
677ff51cfa haskell.compiler: ghc942 -> ghc943
https://www.haskell.org/ghc/download_ghc_9_4_3.html

Dropping GHC 9.4.2, since there is no Stackage snapshot which uses GHC 9.4.*,
so the stack Nix integration should not get any ideas.
2022-11-04 17:56:41 +01:00
sternenseemann
da60f2dc9c haskell.compiler.ghcHEAD: 9.3.20220406 -> 9.5.20220921
Initial port of our GHC Nix expressions to the new hadrian build system,
as it has become required after 9.4. Unfortunately there are some
regressions affecting us, namely the inability to install a GHC
cross-compiler at the moment (see issue linked in relevant error
message). This means that a lot of specific configuration snippets for
cross-platforms and static compilation have been ported from make
speculatively, as we are unable to test them for the moment.
2022-09-22 16:18:17 +02:00