2014-06-28 21:46:35 -07:00
|
|
|
{ cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
|
|
|
|
, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time
|
|
|
|
, zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable
|
|
|
|
, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2
|
|
|
|
, parallel, safe, shelly, split, stringsearch, syb, systemFileio
|
|
|
|
, systemFilepath, tar, terminfo, textBinary, unorderedContainers
|
2014-06-29 21:49:35 -07:00
|
|
|
, vector, wlPprintText, yaml, fetchgit, Cabal, CabalGhcjs, cabalInstall
|
2014-06-28 21:46:35 -07:00
|
|
|
, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch
|
2014-06-29 21:49:35 -07:00
|
|
|
, automake, libtool, cabalInstallGhcjs, gmp
|
2014-06-28 21:46:35 -07:00
|
|
|
}:
|
|
|
|
|
|
|
|
cabal.mkDerivation (self: rec {
|
|
|
|
pname = "ghcjs";
|
2014-07-05 14:08:41 -07:00
|
|
|
version = "0.1.0";
|
2014-06-28 21:46:35 -07:00
|
|
|
src = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs.git;
|
|
|
|
rev = "c9ce6b9d87296b1236d5ef0f7d5236b2cedcff84";
|
|
|
|
sha256 = "0cla5bchprc8g5n39fkssnv3lj378h948irsnr7dslaki6laaagw";
|
|
|
|
};
|
|
|
|
bootSrc = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs-boot.git;
|
|
|
|
rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81";
|
|
|
|
sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8";
|
|
|
|
};
|
2014-06-29 21:49:35 -07:00
|
|
|
shims = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/shims.git;
|
|
|
|
rev = "a6dd0202dcdb86ad63201495b8b5d9763483eb35";
|
|
|
|
sha256 = "07cd7ijw4i62iz1xjpwilriiybpqdx246w8d3j27ny1xfsj9wnax";
|
|
|
|
};
|
2014-06-28 21:46:35 -07:00
|
|
|
isLibrary = true;
|
|
|
|
isExecutable = true;
|
|
|
|
jailbreak = true;
|
|
|
|
noHaddock = true;
|
|
|
|
buildDepends = [
|
|
|
|
filepath HTTP mtl network random stm time zlib aeson attoparsec
|
|
|
|
bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta
|
|
|
|
lens optparseApplicative_0_7_0_2 parallel safe shelly split
|
|
|
|
stringsearch syb systemFileio systemFilepath tar terminfo textBinary
|
|
|
|
unorderedContainers vector wlPprintText yaml
|
2014-06-29 21:49:35 -07:00
|
|
|
alex happy git gnumake gcc autoconf automake libtool patch gmp
|
2014-06-28 21:46:35 -07:00
|
|
|
];
|
|
|
|
testDepends = [
|
|
|
|
HUnit regexPosix testFramework testFrameworkHunit
|
|
|
|
];
|
|
|
|
postConfigure = ''
|
|
|
|
echo Patching ghcjs with absolute paths to the Nix store
|
|
|
|
sed -i -e "s|getAppUserDataDirectory \"ghcjs\"|return \"$out/share/ghcjs\"|" \
|
|
|
|
src/Compiler/Info.hs
|
|
|
|
sed -i -e "s|str = \\[\\]|str = [\"--prefix=$out\", \"--libdir=$prefix/lib/$compiler\", \"--libsubdir=$pkgid\"]|" \
|
|
|
|
src-bin/Boot.hs
|
|
|
|
'';
|
|
|
|
postInstall = ''
|
2014-06-29 21:49:35 -07:00
|
|
|
export HOME=$(pwd)
|
2014-06-28 21:46:35 -07:00
|
|
|
cp -R ${bootSrc} ghcjs-boot
|
|
|
|
cd ghcjs-boot
|
2014-06-29 21:49:35 -07:00
|
|
|
( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot )
|
2014-06-28 21:46:35 -07:00
|
|
|
chmod -R u+w . # because fetchgit made it read-only
|
2014-06-29 21:49:35 -07:00
|
|
|
local GHCJS_LIBDIR=$out/share/ghcjs/x86_64-linux-0.1.0-7.8.2
|
|
|
|
ensureDir $GHCJS_LIBDIR
|
|
|
|
cp -R ${shims} $GHCJS_LIBDIR/shims
|
|
|
|
${cabalInstallGhcjs}/bin/cabal-js update
|
|
|
|
PATH=$out/bin:${CabalGhcjs}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.gcc}/lib64:$LD_LIBRARY_PATH \
|
|
|
|
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot --init --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib
|
2014-06-28 21:46:35 -07:00
|
|
|
'';
|
|
|
|
meta = {
|
|
|
|
homepage = "https://github.com/ghcjs/ghcjs";
|
|
|
|
description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API";
|
|
|
|
license = self.stdenv.lib.licenses.bsd3;
|
|
|
|
platforms = self.ghc.meta.platforms;
|
|
|
|
maintainers = [ self.stdenv.lib.maintainers.jwiegley ];
|
|
|
|
};
|
|
|
|
})
|