Commit Graph

38 Commits

Author SHA1 Message Date
sternenseemann
c610be58c0 haskell.compiler.*: use build->target LLVM in build
This is no substantial change, as we already assert that the
build->target and host->target LLVM are the same, but this brings the
terminology in the file in a more consistent order, since we use
build->target for CC/CXX and bintools already.

In fact we should be passing build->target to configure always,
host->target would come into play when updating GHC's settings file
after installing.
2021-12-01 18:37:24 +01:00
sterni
c85d141221
Merge pull request #148079 from sternenseemann/ghc-set-clang-only-if-use-llvm
haskell.compiler.*: only set CLANG to match llc/opt
2021-12-01 17:34:38 +01:00
sternenseemann
0f5a723dd1 Merge remote-tracking branch 'origin/master' into haskell-updates 2021-12-01 17:31:16 +01:00
sternenseemann
6daa4a5c04 haskell.compiler.*: use wrapped darwin bintools on aarch64
On aarch64-darwin we have additional wrappers for install_name_tool and
strip to deal with codesigning requirements (e. g. updating the
signature / checksum after changing a binary). These wrappers don't
exist on x86_64-darwin which is why the unwrapped versions were used
before, causing the kernel to kill (some) executables produced by GHC.
2021-12-01 17:29:12 +01:00
sternenseemann
c23e14e33f haskell.compiler.*: assert that host->target == build->target tools
CC, CXX, LD, AR, …, LLC, OPT and CLANG will be invoked by GHC's build
system at build time in the build->target role. However, since we are
passing absolute paths, they will get saved in GHC's settings file and
later invoked at runtime, when they should be host->target. This means
that the build->target and host->target tools need to be the same for
our built GHC to work properly which is what we guard using these new
asserts.

Being able to drop these asserts would be a step towards cross-compiling
GHC (as opposed to building a GHC cross-compiler which still works).
2021-11-30 23:06:44 +01:00
sternenseemann
19fc229294 haskell.compiler.*: use targetCC for hasGold check
This is a bit shorter and more consistent with the rest of the file.
2021-11-30 23:00:11 +01:00
sternenseemann
c876c7498e haskell.compiler.*: only set CLANG to match llc/opt
* By taking clang from llvmPackages we make sure there is no version
  mismatch between LLVM (where llc and opt come from) and clang (which
  previously would be taken from stdenv on darwin for example).

* Only pass CLANG if useLLVM is true. Previously we also set this if
  targetCC was clang. This would cause potentially confusing behavior if
  llc and opt as well as clang are provided via PATH (and GHC is
  compiled with useLLVM == false), because clang from PATH would be
  ignored, but not llc and opt.
2021-11-30 22:55:19 +01:00
sternenseemann
8f1a52ac33 haskell.compiler.*: disable useLLVM also for SPARC and PowerPC
These targets also have NCG support, but they are tested less (in fact
SPARC seems to be untested atm) and may have issues. In such cases being
able to fallback to -fllvm without rebuilding the compiler could be
useful. OTOH GHC will default to -fasm and the backends probably work
well enough in most cases.
2021-11-28 17:14:18 +01:00
sternenseemann
17b8b5a4dc haskell.compiler.*: pass runtime dependencies via configure script
GHC can actually accept absolute paths for its runtime tools (except for
touch) at configure time which are then saved in
`$out/lib/ghc-${version}/settings`. This allows us to drop the wrapper
entirely if we assume that a POSIX compliant touch is in PATH when we
run GHC later.

The touch problem can presumably be fixed by either patching the
configure file of GHC (although we need to take care not to change the
touch GHC uses during its compilation) or messing with the settings file
after installation.

The rationale for dropping the wrapper PATH entry completely is that
it's always possible to invoke GHC via its library which will bypass the
wrapper completely, leading to subtly different behavior.

Binary GHCs are not touched in this commit, but ideally they'll get a
similar treatment as well, so they are more robust, although we
generally don't need to use them as a library.

Note that GHC 8.8.4 doesn't care about install_name_tool or otool, so
the respective environment variables are not set.
2021-11-27 14:39:22 +01:00
sternenseemann
a7c564596e haskell.compiler.*: use isScript over grepping for #! 2021-11-25 16:48:56 +01:00
sternenseemann
f5c3b6523c haskell.compiler.*: move propagatedBuildInputs into runtimeDeps
This has two main benefits:

* GHC will work reliably outside of stdenv, even when using -fllvm since
  everything it'll call at runtime will be provided in PATH via the
  wrapper scripts.

* LLVM will no longer leak into haskell packages' configure
  scripts. This was an issue with llvm-hs which fails to build if the
  LLVM version of the compiler since the propagatedBuildInputs of GHC
  take precedence over the nativeBuildInputs added in the derivation.
2021-11-25 16:47:51 +01:00
sternenseemann
035f20bc6b haskell.compiler.*: prefix PATH with runtimeDeps
This will prevent freak accidents where the wrong tools are used because
they are in PATH by chance.
2021-11-25 16:42:47 +01:00
sternenseemann
156d8d619c haskell.compiler.*: be clear about LLVM build->target role
Since LLVM itself doesn't depend on target at all, this doesn't change
anything *in effect* (i. e. rebuild count should be zero), but it is
more clear about the intention and what LLVM is used for here (i. e. in
depsBuildTarget).
2021-11-24 13:48:37 +01:00
Pavol Rusnak
3b9e94dc6c
haskell.compiler.ghc901: fix aarch64-darwin build
by applying autoSignDarwinBinariesHook
2021-11-09 12:23:43 +01:00
Niklas Hambüchen
c57ad7ccb9 haskell.compiler.ghc*: Use 8.10.7 bindist for bootstrapping.
This fixes musl+integer-simple, see #130441.

Co-Authored-By: sternenseemann <sternenseemann@systemli.org>
2021-09-23 20:38:36 +02:00
Niklas Hambüchen
998e40ce38 haskell.compiler.ghc*: Add variantSuffix.
When debugging musl builds, I often have to sift through thousands of lines
of `nix-store -q --tree` or `nix-store -qR` output.
Until now, `pkgsMusl` and normal `pkgs` GHCs looked exactly the same in
there, making that task tough.

Same for `integer-simple`, which makes debugging `gmp` issues easier.

This commit introduces a suffix to tell them apart easily.

Note that this is different from `targetPrefix` which is for
cross-compilation, which `pkgsMusl` does not do.

For GHC HEAD, integer-simple no longer exists, instead we now have a
“bignum backend”, so we just call the integer-simple successor
native-bignum.

Co-Authored-By: sternenseemann <sternenseemann@systemli.org>
2021-09-23 16:41:49 +02:00
sternenseemann
3bdb476804 haskell.compiler.ghc*: use pname instead of name
This also means the -binary suffix is moved *before* the version which
prevents builtins.parseDrvName from interpreting it as part of the version.
2021-09-23 16:41:49 +02:00
Vladimír Čunát
dbc3228248
Merge branch 'master' into staging-next
(It's a little older version of master, to bring haskell updates now.)
2021-09-07 08:21:02 +02:00
Alyssa Ross
071a7a4583
Merge remote-tracking branch 'nixpkgs/master' into staging-next 2021-09-03 18:23:45 +00:00
sternenseemann
791f39c668 haskell.compiler.*: clean up maintainer sets
Let's remove peti (retired) as well Marc, Andres and Will who haven't
been active lately. Feel free to re-add yourself, but this should at
least lessen the GitHub notifications for now.

Add lib.teams.haskell to every maintainer list additionally. I've also
added Domen and Pavol to GHC 8.10.7 binary since they are the only ones
working on aarch64-darwin so far. Let me know if that is alright with
you.
2021-09-01 16:49:18 +02:00
sternenseemann
b4f66903e3 haskell.compiler.*: make big-parallel
Compiling GHC on Hydra takes 3h or more (with -j2) whereas even on an
outdated CPU GHC can be compiled in under an hour with -j4. To get a
higher NIX_BUILD_CORES value at build time, we'll have to mark GHC
big-parallel.
2021-08-24 00:57:19 +02:00
Guillaume Bouchard
5c1d3b7944 ghc: add guibou as maintainers for all ghc compilers 2021-08-23 12:40:11 +02:00
sternenseemann
0908812372 haskell.compiler.*: check bintools.hasGold before enabling ld.gold 2021-08-18 01:21:44 +02:00
(cdep)illabout
be8d8a9efb
ghc: mark integer-simple builds as broken when hostplatform is musl 2021-07-24 21:13:02 +09:00
Niklas Hambüchen
f4e62a996f pkgsMusl.haskell.compiler.ghc{8104,884,901,HEAD}: Disable sphinx for musl
Adds new package options:

* enableDocs
* enableHaddockProgram

to control whether to build Sphinx docs, and GHC haddocks and the
haddock program.

Unfortunately currently the building of the `haddock `program
and generating GHC docs are mixed into one option, see:
https://gitlab.haskell.org/ghc/ghc/-/issues/20077

Making Sphinx docs disableable, and disabling them by default
for Musl and cross builds, makes it much easier to provide these
builds without having to support Sphinx's enormous dependency
tree for those ways of building.
2021-07-10 02:49:42 +02:00
Niklas Hambüchen
8adcd39504 ghc: Add comments about hardeningDisable pie for musl 2021-07-10 02:49:42 +02:00
Niklas Hambüchen
8d11c1380a pkgsMusl.haskell.compiler.ghc901: Fix evaluation with musl
`glibcLocales` only exists when glibc is used.

Similar to commit:

    8727284a - haskell: only use glibcLocales when using glibc
2021-07-04 22:15:59 +00:00
John Ericson
4f97d78936
Merge pull request #126205 from sternenseemann/ghc-linker-checks
ghc: check for targetPlatform.linker to determine if gold is available
2021-06-08 16:42:13 -04:00
sternenseemann
036eef1d1e haskell.compiler.*: use gold based on targetPlatform.linker
useLdGold previously just checked for useLLVM which (currently) implies
`linker == "lld"`. However more accurate is to check the `linker` of the
`targetPlatform` as it actually tells us which bintools package we can
expect.

`linker == "bfd"` implies that we are using the `binutils` package, so
gold is available, so we can use it unless musl is the libc. `linker ==
"gold"` implies that gold is the default linker already and we should
absolutely use it.
2021-06-08 22:17:24 +02:00
sternenseemann
118b28a127 haskell.compiler.*: pull in unwrapped bintools for darwin
GHC calls otool on darwin which is contained in the
stdenv.cc.bintools.bintools derivation and thus needs adding to the
runtime PATH of GHC. Since this is toolchain specific technically, we
check for cctools instead of darwin (although I don't know if GHC
or nixpkgs work on macOS without cctools).

This fixes usage of GHC in an environment where otool is not available
and more specifically in stdenvNoCC which is used by writers.writeHaskell.
Resolves #123228.
2021-06-08 14:20:09 +02:00
oxalica
354d262db8
lib.meta: introduce availableOn 2021-04-02 19:20:23 +08:00
Peter Simons
0b626654ad ghc: update the 9.0.1 version to the official release tarball 2021-02-05 23:05:20 +01:00
Ben Siraphob
acc5f7b18a pkgs/development/compilers: stdenv.lib -> lib 2021-01-23 08:57:37 +07:00
Peter Simons
8a21e02e31 ghc-9.0.1: set utf-8 locale during the build so that Haddock succeeds 2021-01-02 19:58:19 +01:00
Peter Simons
bf5e99fc7a ghc-9.0.1: avoid use of tabs in the expression 2021-01-02 19:58:19 +01:00
Peter Simons
61a785ccd9 ghc: update 9.0.1 compiler from alpha-1 to rc-1 2021-01-02 19:58:19 +01:00
Robert Hensing
6057cb9786 ghc*: Increase build timeout to 1 day
The default of 10 hours is insufficient for some of the slower
platforms like macOS and aarch64.
2020-11-06 11:07:48 +01:00
Peter Simons
518338f7f7 ghc: add alpha-1 release of version 9.0.1 2020-09-29 12:06:53 +02:00