summary refs log tree commit diff
path: root/pkgs/development/compilers/ghc/8.0.2.nix
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2017-01-25 00:00:54 +0100
committerPeter Simons <simons@cryp.to>2017-02-02 10:57:00 +0100
commitdfcc9e2994eba3544ddfe303be5128ff17195ca6 (patch)
tree532775a8656a8e03b71bc360ee9c94b5f49072ea /pkgs/development/compilers/ghc/8.0.2.nix
parent8a0d1bcf8bcc5b09a857769bfb3f1e45e9f73249 (diff)
downloadnixpkgs-dfcc9e2994eba3544ddfe303be5128ff17195ca6.tar
nixpkgs-dfcc9e2994eba3544ddfe303be5128ff17195ca6.tar.gz
nixpkgs-dfcc9e2994eba3544ddfe303be5128ff17195ca6.tar.bz2
nixpkgs-dfcc9e2994eba3544ddfe303be5128ff17195ca6.tar.lz
nixpkgs-dfcc9e2994eba3544ddfe303be5128ff17195ca6.tar.xz
nixpkgs-dfcc9e2994eba3544ddfe303be5128ff17195ca6.tar.zst
nixpkgs-dfcc9e2994eba3544ddfe303be5128ff17195ca6.zip
ghc: support building with integer-simple and provide package sets for it
If the flag enableIntegerSimple is true GHC will be build with the GPL-free but
slower integer-simple library instead of the faster but GPLed integer-gmp
library.

The attribute `pkgs.haskell.compiler.integer-simple."${ghcVersion}"` provides a
GHC compiler build with `integer-simple`.

Similarly, the attribute `pkgs.haskell.packages.integer-simple."${ghcVersion}"`
provides a package set supporting `integer-simple`.

Closes https://github.com/NixOS/nixpkgs/pull/22121.
Closes https://github.com/NixOS/nixpkgs/issues/5493.
Diffstat (limited to 'pkgs/development/compilers/ghc/8.0.2.nix')
-rw-r--r--pkgs/development/compilers/ghc/8.0.2.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix
index ba8401b9b09..5f687aca63a 100644
--- a/pkgs/development/compilers/ghc/8.0.2.nix
+++ b/pkgs/development/compilers/ghc/8.0.2.nix
@@ -1,5 +1,9 @@
-{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, gmp, ncurses, libiconv, binutils, coreutils
+{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, binutils, coreutils
 , hscolour, patchutils, sphinx
+
+  # If enabled GHC will be build with the GPL-free but slower integer-simple
+  # library instead of the faster but GPLed integer-gmp library.
+, enableIntegerSimple ? false, gmp
 }:
 
 let
@@ -28,13 +32,16 @@ stdenv.mkDerivation rec {
     export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
   '' + stdenv.lib.optionalString stdenv.isDarwin ''
     export NIX_LDFLAGS+=" -no_dtrace_dof"
+  '' + stdenv.lib.optionalString enableIntegerSimple ''
+    echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
   '';
 
   configureFlags = [
     "--with-gcc=${stdenv.cc}/bin/cc"
-    "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
     "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
     "--datadir=$doc/share/doc/ghc"
+  ] ++ stdenv.lib.optional (! enableIntegerSimple) [
+    "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
   ] ++ stdenv.lib.optional stdenv.isDarwin [
     "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
   ];