diff options
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/ghcjs/gen-stage2.rb')
-rwxr-xr-x | nixpkgs/pkgs/development/compilers/ghcjs/gen-stage2.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/ghcjs/gen-stage2.rb b/nixpkgs/pkgs/development/compilers/ghcjs/gen-stage2.rb new file mode 100755 index 000000000000..709e635db55c --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/ghcjs/gen-stage2.rb @@ -0,0 +1,54 @@ +#!/usr/bin/env ruby + +require 'pathname' + +# from boot.yaml in ghcjs/ghcjs +stage2_packages = [ + "boot/async", + "boot/aeson", + "boot/attoparsec", + "boot/case-insensitive", + "boot/dlist", + "boot/extensible-exceptions", + "boot/hashable", + "boot/mtl", + "boot/old-time", + "boot/parallel", + "boot/scientific", + "boot/stm", + "boot/syb", + "boot/text", + "boot/unordered-containers", + "boot/vector", + "ghcjs/ghcjs-base", + # not listed under stage2, but needed when "quick booting". + "boot/cabal/Cabal" +] + +nixpkgs = File.expand_path("../../../../..", __FILE__) +boot = ARGV[0] || `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!(" doCheck = false;\n", "") + nix.sub!("libraryHaskellDepends", "doCheck = false;\n libraryHaskellDepends") + # 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 << " #{name} = callPackage\n" + out << " (#{nix}) {};\n" +end + +out << "}" + +puts out |