2014-08-26 17:35:29 +00:00
|
|
|
{ nodejs, cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
|
|
|
|
, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time
|
|
|
|
, zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable
|
2014-11-30 17:08:28 +00:00
|
|
|
, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_11_0_1
|
2014-08-26 17:35:29 +00:00
|
|
|
, parallel, safe, shelly, split, stringsearch, syb, systemFileio
|
|
|
|
, systemFilepath, tar, terminfo, textBinary, unorderedContainers
|
|
|
|
, vector, wlPprintText, yaml, fetchgit, Cabal, CabalGhcjs, cabalInstall
|
|
|
|
, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch
|
|
|
|
, automake, libtool, cabalInstallGhcjs, gmp, base16Bytestring
|
2014-10-09 14:54:27 +00:00
|
|
|
, cryptohash, executablePath, transformersCompat, haddockApi
|
2014-08-25 22:17:18 +00:00
|
|
|
, haddock, hspec, xhtml, primitive, cacert, pkgs, ghc
|
2014-08-26 17:35:29 +00:00
|
|
|
}:
|
|
|
|
cabal.mkDerivation (self: rec {
|
|
|
|
pname = "ghcjs";
|
|
|
|
version = "0.1.0";
|
|
|
|
src = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs.git;
|
2014-11-30 09:12:35 +00:00
|
|
|
rev = "5c2d279982466e076223fcbe1e1096e22956e5a9";
|
|
|
|
sha256 = "0bc37b4e8bd039208a126fea39850c99459265cb273ac7237939cdbaee6ef71f";
|
2014-08-26 17:35:29 +00:00
|
|
|
};
|
|
|
|
shims = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/shims.git;
|
2014-10-09 14:54:27 +00:00
|
|
|
rev = "5e11d33cb74f8522efca0ace8365c0dc994b10f6";
|
|
|
|
sha256 = "64be139022e6f662086103fca3838330006d38e6454bd3f7b66013031a47278e";
|
2014-08-26 17:35:29 +00:00
|
|
|
};
|
|
|
|
isLibrary = true;
|
|
|
|
isExecutable = true;
|
|
|
|
jailbreak = true;
|
|
|
|
noHaddock = true;
|
2014-11-17 06:08:11 +00:00
|
|
|
doCheck = false;
|
2014-08-26 17:35:29 +00:00
|
|
|
ghcjsPrim = cabal.mkDerivation (self: {
|
|
|
|
pname = "ghcjs-prim";
|
|
|
|
version = "0.1.0.0";
|
|
|
|
src = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs-prim.git;
|
2014-10-09 14:54:27 +00:00
|
|
|
rev = "915f263c06b7f4a246c6e02ecdf2b9a0550ed967";
|
|
|
|
sha256 = "34dd58b6e2d0ce780da46b509fc2701c28a7b2182f8d700b53a80981ac8bcf86";
|
2014-08-26 17:35:29 +00:00
|
|
|
};
|
|
|
|
buildDepends = [ primitive ];
|
|
|
|
});
|
|
|
|
buildDepends = [
|
|
|
|
filepath HTTP mtl network random stm time zlib aeson attoparsec
|
|
|
|
bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta
|
2014-11-30 17:08:28 +00:00
|
|
|
lens optparseApplicative_0_11_0_1 parallel safe shelly split
|
2014-08-26 17:35:29 +00:00
|
|
|
stringsearch syb systemFileio systemFilepath tar terminfo textBinary
|
|
|
|
unorderedContainers vector wlPprintText yaml
|
|
|
|
alex happy git gnumake gcc autoconf automake libtool patch gmp
|
2014-11-17 06:08:11 +00:00
|
|
|
base16Bytestring cryptohash executablePath haddockApi
|
2014-08-26 17:35:29 +00:00
|
|
|
transformersCompat QuickCheck haddock hspec xhtml
|
2014-11-17 06:08:11 +00:00
|
|
|
ghcjsPrim regexPosix
|
2014-08-26 17:35:29 +00:00
|
|
|
];
|
|
|
|
buildTools = [ nodejs git ];
|
|
|
|
testDepends = [
|
2014-08-27 16:27:42 +00:00
|
|
|
HUnit testFramework testFrameworkHunit
|
2014-08-26 17:35:29 +00:00
|
|
|
];
|
|
|
|
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
|
|
|
|
'';
|
2014-08-25 22:46:52 +00:00
|
|
|
libdir = "/share/ghcjs/${pkgs.stdenv.system}-${version}-${ghc.ghc.version}";
|
2014-08-26 17:35:29 +00:00
|
|
|
postInstall = ''
|
|
|
|
export HOME=$(pwd)
|
2014-08-25 22:17:18 +00:00
|
|
|
export GIT_SSL_CAINFO="${cacert}/etc/ca-bundle.crt"
|
2014-08-26 17:35:29 +00:00
|
|
|
git clone git://github.com/ghcjs/ghcjs-boot.git
|
|
|
|
cd ghcjs-boot
|
2014-12-01 10:53:38 +00:00
|
|
|
git checkout 8bf2861c0c776eec42e0a1833f220e36681e810c
|
2014-08-26 17:35:29 +00:00
|
|
|
git submodule update --init --recursive
|
|
|
|
( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot )
|
|
|
|
chmod -R u+w . # because fetchgit made it read-only
|
2014-08-25 22:46:52 +00:00
|
|
|
local GHCJS_LIBDIR=$out${libdir}
|
2014-12-01 10:53:38 +00:00
|
|
|
mkdir -p $GHCJS_LIBDIR
|
2014-08-26 17:35:29 +00:00
|
|
|
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 --dev --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib
|
|
|
|
'';
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
})
|