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.
This commit is contained in:
Charles Strahan 2016-02-18 18:15:14 -05:00
parent e6e9970891
commit 516057ffa9
3 changed files with 24 additions and 10 deletions

View File

@ -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;

View File

@ -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 ")
# 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 ")
out = "".dup
out << "#{name} = callPackage\n"
out << " (#{nix}) {};"
puts out
out << " #{name} = callPackage\n"
out << " (#{nix}) {};\n"
end
out << "}"
puts out

View File

@ -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;