ghcjs: fix building with cabal-install-1.22.8.0

This commit is contained in:
Charles Strahan
2016-02-17 22:07:32 -05:00
parent de5a233a71
commit bbce88302a
6 changed files with 466 additions and 32 deletions

View File

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

View File

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