Commit Graph

232 Commits

Author SHA1 Message Date
Domen Kožar
f031f3105a
GHC 8.0.2: use -split-sections
-split-sections replaced -split-objs with following upsides:

1) -split-objs adds considerable overhead to compile time

2) combined with stripping, it causes issues when cross-compiling

For upstream see https://ghc.haskell.org/trac/ghc/ticket/8405

This is supported only for Linux/Windows using ld linker.

GHC master also turns on -split-sections by default.

Example using stack:

Without splitting

  $ du /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2
  4       /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share/bash-completion/completions
  4       /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share/bash-completion
  4       /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share
  23416   /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/bin
  23420   /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2

With -split-objs

  $ du /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2
  20632   /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/bin
  4 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share/bash-completion/completions
  4 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share/bash-completion
  4       /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share
  20636   /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2

With -split-sections

  $ du /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2
  4       /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share/bash-completion/completions
  4       /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share/bash-completion
  4       /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share
  20672   /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/bin
  20676   /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2

Note: you currently need following overrides to build stack on 802:

   vector-algorithms = dontCheck super.vector-algorithms;
   path-io = doJailbreak super.path-io;
   stack = doJailbreak super.stack;

Note: Should also work on GHC 8.0.1, but I'm being careful here.
      We could backport later on.
2017-02-07 14:21:54 +01:00
Shea Levy
2154108270 haskell-modules/generic-builder: Fix copy-paste error 2017-01-23 11:35:59 -05:00
Shea Levy
0ff6b6fc0f (haskellPackages.callPackage foo).env: Set the right env vars when cross-compiling 2017-01-22 17:05:19 -05:00
Shea Levy
60918113af haskellPackages.mkDerivation: Use native hsc2hs when cross-compiling 2017-01-11 13:26:08 -05:00
Domen Kožar
663048f378 Revert "haskell: workaround for bug with dynamic libraries on darwin"
This reverts commit 19e2e7290a.

See the correct fix in aa64994b48a29ea8d12323942f1743fa4133527a

General purpose solution will be once we implement
https://github.com/NixOS/nixpkgs/issues/21624
2017-01-03 23:10:24 +01:00
Peter Simons
711c235777 haskell: clean-up for the generic builder
Clean up the implementation from d0250ad884.
2017-01-03 10:52:50 +01:00
Daiderd Jordan
19e2e7290a haskell: workaround for bug with dynamic libraries on darwin 2016-12-24 16:15:35 +01:00
Domen Kožar
d0250ad884 Haskell generic builder: enable parallel builds for GHC 8.0.2
This reverts https://github.com/NixOS/nixpkgs/pull/4554
2016-12-16 22:25:40 +01:00
Joe Hermaszewski
757638acae ghcWithPackages: fix env NIX_GHC_LIBDIR value
Ideally the duplication between the environment shellHook and the ghc
wrapper would be removed.

Fixes #20730
2016-11-26 12:06:56 +00:00
Vladimír Čunát
2aea31b52e
Merge branch 'staging' 2016-11-19 21:55:26 +01:00
Shea Levy
64ec4dd87b Add haskell packages set for cross ghc 2016-11-18 10:44:53 -05:00
Shea Levy
3995655d2c Revert "Merge pull request #17145 from kalhauge/haskell_darwin_dyld"
This fix doesn't actually fix the cabal bug (see #16357), but it does
cause other bugs (see #20476)

Fixes #20476

This reverts commit b89fa5fd5c, reversing
changes made to e4b146b041.
2016-11-17 07:25:42 -05:00
Peter Simons
b59b89d9e3 Revert "Extend Haskell generic builder to use new --ipid flag."
This reverts commit ec8b816154. The change told
the Cabal build system to use the hash-part of $out as the internal identifier
for the library it's building (rather than generating such an ID itself). While
a good idea in theory, this choice had an unfortunate side-effect: When Cabal
links libraries X, Y, and Z into an executable, then the generated binary
contains their respective IDs. Now, Nix finds those strings and treats them as
an indication that there is a *run-time dependency* on the corresponding store
paths. This means that the generated executable will always depend on the store
paths of all the Haskell libraries that went into it, even when linked
statically.
2016-10-08 10:45:48 +02:00
Peter Simons
ec8b816154 Extend Haskell generic builder to use new --ipid flag. 2016-10-05 09:46:53 +02:00
Peter Simons
97fd905823 haskell: add support for 'hardeningDisable' to the generic builder
We also have a new helper function 'disableHardening' to use in
overrides. Fixes https://github.com/NixOS/nixpkgs/issues/14820.
2016-09-15 09:12:03 +02:00
Christian Gram Kalhauge
1a08805358 Make the implementation clean 2016-07-21 14:56:45 +02:00
Christian Gram Kalhauge
9bca29d4ef Change if to optionalString 2016-07-21 14:23:56 +02:00
Christian Gram Kalhauge
de5a2ee034 Reduce computation time for non-darwin users 2016-07-21 11:39:52 +02:00
Christian Gram Kalhauge
475c8bfb7d Fix DLYD problem with haskell libraries on Darwin
This commit fixes a problem that occurs with externally linked haskell
libraries on Darwin. It does this by adding the libraries to the
--extra-lib-dirs flag and the DYLD_LIBRARY_PATH environment variable.
2016-07-20 14:21:53 +02:00
Michael Alan Dorman
b40e1efe00 haskell generic-builder: don't propagate setupHaskellDepends
Without this patch, attempts to install at least some of the packages
that start to use setupHaskellDepends (mostly gtk-related packages)
results in collisions:

    building path(s) ‘/nix/store/63k5smns43f5r2ad8wcc242x0gwd70m3-ghc-8.0.1’
    collision between `/nix/store/k18i1nm5hgnb82y9w2g9hmlwhk3szjld-ghc-8.0.1/lib/ghc-8.0.1/Cabal-1.24.0.0/Distribution/Compat/Binary.dyn_hi' and `/nix/store/0rwhbwsg9kmywgbrib2bs29p2hmi80za-Cabal-1.24.0.0/lib/ghc-8.0.1/Cabal-1.24.0.0/Distribution/Compat/Binary.dyn_hi'
    builder for ‘/nix/store/vrjkfpm8sb96m9i5k74h8vn0rwddgy4v-ghc-8.0.1.drv’ failed with exit code 25

This would appear to me to be a consequence of setupHaskellDepends
entries being added to propagateBuildInputs.  It is sufficient in the
cases I'm familiar with (taffyBar), and I think correct, to simply add
it to the otherBuildInputs.
2016-06-13 09:51:35 +02:00
Peter Simons
8ffcd238c3 haskell-generic-builder: add support for setupHaskellDepends 2016-06-12 08:37:01 +02:00
Jude Taylor
4686bc54a6 add socket.io to interactive ghcjs environments 2016-03-01 16:06:29 -08:00
John Ericson
f13eede7e5 haskell: Tiny refactor in generic-builder. No hashes/interfaces changed. 2016-02-21 10:16:13 -08:00
John Ericson
51b66ed4d9 haskell: Add notion of cross compiler and define nativeGhc with it
Tested to not change hashes
2016-02-21 10:16:13 -08:00
Charles Strahan
97d9071b95 ghcjs: use native ghc to build Setup.hs 2016-02-18 03:15:59 -05:00
Charles Strahan
bbce88302a ghcjs: fix building with cabal-install-1.22.8.0 2016-02-18 03:15:59 -05:00
Charles Strahan
95d892ec26 ghcjs: update and fix ghcjs/reflex libs
Set dontStrip when building ghcjs libs, which fixes the ghcjs-dom lib
and also makes the logs cleaner.
2016-01-24 17:13:45 -05:00
Charles Strahan
4fd985b9ae haskell-packages: properly set postPatch
The existing code overrode the postPatch, instead of combining the
jailbreak commands with the user supplied postPatch.
2016-01-24 13:32:56 -05:00
Peter Simons
9815d92d91 haskell-generic-builder: GHC 8.0.x wants --disable-profiling instead of --disable-executable-profiling 2016-01-17 12:29:03 +01:00
Peter Simons
a3540d9bb7 haskell-generic-builder: drop "haskell-" prefix from interactive environment's names 2015-09-10 19:51:47 +02:00
Allen Nelson
d2457ea991 add shellHook argument so that users can pass in their own 2015-09-09 12:58:28 -05:00
Peter Simons
dc5bf39bfe haskell-generic-builder: improve meta.platforms vs. meta.hydraPlatforms logic
hydraPlatforms now defaults to the value of meta.platforms rather than
defaulting to ghc.meta.hydraPlatforms. This solution is, in fact, still
sub-optimal. See https://github.com/NixOS/nixpkgs/issues/9608 for further
details.
2015-09-02 16:51:35 +02:00
Peter Simons
4a8797d827 haskell-generic-builder: stop pre-pending "haskell-" to package names
A derivation of the Hackage package "foo" is called "haskell-foo" if it is a
library, but only "foo" if it is an executable (without a library). This
distinction used to be fine when Haskell packages where visible to operations
like "nix-env -qa" or "nix-env -i", but after our switch to Haskell NG it has
no more purpose. Consequently, this patch removes the name prefix from all
Haskell packages -- every Haskell package is now called exactly like it's
called on Hackage.

Closes https://github.com/NixOS/nixpkgs/pull/9538.
2015-08-31 16:50:12 +02:00
William A. Kennington III
64cd711f5c Merge branch 'master.upstream' into staging.upstream 2015-08-21 15:17:26 -07:00
Benno Fünfstück
c51f0dbd52 haskell: disable haddock on GHC <7.8 on darwin
Fixes NixOS/nixpkgs#812
2015-08-20 21:51:19 +02:00
William A. Kennington III
a106080623 Merge branch 'master.upstream' into staging.upstream 2015-08-14 13:22:00 -07:00
Peter Simons
167e54b257 haskell-generic-builder: allow users to specify their own install phase 2015-08-14 21:23:42 +02:00
William A. Kennington III
4624985561 Merge branch 'master.upstream' into staging.upstream 2015-08-07 13:40:39 -07:00
Peter Simons
7064e4fb46 haskell-generic-builder: add support for build-tools in the test suite stanza 2015-08-07 15:13:14 +02:00
Peter Simons
6229ec91da Add 'enableExecutableProfiling' argument to the generic Haskell builder.
Closes https://github.com/NixOS/nixpkgs/issues/2734.
2015-08-06 16:13:10 +02:00
Peter Simons
ab77228749 haskell-generic-builder: improve recognition of pkgconfig dependencies 2015-08-05 21:36:20 +02:00
Peter Simons
6cd9a820ad haskell: extend generic builder to support upcoming format change from cabal2nix 2015-07-19 10:31:13 +02:00
Peter Simons
7e04b7319c haskell: disable parallel compilation for libraries to mitigate the effects of GHC's non-deterministic library ID bug
Further details can be found at <https://github.com/peti/ghc-library-id-bug>
and <https://ghc.haskell.org/trac/ghc/ticket/4012>.
2015-06-05 23:55:01 +02:00
Ryan Trinkle
82bd3a5580 Do not use install_name_tool on "executables" built by GHCJS
These executables are really .jsexe directories, and install_name_tool will fail
2015-05-31 03:18:13 -04:00
Charles Strahan
31dde16881 ghcjs: set NIX_GHCJS_* variables in env. 2015-05-08 11:53:28 -04:00
Charles Strahan
929dc4199a ghcjs: properly wrap binaries in environment
This also:

 1  Builds Setup.hs with ghcjs, which (among other things) defines
    __GHCJS__ and ghcjs_HOST_OS during pre-processing.
 2  Fixes ghc-paths to point at ghcjs and use NIX_GHCJS_* env-vars.
 3  Boots ghcjs into $prefix/lib/$compiler.
2015-05-08 11:33:44 -04:00
Nikolay Amiantov
196e34279d haskellng.generic-builder: move jailbreak-cabal to postPatch
Closes https://github.com/NixOS/nixpkgs/pull/7208.
2015-04-18 20:43:22 +02:00
Cray Elliott
880e0950d8 Revert "add patchFlags to haskell-ng's generic-builder"
Oops! Didn't realize that the stripLen option can be passed to fetchpatch.
Seems a cleaner than my method

This reverts commit eb7362a36c.
2015-04-05 01:06:20 -07:00
Cray Elliott
eb7362a36c add patchFlags to haskell-ng's generic-builder
I use this to get yesod-bin working with ghc 7.10.1
2015-04-05 00:48:12 -07:00
Peter Simons
945269a48f haskell-generic-builder: gratuitous cosmetic change to trigger a complete re-build
hydra.nixos.org serves broken binaries because of our favorite non-deterministic
package IDs in GHC bug. :-( Re-building everything from scratch seems like the
easiest way to recover.
2015-04-01 22:54:45 +02:00
Peter Simons
7eda2f9ebb haskell-generic-builder: allow use of 'env' attributes in nix-shell
We disabled this to prevent users from accidentally running nix-build on
an 'env' attribute, but in fact the ability to use those in combination
with "nix-shell -p" is quite useful, so the restriction is lifted.
2015-04-01 22:54:45 +02:00
Peter Simons
59a1969f88 haskell-generic-builder: enable parallel building of libraries with GHC version >= 7.10.1
We'll blame @Fuuzetsu if this change produces broken binaries left and right.
2015-04-01 22:54:45 +02:00
Peter Simons
943bc26762 haskell-generic-builder: when replacing an edited Cabal file, show the download URL rather than the store path 2015-04-01 22:54:45 +02:00
Charles Strahan
d590a0f4b6 ghcjs: support for Haskell-NG
closes #5828
closes #6786
2015-03-29 03:34:04 +02:00
Eelco Dolstra
5c0eb64d43 Set more precise meta.position for Haskell packages 2015-03-27 16:17:48 +01:00
Peter Simons
013b12a54c haskell-ng: expose Hackage's revision number in hackage-packages.nix and use it to generate stable download URLs for edited Cabal files
Fixes https://github.com/NixOS/nixpkgs/issues/6914.
2015-03-25 14:37:15 +01:00
Peter Simons
c776477350 haskell-generic-builder: update and jailbreak cabal files before patchPhase is run
The updated and jailbroken Cabal file must be in place before the
'patchPhase' hook is run, otherwise we cannot use that hook to patch the
Cabal file! Resolves https://github.com/NixOS/nixpkgs/issues/5922.

As an added bonus, this change makes the "jailbreakPhase" obsolete.
2015-03-09 15:55:25 +01:00
Peter Simons
3e9e1a2f4e haskell-generic-builder: set LOCALE_ARCHIVE only on Linux 2015-03-09 15:55:25 +01:00
Peter Simons
0a97e2153e haskell-generic-builder.nix: don't add lib64 directories to the search path
Packages that provide 32 and 64-bit libraries in the same store path are rare
and usually require manual overrides anyway. It seems pointless to try and
guess proper settings for them. The effect is that we'll end up with bogus
settings that take more effort to correct that it takes to configure proper
settings in the first place. Point in case: haskell-cuda and it's configuration
for "cudatools".

Fixes https://github.com/NixOS/nixpkgs/issues/6564.
2015-03-09 15:55:25 +01:00
Peter Simons
c4ff9d10ba haskell-generic-builder: consistently use $TMPDIR to refer to the designated place for temporary files
Resolves https://github.com/NixOS/nixpkgs/issues/6525.
2015-03-09 15:55:24 +01:00
Joel Taylor
8bfa1a2efc Patches for a lot of packages for GHC 7.10 2015-02-22 17:33:10 -08:00
Peter Simons
5d5b51dfc0 haskell-generic-builder: add a passthru attribute 'isHaskellLibrary' to every derivation
The presence of this attribute allows us to recognize Haskell derivations.
Furthermore, we can use it to distinguish libraries from executables (which is
useful for the code that's generating the wrapper).
2015-02-22 22:13:10 +01:00
Peter Simons
9db348d7f9 ghc-7.10.x: compile Setup.hs with -threaded to avoid hanging test suites
Closes https://github.com/NixOS/nixpkgs/issues/6259.
2015-02-13 22:24:32 +01:00
Peter Simons
69cda1a7c0 haskell-generic-builder: set locale to "UTF-8" in nix-shell environments
The package builder did this already, but I forgot to add the setting in
the interactive environment.

Fixes https://github.com/NixOS/nixpkgs/issues/5904.
2015-01-23 08:19:46 +01:00
Peter Simons
9ab8a12b06 haskell-generic-builder: re-enable the checkPhase that was accidentally broken in the earlier re-factoring 2015-01-20 16:17:14 +01:00
Peter Simons
8959aade32 haskell-generic-builder: allow setting preUnpack and postUnpack hooks
This is useful for Hydra builds that have more than one package in the
same repository and need to change to the proper directory.
2015-01-19 23:15:29 +01:00
Peter Simons
380114738f haskell-ng: rename "noHaddock" attribute to "doHaddock"
This makes the attribute (a) consistent with "doCheck" and friends and (b)
avoids the double negation "noHaddock = false" meaning "doHaddock = true".

Fixes https://github.com/NixOS/cabal2nix/issues/63.
2015-01-18 12:58:31 +01:00
Peter Simons
54bbfd5440 haskell-generic-builder: re-factor for improved modularity 2015-01-17 20:29:00 +01:00
Peter Simons
e6ecb1fb83 haskell-ng: enable package sets for GHC 6.12.3, 7.0.4, 7.2.2, and 7.4.2 2015-01-17 20:29:00 +01:00
Eric Seidel
ed1ca3928d don't use cpphs by default on darwin 2015-01-15 13:40:04 -08:00
Peter Simons
df76eb1268 ghc: revert "propagate 'gmp' and 'ncurses' to ensure users can link the 'haskeline' library, etc."
I thought that [1] could be fixed by ensuring that ncurses is available in the
environment (because ghc exports it as a propagateBuildInput), and indeed that
change fixed *some* build failures we've had before. However, the same error
still occurs with other packages, like hledger [2] and Agda [3]. Frankly, I
have no idea why those packages fail and others don't. But clearly the fix was
inadequate, so I'm reverting commit a8076c76.

[1] https://github.com/NixOS/nixpkgs/issues/5616
[2] http://hydra.cryp.to/build/372451/nixlog/1/raw
[2] http://hydra.cryp.to/build/373161/nixlog/1/raw
2015-01-14 22:24:33 +01:00
Peter Simons
a8076c7654 ghc: propagate 'gmp' and 'ncurses' to ensure users can link the 'haskeline' library, etc.
Fixes https://github.com/NixOS/nixpkgs/issues/5616.
2015-01-14 11:24:59 +01:00
Peter Simons
007628fd49 haskell-generic-builder: use cpphs pre-processor by default on Darwin
Allegedly, the cpp implementation of Clang is weird and causes errors.
2015-01-13 22:33:17 +01:00
Peter Simons
67312f83ad haskell-generic-builder: pass "--with-gcc=$CC" on Darwin to help Cabal find Clang
Suggested in https://github.com/NixOS/nixpkgs/pull/5746.
2015-01-13 22:33:01 +01:00
Shea Levy
67460ea19f haskellng: Fix amazonka-core on 7.8
Required adding a flag to the generic builder to build Setup.hs with
core packages even if there is an override in buildInputs, to break
circular dependencies.
2015-01-12 15:41:03 -05:00
Peter Simons
bca9b8d867 haskell-generic-builder: make $shellHook in 'env' attribute more robust
In case our GHC environment is empty, the old code ended up running
'grep export' on a GHC binary, which doesn't seem like a good idea.
2015-01-11 11:59:47 +01:00
Peter Simons
dbb4012fdc haskell-generic-builder: add a helpful message that explains why it makes no sense to build an 'env' attribute 2015-01-11 11:39:16 +01:00
Peter Simons
b31082d246 haskell-generic-builder: propagate build inputs only if we're building a library 2015-01-10 23:54:30 +01:00
Peter Simons
89b5d9ee14 haskell-generic-builder: add an 'env' attribute to every Haskell expression that can be used with nix-shell to create an interactive build environment for this package
For example:

  nix-shell --pure ~/.nix-defexpr -A haskell-ng.packages.ghc784.hsdns.env
2015-01-10 15:55:47 +01:00
Peter Simons
afca6145d4 haskell-generic-builder: simplify "package.conf.d" management
The builder creates a temporary package.conf.d database in $TMP that
contains everything required to build the current package (i.e. the
transitive closure of the package's propagated build inputs). These
files are no longer installed, however, we just install the package.conf
file for the package we're actually building. This means that
package.conf.d directory in $out won't have collisions anymore, which
simplifies the with-packages-wrapper.nix a bit.
2015-01-10 15:55:47 +01:00
Peter Simons
2f2f767813 haskell-generic-builder: allow selective enabling/disabling of the --hoogle flag to Haddock 2015-01-09 19:55:25 +01:00
Peter Simons
54baa53df1 Say hello to our brand-new Haskell infrastructure. 2015-01-07 23:45:21 +01:00