Commit Graph

264 Commits

Author SHA1 Message Date
Pepe Iborra
d68033afae haskellPackages.mkDerivation: add doHaddockInterfaces option
This adds a new builder option `doHaddockInterfaces` to enable the -haddock flag in GHC,
which results in Haddock comments parsed at compile-time and embedded in
interface files. These are used by the :doc command in GHCi, as well as IDE
tools like ghcide and hls to display docs on hover.

The `-haddock` flag has been around since at least 8.2, even though it does not
get a mention in the GHC Users guide.

There are two downsides to turning on this flag:

1. Increased compile times, since Haddocks must be parsed and then encoded
2. Haddock parse errors now become compile errors for GHC < 9.0.1
   (https://gitlab.haskell.org/ghc/ghc/-/issues/8944)

Thus we only enable the feature if we have GHC 9.0.1 and haddock is
enabled; when 9.0.1 becomes the default GHC, we may need to reevaluate
the performance concern.

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2021-11-10 21:10:35 +01:00
maralorn
1e61298bf5
Merge pull request #129093 from siraben/haskell-mainProgram
haskell-generic-build: allow mainProgram to be set
2021-07-03 13:45:40 +02:00
Ben Siraphob
06fb9a9421 haskell-generic-build: allow mainProgram to be set 2021-07-03 15:52:39 +07:00
sternenseemann
6955f4e4e6 haskell-generic-builder: support badPlatforms
meta.badPlatforms allows us to exclude specific platforms from the list
of supported platforms without the need to explicitly substract it from
lib.platforms.all (or our inferior equivalent allKnownPlatforms) in
platforms. Thus it'll map nicely to unsupported-platforms in the
hackage2nix configuration in the future.
2021-06-27 18:32:28 +02:00
sternenseemann
5e0c55b581 haskell-generic-builder: pass pname and version as is
This is a full set rebuild, however it improves the name generation
for the static and cross case since the respective additional
components are now inserted between pname and version instead of after
name like before. This prevents builtins.parseDrvName from mistaking a
platform config string for a version component.
2021-06-21 14:08:41 +02:00
sternenseemann
57ec1813ff haskell-generic-builder: allow passing flags to the test suite(s)
Every flag the generic builder receives via `testFlags` is passed via
`--test-option` [1] to `Setup.hs` which in turn passes them to the
underlying test suite binary. These wrapped options are added to
`checkFlagsArray` in `checkPhase`. This needs to be done in bash since
without structuredAttrs in nixpkgs so far, Nix arrays aren't properly
translated into bash arrays, so we'd have all sorts of quoting issues
when spaces are involved.

Re-using `checkFlags` and `checkFlagsArray` from standard stdenv
setup.sh also results in an additional feature: Using `overrideAttrs`
`checkFlags` and `checkFlagsArray` can additionally be overridden,
which allows passing extra flags to `Setup.hs` whithout being wrapped
with `--test-option`.

[1]: See also https://cabal.readthedocs.io/en/3.4/setup-commands.html?highlight=test-option#cmdoption-runhaskell-Setup.hs-test-test-option
     According to the cabal-install man page this also allows passing
     special variables which are substituted for other values
     depending on context.
2021-06-09 15:09:00 +02:00
sternenseemann
670d6ac458 haskell-generic-builder: fix buildTarget specification if isLibrary
If we don't pass buildTarget to ./Setup copy and buildTarget is not
empty it will try installing targets that don't exist and thus fail.
2021-06-06 18:40:13 +02:00
rnhmjoj
830ef6422f
haskell-generic-builder: disable static PIE 2021-05-22 01:54:51 +09:00
Isaac Shapira
d725ac7942
Add haskell.lib.setBuiltTarget, and support non library compiling of a single target 2021-05-02 13:35:07 +09:00
(cdep)illabout
c8ac41fafc haskellPackages: add changelog argument to Haskell generic-builder.nix
changelog was recently added as a new meta field in
https://github.com/NixOS/nixpkgs/pull/60371.

This commit adds similar support to the Haskell generic builder.
2021-04-09 21:32:00 +02:00
Ben Siraphob
2f78ee7e81 pkgs/development: stdenv.lib -> lib 2021-01-24 00:16:29 +07:00
Jonathan Ringer
9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00
John Ericson
a52f9a18bf haskell: Inline static overlay
We don't force `enableStaticLibraries` for Windows or WASM because it
will just fail an assertion.
2021-01-11 03:17:29 +00:00
Joe Hermaszewski
55a9078748 haskell-generic-builder: Add missing preHaddock and postHaddock arguments 2020-10-23 21:00:26 +02:00
Jan Tojnar
58377555ed
Merge branch 'staging-next' into staging 2020-08-23 02:18:27 +02:00
Tyson Whitehead
612f3324c9
haskell-generic-builder: Use args ? attr for passthru (closes #94246)
Comparing to a default value to detect if an argument was provided
forces it to at least WHNF, which can cause failure (e.g., if the
argument is a string with a quoted path from a broken package).
2020-08-15 10:54:11 -04:00
Divam
fee55e2bb1 Disable static lib for Haskell wasm libs 2020-08-05 20:18:17 +09:00
Domen Kožar
1f6f0c9b3a
ghc: don't build with profiling on aarch64 #66277
This makes ghc output be lower than 2GB limit.

Also enable aarch64 build parallelism now that it's fixed in GHC 8.6
2020-07-21 20:23:07 +02:00
Robert Hensing
4353027d0b haskell/generic-builder.nix: Fix C lib multiple inclusions
Allow the darwin links code to overwrite libs that were already
copied, because C dependencies can occur multiple times.

Solves errors like

    ln: failed to create symbolic link '/nix/store/higpc9xavwcjjzdipz7m9ly03bh7iy2z-hercules-ci-agent-source-0.7.0/lib/links/libboost_context.dylib': File exists
2020-05-15 21:02:08 +02:00
Peter Simons
ccb81f56cf haskell: tune generic-builder for more parallel build performance
Raise the maximum number of cores used for parallel building from 4 to 16.
Increase the size of the allocation area for GHC's garbage collector from 1 MiB
to 64 MiB.

See https://www.twitch.tv/videos/611899011 for the motivation for this change.
2020-05-08 21:11:47 +02:00
Simon Chatterjee
019e86fde9
haskell generic-builder: fix Darwin regression for lmdb
Recent updates to the generic builder have caused haskellPackages.lmdb-simple to
fail to build on Darwin, since it cannot see the lmdb C dynamic library included
by its dependent haskellPackages.lmdb.

The C dynamic library has suffix `.so` not `.dylib`, so this fix allows for
that.

Closes #80190, but that issue may identify a preferable solution.
2020-02-17 09:41:31 +01:00
Silvan Mosberger
8d4509e34d haskell generic-builder: Fix package conf handling
Previously the package conf files were handled without paying attention
to the fact that it's pretty-printed output. One problem was discovered
with GHC 8.8.1 on Darwin, where the dynamic-library-dirs first field
seems to have increased in length, meaning while before it was

    dynamic-library-dirs: some-small-directory-name
                          some-more-directories

Now it is

    dynamic-library-dirs:
        some-larger-directory-name
        some-more-directories

Which breaks the code installed for https://github.com/NixOS/nixpkgs/pull/25537,
because that assumed the former format, resulting in the reoccurence of
the bug in https://github.com/NixOS/nixpkgs/issues/22810, see
https://github.com/Infinisil/all-hies/issues/43

This commit fixes this by "unprettyfying" the package conf files before
processing them.

Closes https://github.com/NixOS/nixpkgs/pull/78738.
2020-01-31 21:05:56 +01:00
Matthew Bauer
07db0b248c Merge remote-tracking branch 'obsidiansystems/work-on-multi-shellFor' 2020-01-17 18:00:27 -05:00
Jacquin Mininger
7d67db3919 shellFor: Refactor for consistency and cross
This makes it work like work-on-multi from Reflex Platform. In
particular, rather than making `.env` from `shellFor`, we make `.env`
the primitive, and `shellFor` works by combining together the arguments
of all the packages to `generic-builder` and taking the `.env` of the
resulting mashup-package.

There are 2 benefits of this:

1. The dependency logic is deduplicated. generic builder just concatted
   lists, whereas all the envs until now would sieve apart haskell and
   system build inputs. Now, they both decide haskell vs system the same
   way: according to the argument list and without reflection.
   Consistency is good, especially because it mean that if the build
   works, the shell is more likely to work.

2. Cross is handled better. For native builds, because the
   `ghcWithPackages` calls would shadow, we through both the regular
   component (lib, exe, test, bench) haskell deps and Setup.hs haskell
   deps in the same `ghcWithPackages` call. But for cross builds we use
   `buildPackages.ghcWithPackages` to get the setup deps. This ensures
   everything works correctly.
2020-01-17 10:46:29 -05:00
Merlin Göttlinger
900a378245 haskell: add quickjump option to the haskell mkDerivation
When visiting local documentation via hoogle, currently for most packages the
quickjump index is missing so you only get a sad error when pressing "s" to
search in the current documentation.

The quickjump option is only supported by the haddock utility that's shipped
with ghc 8.6.x or later.

Closes https://github.com/NixOS/nixpkgs/pull/75942.
2020-01-10 20:56:20 +01:00
John Ericson
9cbbe2b00f Merge branch 'ghcjs-cross-without-cc-common' into ghcjs-cross-without-cc 2019-12-25 14:36:13 -05:00
John Ericson
d8dd301412 haskell generic-builder: Hack so CPP without a CC works 2019-12-25 14:34:40 -05:00
John Ericson
49daa0aa64 Merge branch 'ghcjs-cross-without-cc-common' into ghcjs-cross-without-cc 2019-12-25 13:17:00 -05:00
John Ericson
6a23c9ddbe haskell generic-builder: Fix --with-ghc flag for GHCJS as cross
Otherwise it passes `--with-ghc=ghc`, and we do the wrong thing.
2019-12-25 13:14:48 -05:00
John Ericson
6bc456c91c Merge remote-tracking branch 'upstream/master' into ghcjs-cross-without-cc 2019-11-25 00:23:07 +00:00
John Ericson
ea9a2c5ec2 haskell genenric-builder: Make the C compiler optional
This is GHCJS, and perhaps other obscure targets.
2019-11-25 00:12:39 +00:00
Yorick van Pelt
a1b68b688b ghcjs: disable profiling by default 2019-11-01 21:28:26 +01:00
volth
f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Frederik Rietdijk
bae32a9f5c Merge staging-next into staging 2019-04-16 18:54:15 +02:00
(cdep)illabout
757099e8f1 haskell-generic-builder: disable library-for-ghci by default
This commit disables the library-for-ghci flag passed to
`Setup configure` in the Haskell generic-builder.nix file.

This stops the HSfoo.o file from being built.  Building this
HSfoo.o file caused doctest to take an extremely long time
to load dependencies when running.

This is a follow-up from https://github.com/NixOS/nixpkgs/pull/58743.
2019-04-12 11:55:22 +02:00
Matthew Bauer
eaa5e85b35 haskell: add more hackage mirrors, use mirrors in more places
Fixes #58971
2019-04-05 13:51:56 -04:00
(cdep)illabout
a5b85222ff Add option to disable library-for-ghci in the generic haskell builder.
Closes https://github.com/NixOS/nixpkgs/pull/58743.
2019-04-02 11:46:48 +02:00
Domen Kožar
bd06834d5e
haskell: allow separate bin output, disable by default 2019-03-29 15:10:42 +07:00
Michael Peyton Jones
387c513d12 generic Haskell builder: don't copy packages from GHC
In order to build the package databases that we will use when compiling
a Haskell package, we iterate over the relevant dependencies, and if
they contain a package db, we copy its contents over.

So far so good, except when one of those dependencies is GHC. This
doesn't happen ordinarily, but it will happen when we construct the
package database for compiling `Setup.hs`.  This is compiled for the
build architecture, so we get the build deps, including both the native
and the cross GHC (if there is one).

In this case, we end up copying the packages from the GHC's package
database. This is at best unnecessary, since we will get those packages
from the GHC when we compile with it.

At worst, however, this is semantically questionable. We can end up
having multiple copies of e.g. Cabal with the same version, but
(potentially) different contents. At the moment, GHC will expose one of
these at semi-random depending on which one it looks at "first".
However, there is a MR open [in
GHC](https://gitlab.haskell.org/ghc/ghc/merge_requests/545) which as a
side effect will instead expose both, leading to ambiguous module
warnings (which is not unreasonable, since it *is* ambiguous).

So what can we do about it? The simplest solution is just to not copy
the package databases from GHC. GHC is special in this regard, so I
think it's okay to treat it specially.

This PR should have no effect on anything now, but will prevent any
breakage when/if the GHC patch lands.

Closes https://github.com/NixOS/nixpkgs/pull/57706.
2019-03-17 09:21:20 +01:00
Nathan van Doorn
a86ffa4988 haskell-modules/generic-builder.nix: add haddockFlags option 2019-02-22 10:32:15 +01:00
Kosyrev Serge
e505891a5c haskell/generic-buidler: make installPhase handle Cabal 2.5's lax fields 2019-02-02 13:13:18 +01:00
Kosyrev Serge
2e5c9ba727 haskell generic-builder.nix: adapt to package config files having more spaces 2019-01-27 10:26:07 +01:00
Will Fancher
55fe0276b8 Limit parallel building of Haskell packages. [Fixes #53665] 2019-01-21 08:57:54 +01:00
Shea Levy
30fb5b0dcf
haskell generic builder: Add flag to allow inconsistent dependencies. 2018-12-15 13:31:08 -05:00
Falco Peijnenburg
0ff9a7a2cd haskellPackages.*.env: Fixed shellHook being ignored
The problem was introduced in 2bafa93b75
2018-11-04 17:03:35 +01:00
Will Fancher
0ee01e6c2e haskellPackages.shellFor: Add nativeBuildInputs [Fixes #48435] 2018-10-18 18:32:53 -04:00
Drew Hess
4babe7f799
haskell: re-enable aarch64, but disable parallel builds on that arch.
This is a workaround for unreliable parallel Haskell builds on
aarch64. See https://ghc.haskell.org/trac/ghc/ticket/15449
2018-10-05 01:28:42 -04:00
Silvan Mosberger
5067773e39 haskellPackages.*.env: Use shellFor 2018-10-03 18:00:29 +02:00
Silvan Mosberger
7c5c3fceff haskell.lib.getBuildInputs: Use generic builder passthru to implement 2018-10-03 18:00:29 +02:00
John Ericson
f4be0b45dd
Merge pull request #46872 from obsidiansystems/cross-haskell-ar-flag
haskell infra: Also pass `--with-ar` in cross builds
2018-09-18 19:14:13 -04:00