summary refs log tree commit diff
diff options
context:
space:
mode:
authorCharles Strahan <charles.c.strahan@gmail.com>2016-02-18 18:15:14 -0500
committerCharles Strahan <charles.c.strahan@gmail.com>2016-02-18 18:32:58 -0500
commit516057ffa9746ac1bf58d5a868957c18c5b5a252 (patch)
treeb3728f75dd0bc09dbed9081926382a56f5d7255d
parente6e9970891781768d85a1c3005c2486b591723c7 (diff)
downloadnixpkgs-516057ffa9746ac1bf58d5a868957c18c5b5a252.tar
nixpkgs-516057ffa9746ac1bf58d5a868957c18c5b5a252.tar.gz
nixpkgs-516057ffa9746ac1bf58d5a868957c18c5b5a252.tar.bz2
nixpkgs-516057ffa9746ac1bf58d5a868957c18c5b5a252.tar.lz
nixpkgs-516057ffa9746ac1bf58d5a868957c18c5b5a252.tar.xz
nixpkgs-516057ffa9746ac1bf58d5a868957c18c5b5a252.tar.zst
nixpkgs-516057ffa9746ac1bf58d5a868957c18c5b5a252.zip
ghcjs: replace integer-simple with integer-gmp
GHCJS uses integer-gmp, but cabal2nix generates a dependency list that
includes integer-simple instead. This tweaks the stage2 generator to
replace any instance of integer-simple with integer-gmp.

Things currently still work without this change (assuming
integer-simple is defined as null), as ghcjs includes integer-gmp in
its stage1 packages - so it's always available.

However, this change makes things a bit more explicit, rather than
leaving things to chance. If at any point the stage1 packages are also
split up into separate derivations, the integer-gmp package will need to
be passed along to the packages that depend on it. This change should
prevent some confusion going forward.
-rw-r--r--pkgs/development/haskell-modules/configuration-ghcjs.nix6
-rw-r--r--pkgs/development/haskell-modules/ghcjs/gen-stage2.rb22
-rw-r--r--pkgs/development/haskell-modules/ghcjs/stage2.nix6
3 files changed, 24 insertions, 10 deletions
diff --git a/pkgs/development/haskell-modules/configuration-ghcjs.nix b/pkgs/development/haskell-modules/configuration-ghcjs.nix
index 53da845210e..ac7a30d4cfb 100644
--- a/pkgs/development/haskell-modules/configuration-ghcjs.nix
+++ b/pkgs/development/haskell-modules/configuration-ghcjs.nix
@@ -49,7 +49,11 @@ self: super:
   time = null;
   transformers = null;
   unix = null;
-  integer-simple = null;
+
+  # Don't set integer-simple to null!
+  # GHCJS uses integer-gmp, so any package expression that depends on
+  # integer-simple is wrong.
+  #integer-simple = null;
 
   # These packages are core libraries in GHC 7.10.x, but not here.
   bin-package-db = null;
diff --git a/pkgs/development/haskell-modules/ghcjs/gen-stage2.rb b/pkgs/development/haskell-modules/ghcjs/gen-stage2.rb
index 260e2ee2f12..c801dbe3e4b 100644
--- a/pkgs/development/haskell-modules/ghcjs/gen-stage2.rb
+++ b/pkgs/development/haskell-modules/ghcjs/gen-stage2.rb
@@ -28,16 +28,26 @@ stage2_packages = [
 nixpkgs = File.expand_path("../../../../..", __FILE__)
 boot = `nix-build #{nixpkgs} -A haskell.packages.ghcjs.ghc.ghcjsBoot`.chomp
 
+out = "".dup
+out << "{ ghcjsBoot, callPackage }:\n"
+out << "\n"
+out << "{\n"
+
 stage2_packages.each do |package|
   name = Pathname.new(package).basename
   nix = `cabal2nix file://#{boot}/#{package}  --jailbreak`
   nix.sub!(/src =.*?$/, "src = \"${ghcjsBoot}/#{package}\";")
   nix.sub!("libraryHaskellDepends", "doCheck = false;\n  libraryHaskellDepends")
-  nix = nix.split("\n").join("\n    ")
-
-  out = "".dup
-  out << "#{name} = callPackage\n"
-  out << "  (#{nix}) {};"
+  # cabal2nix somehow generates the deps for 'text' as if it had selected flag
+  # 'integer-simple' (despite not passing the flag within the generated
+  # expression). We want integer-gmp instead.
+  nix.gsub!(/integer-simple/, "integer-gmp")
+  nix = nix.split("\n").join("\n      ")
 
-  puts out
+  out << "  #{name} = callPackage\n"
+  out << "    (#{nix}) {};\n"
 end
+
+out << "}"
+
+puts out
diff --git a/pkgs/development/haskell-modules/ghcjs/stage2.nix b/pkgs/development/haskell-modules/ghcjs/stage2.nix
index f840869568c..f84ddbdefa4 100644
--- a/pkgs/development/haskell-modules/ghcjs/stage2.nix
+++ b/pkgs/development/haskell-modules/ghcjs/stage2.nix
@@ -225,7 +225,7 @@
       }) {};
   text = callPackage
     ({ mkDerivation, array, base, binary, bytestring, deepseq, directory
-      , ghc-prim, HUnit, integer-simple, QuickCheck, quickcheck-unicode
+      , ghc-prim, HUnit, integer-gmp, QuickCheck, quickcheck-unicode
       , random, stdenv, test-framework, test-framework-hunit
       , test-framework-quickcheck2
       }:
@@ -235,11 +235,11 @@
         src = "${ghcjsBoot}/boot/text";
         doCheck = false;
         libraryHaskellDepends = [
-          array base binary bytestring deepseq ghc-prim integer-simple
+          array base binary bytestring deepseq ghc-prim integer-gmp
         ];
         testHaskellDepends = [
           array base binary bytestring deepseq directory ghc-prim HUnit
-          integer-simple QuickCheck quickcheck-unicode random test-framework
+          integer-gmp QuickCheck quickcheck-unicode random test-framework
           test-framework-hunit test-framework-quickcheck2
         ];
         jailbreak = true;