summary refs log tree commit diff
path: root/pkgs/development/compilers/ghcjs
diff options
context:
space:
mode:
authorCharles Strahan <charles.c.strahan@gmail.com>2016-02-17 22:07:32 -0500
committerCharles Strahan <charles.c.strahan@gmail.com>2016-02-18 03:15:59 -0500
commitbbce88302a98338f014e7978e128f438dec3cc2d (patch)
tree62c11184718051543c5b7fe915e7611eef221b0e /pkgs/development/compilers/ghcjs
parentde5a233a71213101ccb3e06bad6a33d088f9e7f9 (diff)
downloadnixpkgs-bbce88302a98338f014e7978e128f438dec3cc2d.tar
nixpkgs-bbce88302a98338f014e7978e128f438dec3cc2d.tar.gz
nixpkgs-bbce88302a98338f014e7978e128f438dec3cc2d.tar.bz2
nixpkgs-bbce88302a98338f014e7978e128f438dec3cc2d.tar.lz
nixpkgs-bbce88302a98338f014e7978e128f438dec3cc2d.tar.xz
nixpkgs-bbce88302a98338f014e7978e128f438dec3cc2d.tar.zst
nixpkgs-bbce88302a98338f014e7978e128f438dec3cc2d.zip
ghcjs: fix building with cabal-install-1.22.8.0
Diffstat (limited to 'pkgs/development/compilers/ghcjs')
-rw-r--r--pkgs/development/compilers/ghcjs/default.nix9
-rw-r--r--pkgs/development/compilers/ghcjs/ghcjs-boot.nix42
2 files changed, 42 insertions, 9 deletions
diff --git a/pkgs/development/compilers/ghcjs/default.nix b/pkgs/development/compilers/ghcjs/default.nix
index 5ddfdc41917..81a8c90b53a 100644
--- a/pkgs/development/compilers/ghcjs/default.nix
+++ b/pkgs/development/compilers/ghcjs/default.nix
@@ -23,6 +23,7 @@
 , ghc, gmp
 , jailbreak-cabal
 
+, runCommand
 , nodejs, stdenv, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
 , time
 , zlib, aeson, attoparsec, bzlib, hashable
@@ -37,7 +38,7 @@
 , coreutils
 , libiconv
 
-, ghcjsBoot ? import ./ghcjs-boot.nix { inherit fetchgit; }
+, ghcjsBoot ? import ./ghcjs-boot.nix { inherit fetchgit runCommand; }
 , shims ? import ./shims.nix { inherit fetchFromGitHub; }
 }:
 let version = "0.2.0"; in
@@ -100,10 +101,14 @@ mkDerivation (rec {
       sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch
     done
   '';
+  # We build with --quick so we can build stage 2 packages separately.
+  # This is necessary due to: https://github.com/haskell/cabal/commit/af19fb2c2d231d8deff1cb24164a2bf7efb8905a
+  # Cabal otherwise fails to build: http://hydra.nixos.org/build/31824079/nixlog/1/raw
   postInstall = ''
     PATH=$out/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${stdenv.cc}/lib64:$LD_LIBRARY_PATH \
       env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot \
         --dev \
+        --quick \
         --with-cabal ${cabal-install}/bin/cabal \
         --with-gmp-includes ${gmp}/include \
         --with-gmp-libraries ${gmp}/lib
@@ -111,7 +116,7 @@ mkDerivation (rec {
   passthru = {
     isGhcjs = true;
     nativeGhc = ghc;
-    inherit nodejs;
+    inherit nodejs ghcjsBoot;
   };
 
   homepage = "https://github.com/ghcjs/ghcjs";
diff --git a/pkgs/development/compilers/ghcjs/ghcjs-boot.nix b/pkgs/development/compilers/ghcjs/ghcjs-boot.nix
index cbf21cb8f5b..add39a35242 100644
--- a/pkgs/development/compilers/ghcjs/ghcjs-boot.nix
+++ b/pkgs/development/compilers/ghcjs/ghcjs-boot.nix
@@ -1,7 +1,35 @@
-{ fetchgit }:
-fetchgit {
-  url = git://github.com/ghcjs/ghcjs-boot.git;
-  rev = "97dea5c4145bf80a1e7cffeb1ecd4d0ecacd5a2f";
-  sha256 = "1cgjzm595l2dx6fibzbkyv23bp1857qia0hb9d8aghf006al558j";
-  fetchSubmodules = true;
-}
+{ runCommand, fetchgit }:
+
+let
+  src = fetchgit {
+    url = git://github.com/ghcjs/ghcjs-boot.git;
+    rev = "97dea5c4145bf80a1e7cffeb1ecd4d0ecacd5a2f";
+    sha256 = "1cgjzm595l2dx6fibzbkyv23bp1857qia0hb9d8aghf006al558j";
+    fetchSubmodules = true;
+  };
+
+in
+
+# we remove the patches so ghcjs-boot doesn't try to apply them again.
+runCommand "${src.name}-patched" {} ''
+  cp -r ${src} $out
+  chmod -R +w $out
+
+  # Make the patches be relative their corresponding package's directory.
+  # See: https://github.com/ghcjs/ghcjs-boot/pull/12
+  for patch in $out/patches/*.patch; do
+    echo ">> fixing patch: $patch"
+    sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch
+  done
+
+  for package in $(cd $out/boot; echo *); do
+    patch=$out/patches/$package.patch
+    if [[ -e $patch ]]; then
+      echo ">> patching package: $package"
+      pushd $out/boot/$package
+      patch -p1 < $patch
+      rm $patch
+      popd
+    fi
+  done
+''