Commit Graph

62 Commits

Author SHA1 Message Date
Hamish Mackenzie
f3ea06dcac
Work around for packages in lts that do not install. (#1437)
For ghc 9.0.2 Haskell.nix will use the `stm`and `filepath` source that came with `ghc` when the version desired matches.  This is because 9.0.2 shipped with packages that differ from the same version in hackage.

`reinstallableLibGhc` is fixed for GHC 8.10 and above.  Rather than including a patch file this works by:

* Setting the `subDir` to the `compiler` directory when building.  That way relative paths to other parts of the `ghc` source tree (outside the `compiler` directory) still work.
* Files that are needed, but generated when `ghc` builds are added from the `generated` output of the ghc derivation.

`nonReinstallablePkgs` is now sorted and deduplicated before it is used (this reduces the chance of rebuilds when the list is refactored).
2022-04-20 15:25:21 +12:00
Cheng Shao
18ebf60137
Fix libnuma dependency in rts.conf (#1342) 2022-02-15 23:49:45 +13:00
Moritz Angermann
eb7e669d63
Enable aarch64 builds (#1316)
* Adds small address space logic

* no numa on android

* Update comp-builder.nix

* Adds android.nix

* host And target.

* Make android remote-iserv static

* Add back mmap_next

* Create rts-android-jemalloc-qemu.patch

* Update bootstrap.nix

* Some android modifications to ghc

* Some modifications to the android overlay.

* disable more hardening flags on android

* Adds stack-protector-symbols.patch

* Adds libraries-prim-os-android.patch

* Adds support for CONDBR relocations

* Adds undef+weak symbol support.

* calloc takes 3 not 2 args :-(

* Adds getauxval

* Needs enable static now

* Fix android cross
2022-01-09 11:36:53 +13:00
Moritz Angermann
001df758bf
fix ghcjs (#1311) 2022-01-09 03:11:37 +13:00
Hamish Mackenzie
6101c6ea7b
Add GHC 9.0.2 (#1338)
Co-authored-by: Ollie Charles <ollie@ocharles.org.uk>
2022-01-09 03:10:05 +13:00
Cheng Shao
01db3823b4
Remove propagatedBuildInputs from ghc (#1318) 2022-01-05 13:09:50 +13:00
Cheng Shao
2e30cbafe3
Fix haddock links to base packages (#1315)
* Fix haddock links to base packages

* Enable quickjump haddock
2021-12-27 11:11:54 +08:00
Hamish Mackenzie
9dd933d6e8
Use ghcjs that includes a shim for __dirname (#1296) 2021-11-18 23:19:29 +13:00
Moritz Angermann
59ad2995cc
Update ghcjs810-src.json (#1291)
* Update ghcjs810-src.json

* Update ghcjs-project.nix

* Update ghcjs.nix

Use nodejs-12_x, to allow larger strings to be loaded. See https://github.com/nodejs/node/issues/33960

* Update comp-builder.nix

Allow large strings, see https://github.com/nodejs/node/issues/33960

* Update cabal-os-arch-comp.nix

* Update ghcjs-src

* Update ghcjs ref

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2021-11-17 02:17:02 +13:00
Hamish Mackenzie
24b421cbfc
Add ghc 9.2.1 and update internal cabal to 3.6.2 (#1286) 2021-11-13 12:43:04 +13:00
iko
9d454d3e6f
Bump GHCJS to 8.10.7 (#1246) 2021-10-10 14:34:40 +13:00
Hamish Mackenzie
8cb9c3789a
Bump ghcjs (#1225) 2021-09-03 16:02:21 +12:00
Hamish Mackenzie
1f4c2c9b08
Add GHC 8.10.7 (#1220) 2021-09-01 22:43:31 +12:00
Teo Camarasu
f624ca5662
Add GHC-8.10.6 (#1214)
Add GHC-8.10.6

Co-authored-by: Peter Becich <peter@simspace.com>
Co-authored-by: Teo Camarasu <teofilcamarasu@gmail.com>
Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2021-08-31 04:19:40 +12:00
Hamish Mackenzie
6aabb57e19
Updated ghcjs 8.10 (#1153) 2021-06-30 12:58:28 +12:00
Hamish Mackenzie
a5b74bf002
niv update nixpkgs-unstable and add ghc 8.10.5 (#1121) 2021-06-15 19:50:45 +12:00
Moritz Angermann
dd31db0a0a
Add enough logic to make plugins work conceptually. (#1131) 2021-06-07 12:07:56 +12:00
Hamish Mackenzie
21c52eda1d
Fix ghcjs-base shims used in ghcjs 8.10.4 (#1125) 2021-05-27 13:02:09 +12:00
Hamish Mackenzie
96ac3b731a
Fix configured-src for ghcjs (#1122)
It should point to the `ghc` sub directory not the `ghcjs` one.
2021-05-22 22:27:34 +12:00
Hamish Mackenzie
0eefbdc676
Update ghcjs 8.6 with pipe close fix (#1110) 2021-05-08 14:24:32 +12:00
Hamish Mackenzie
542670ef55
Update ghcjs 8.10 with pipe close fix (#1106) 2021-05-07 19:52:39 +12:00
Hamish Mackenzie
9ce7bf1e02
GHCJS 8.10 (#1082) 2021-03-29 22:36:47 +13:00
Hamish Mackenzie
a59be5c421
Add GHC 9.0.1 (#1032)
Also refactors the way tests are filtered to use `meta.disabled` where possible.
2021-03-28 21:03:20 +13:00
Hamish Mackenzie
4d700cf155
Fixing emcc usage in haskell.nix ghcjs (#1064)
* Use emscripten branch of GHCJS for 8.6

* Adds release-linux-only.nix (for hydra with no mac builders)

* Sets HOME to a temp dir once per derivation to help performance of emcc

* Updates materialization

* Uses symlinks to reduce ghc derivation size for wrapped ghcjs

* Removes compiler-nix-name test
    This test checked that the default compiler was overridden by the
    compiler-nix-name arg.  There is no default any more.

The GHCJS branches used include fixes for:

* hs$ret_1 typo (should be hs$ret1)

* A bignum issue
2021-03-12 12:21:07 +13:00
Hamish Mackenzie
5c25ce919f
Add getComponent to project and package (#1060)
* Delays cabal configure errors until after evaluation when possible.

* Avoids rerunning long `cabal configure` if we already know it will fail.

* Provides a way to get a component from a package or project using a `cabal` like reference.

Code using the `tool` functions will automatically use `getComponent`.

For `(hackage-package {...}).components.library` is also ok.

```
# Consider changing hackage-package use:
(pkgs.haskell-nix.hackage-package {...}).components.exes.something
(pkgs.haskell-nix.hackage-package {...}).getComponent "exe:something"

# For any cabal project:
project.hsPkgs.somepackage.components.exes.something
project.getComponent "somepackage:exe:something"
# or do it in two steps
(project.getPackage "somepackage").getComponent "exe:something"
```

The reason for the new function is that we cannot provide the attribute interface without knowing that packages are in the project first.

Here is how the `cabal configure` error output is handled:

* The `plan-nix` derivation builds even if `cabal configure` fails.

* When it fails, it copies `failed-cabal-configure.nix` to the `$out/default.nix` along with a copy of the `cabal configure` output.

* When `failed-cabal-configure.nix` is imported and used in any way it writes the `cabal configure` output with `__trace` so it will always be visible.

* Instead of a `plan` the imported nix contains a `configurationError` pointing the `cabal configure` output.

* The intermediate functions `configurationError` and bubble it up to where it is needed.

* `getPackage` returns a mostly empty proxy for a real package when there is a `configurationError`

* The `getComponent` function always returns a derivation, but the version in the proxy writes the `cabal configure` output to stdout and calls `exit 1` (so that it will never build).
2021-03-04 20:10:58 +13:00
Hamish Mackenzie
bab2eaea62
Enable debug info on linux targets (#1050)
* Add `.debug` to build any component with DWARF dugug info on linux
  (ghc >=8.10.2).
* Pass `enableDWARF` to `shellFor` for to get a shell where all the
  components are the `.debug` ones.
2021-02-22 18:27:36 +13:00
Hamish Mackenzie
f056dd34cd
Fix the way ExeDependency is handled (#1036)
See https://github.com/input-output-hk/nix-tools/pull/101

We should look up hsPkgs.${pkg-name}.components.exe.${component-name}
instead of including the package as a dependency.

Adding `hsPkgs.${pkg-name}` a tool it is not clear which executable in the package `haskell.nix` should choose.

Haskell.nix did not deal with this well and in fact it could lead to `nix-shell` crashing.  For instance using `shellFor` to make a shell for building `haskell-language-server` with `cabal build` crashed as a dependency on `ghcide` the executable (by the `ghcide-bench` executable) caused infinite recursion.  Allowing `ghcide-bench` to correctly depend just on `components.exes.ghcide` fixes this.

This PR also includes:

* Updated materialized files built with the new nix-tools and latest index-state
* Small update to GHCJS (pins happy) to fix issue that showed up when the materialization was updated
* A fix for the infinite recursion issue when updating materialized files (by adding ghc-boot-packages-unchecked).
* Performance fix for shellFor (checks just the names of component derivations when filtering).
2021-02-12 10:45:23 +13:00
Hamish Mackenzie
89f50a96dd
Use pkgs.lib instead of stdenv.lib (#1031)
Fixes:

Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `pkgs.lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938
2021-02-11 01:07:16 +13:00
Silvan Mosberger
feea345b32
Throw better error when conf files are missing (#1030)
* Throw better error when conf files are missing

Previously, if some directories were missing .conf files, an error like
this would be thrown:

  cp: missing destination file operand after '/nix/store/pnmrz06g0sa4s3yx53hgmr9k8jrh6ww0-ouroboros-network-framework-lib-ouroboros-network-framework-0.1.0.0-haddock-config/lib/ghc-8.6.5/package.conf.d'

While normally this shouldn't occur, I've seen it happen in CI anyways,
with the problem disappearing if the store path that's missing the files
was rebuilt a couple times.

With this commit, it becomes much easier to figure out which store path
is missing the files, which would be very hard to figure out from the
previous message.
2021-02-08 03:13:31 +13:00
Hamish Mackenzie
b611105898
Update version number of ghc8102-experimental (#927)
Sets the version number to `8.10.2.20201118` and compiler nix name to `ghc810220201118`
2020-12-07 17:19:39 +13:00
Hamish Mackenzie
7078b145e9
Add support for ghcjs 8.8 and making ghcjs bundles (#828)
Fixes ghcjs 8.6.5 and 8.8.4.

Uses emscripten for ghcjs 8.8 and adds scripts for building ghcjs 8.8.

Many fixes for ghcjs test failures.

Includes relocatableConfigFiles for making relocatable ghcjs bundles.
2020-11-17 22:22:53 +13:00
Moritz Angermann
23539aef9e
Add enableDWARF and useLLVM (#909)
(cherry picked from commit dc44dbcfe5)
2020-11-05 18:43:38 +13:00
Moritz Angermann
8fc807758c
Source dist logic (#905)
(cherry picked from commit bb39ebbadf)
2020-10-31 20:05:34 +13:00
Moritz Angermann
429702eabf
Allow source spec to be a file (#904) 2020-10-31 20:04:09 +13:00
Hamish Mackenzie
ec96755bee
Add initial unboxed tuple patch for ghc 8.10 (#825)
* Add initial unboxed tuple patch for ghc 8.8

* ifdLevel 0

* ifdLevel 1

* ifdLevel 2

* Update unboxed tuple patch (ifdLevel 0)

* ifdLevel 1

* ifdLevel 2

* ifdLevel 1

* ifdLevel 2

* ifdLevel 1

* Make sure ghc and ghc-pkg run

* ifdLevel 2

* Remove show instances from unboxed tuple patch

* ifdLevel 1

* ifdLevel 2

* ifdLevel 3

* Add GHC 8.10 version of the unboxed tuple patch

* Fix patch

* ifdLevel 2

* ifdLevel 3

* Update unboxed tuple patch

* Delete old ghc 8.8 version of patch

* ifdLevel 1

* ifdLevel 2

* ifdLevel 3
2020-10-14 12:21:30 +13:00
John A. Lotoski
09526c8555
Spelling, typo and whitespace fixes (#833)
* Spelling and typo fixes in doc and code comments
* Trailing whitespace or whitespace only truncation
* readTheDocs formatting corrections
2020-08-31 11:08:25 +12:00
Le Tuan
4cb38b1cdf
fix: remove numa support for armv6l (#808)
There is no support for NUMA on Armv6l (such as in the Raspberry Pi).
Having a dependency on numactl at the compiler-level seems to also
enable numa support for the generated programs as well. Even if it's not
used, dependency on libnuma prevents the generated executables to launch
without an error indicating that libnuma could not be found.
2020-08-10 18:14:38 +12:00
Moritz Angermann
a500f39da7
Musl changes (#700)
This should simplify the interaction with musl quite a but.
Musl specific mapping should go into the musl overlay now.
2020-06-23 09:45:22 +08:00
Moritz Angermann
dc7acfeb76
Split configured-src out of ghc/default.nix (#701)
* Split configured-src out of ghc/default.nix
2020-06-22 12:53:11 +08:00
Moritz Angermann
dfeabf991f
Set strictDeps = true (#706)
This will prevent LD_FLAGS from leaking in. And potentially breaking cross compilation from macOS -> linux, when LD_FLAGS contains -framework items.
2020-06-19 20:50:51 +08:00
Hamish Mackenzie
e1589cc74b
Capture files generated by ghc for ghcjs/ghc-boot (#698) 2020-06-19 14:13:29 +12:00
Hamish Mackenzie
edc948e0e8
Update nixpkgs 20.03 (matches with iohk-nix) (#671)
* Use hydra-migration in check-hydra.nix

* mkdocs fix is now in nixpkgs 20.03 (so this drops our work around)

* Adds sanity checks for #660

* Add missing ${targetPrefix} to NIX_LDFLAGS

* Use eval system for callStackToNix.

* Improves pins.
2020-06-14 22:54:03 +12:00
Hamish Mackenzie
5abaf477ea
Add enableLibraryProfiling for ghc (#677) 2020-06-12 14:38:04 +12:00
Travis Whitaker
ed673956e8
Native aarch64 support (#620)
* native aarch64 support

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
2020-06-04 20:29:50 +08:00
Moritz Angermann
1e4a554ebe
Drop -fast-llvm
`-fast-llvm` bypasses the mangler. We *could* do this if we had `-fast-llvm` *and* `-fno-plt`; however `-fno-plt` is only supported in the `clang` frontend, and essentially emits `nonlazybind` function attributes. LLVM does not guarantee that all architecture lowering backends respect that attribute and as such this would only work on `x86_64`, and on `aarch64` if passed `-aarch64-enable-nonlazybind`. Arm32 backends don't seem to support this attribute at all.

Fixes #621
2020-05-21 12:42:35 +08:00
Le Tuan
49ecc0e4db
fix: consider relocatable data as writable (#570)
When declared as constant, read-only relocatable data are written to an unwriteable .rel.ro.data section. Being unwriteable, the gold linker doesn't put them inside the GNU_RELRO segment, but in a always read-only segment. Starting the relocation phase of such a built program then ends in a segmentation fault.

By declaring read-only relocatable data as writeable, they will be put inside a writeable .rel.ro.data section. The gold linker will then assume that those can be put inside the GNU_RELRO segment, that will only be writeable during the relocation phase.

The as assembler and ld linker will always consider the .rel.ro.data as writeable before relocation, and put the associated data in the GNU_RELRO.

Co-authored-by: Michivi <webmaster@michvi.com>
2020-05-09 07:04:50 +08:00
Alexander Kudryashov
de3f82a419
Add native musl support (#578)
* Add native musl support

- adds haskellLibl.isNaviveMusl and related fixes (previously it was
assumed that for musl we always use cross-compilation)
- fixed some issues for musl intoduced in nixpkgs 20.03 (ssh/fetchcvs
infinite recursion, busybox pkgsMusl.pkgsStatic chain, etc.)
- cross-compilation fixes for ghc (absolute path for ar, always pass
target to configure, libffi and gmp packages for target platform) -
this needs more testing

* Better explanation for targetPlatform.{libffi, gmp}

* Ghc configure script now respect AR env variable


Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
2020-05-08 15:32:40 +08:00
Le Tuan
e08db6b66f
fix: don't use fast-llvm for aarch32 (#555)
* fix: don't use fast-llvm for aarch32

fast-llvm bypasses the GHC LLVM mangler and the GNU assembler. The latter is currently required when using the gold linker for valid relocation sections.

* feat: remove usage of the fast-llvm flag

The fast-llvm flag was intented to avoid potential incompatibilities between LLVM and the assembler/linker toolchain by making LLVM responsible for machine-code generation.

It bypasses necessary code transformation and prevents valid program generation in some cases (e.g. cross-compilation to armv6l). It is planned for removal from GHC.

References:
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3120

Co-authored-by: Michivi <webmaster@michvi.com>
2020-04-27 11:27:19 +08:00
Le Tuan
dc3d1a7bfc
fix: not use ld.gold on aarch32 (#548)
It seems that using ld.gold for cross-compilation to aarch32 results in Haskell programs segfaulting when launched.

Co-authored-by: Michivi <webmaster@michvi.com>
2020-04-17 23:54:06 +12:00
Le Tuan
1031e80d1a
fix: use target libffi instead of build libffi (#538)
Co-authored-by: Michivi <webmaster@michvi.com>
2020-04-13 10:39:26 +08:00