2014-08-26 18:35:29 +01: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 18:35:29 +01: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 15:54:27 +01:00
|
|
|
, cryptohash, executablePath, transformersCompat, haddockApi
|
2014-08-25 23:17:18 +01:00
|
|
|
, haddock, hspec, xhtml, primitive, cacert, pkgs, ghc
|
2014-12-12 01:53:25 +00:00
|
|
|
, coreutils
|
2014-08-26 18:35:29 +01:00
|
|
|
}:
|
2014-12-12 01:53:25 +00:00
|
|
|
let
|
2014-08-26 18:35:29 +01:00
|
|
|
version = "0.1.0";
|
2014-12-12 01:53:25 +00:00
|
|
|
libDir = "share/ghcjs/${pkgs.stdenv.system}-${version}-${ghc.ghc.version}/ghcjs";
|
|
|
|
ghcjsBoot = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs-boot.git;
|
2014-12-25 02:58:45 +00:00
|
|
|
rev = "28f328ae5acb7427483ee1aaca66a4ed2df38472";
|
|
|
|
sha256 = "107sqpadbjqxs3ym23qbp141ihra0a8ijaar94dbpa69g8b0xyyl"; # no .git
|
2014-08-26 18:35:29 +01:00
|
|
|
};
|
|
|
|
shims = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/shims.git;
|
2014-10-09 15:54:27 +01:00
|
|
|
rev = "5e11d33cb74f8522efca0ace8365c0dc994b10f6";
|
2014-12-12 01:53:25 +00:00
|
|
|
sha256 = "13i78wd064v0nvvx6js5wqw6s01hhf1s7z03c4465xp64a817gk4";
|
2014-08-26 18:35:29 +01:00
|
|
|
};
|
2014-12-27 19:27:37 +00:00
|
|
|
# TOD: move this into haskell-packages proper
|
2014-08-26 18:35:29 +01:00
|
|
|
ghcjsPrim = cabal.mkDerivation (self: {
|
|
|
|
pname = "ghcjs-prim";
|
|
|
|
version = "0.1.0.0";
|
|
|
|
src = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs-prim.git;
|
2014-12-25 02:58:45 +00:00
|
|
|
rev = "8e003e1a1df10233bc3f03d7bbd7d37de13d2a84";
|
|
|
|
sha256 = "11k2r87s58wmpxykn61lihn4vm3x67cm1dygvdl26papifinj6pz";
|
2014-08-26 18:35:29 +01:00
|
|
|
};
|
|
|
|
buildDepends = [ primitive ];
|
|
|
|
});
|
2014-12-12 01:53:25 +00:00
|
|
|
in cabal.mkDerivation (self: rec {
|
|
|
|
pname = "ghcjs";
|
|
|
|
inherit version;
|
|
|
|
src = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs.git;
|
2014-12-25 02:58:45 +00:00
|
|
|
rev = "fa0cc146b2fbdac28136fdca621e95930e2fd035";
|
|
|
|
sha256 = "1mvs4x0x1cv11m32n5kjil3q1jxszj6capshvgz3a7mzdm5cdqp8";
|
2014-12-12 01:53:25 +00:00
|
|
|
};
|
|
|
|
isLibrary = true;
|
|
|
|
isExecutable = true;
|
|
|
|
jailbreak = true;
|
|
|
|
noHaddock = true;
|
|
|
|
doCheck = false;
|
2014-08-26 18:35:29 +01:00
|
|
|
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 18:35:29 +01: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 18:35:29 +01:00
|
|
|
transformersCompat QuickCheck haddock hspec xhtml
|
2014-11-17 06:08:11 +00:00
|
|
|
ghcjsPrim regexPosix
|
2014-08-26 18:35:29 +01:00
|
|
|
];
|
|
|
|
buildTools = [ nodejs git ];
|
|
|
|
testDepends = [
|
2014-08-27 17:27:42 +01:00
|
|
|
HUnit testFramework testFrameworkHunit
|
2014-08-26 18:35:29 +01:00
|
|
|
];
|
2014-12-12 01:53:25 +00:00
|
|
|
patches = [ ./ghcjs.patch ];
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Setup.hs --replace "/usr/bin/env" "${coreutils}/bin/env"
|
|
|
|
substituteInPlace src/Compiler/Info.hs --replace "@PREFIX@" "$out"
|
|
|
|
substituteInPlace src-bin/Boot.hs --replace "@PREFIX@" "$out"
|
2014-08-26 18:35:29 +01:00
|
|
|
'';
|
2014-12-25 02:58:45 +00:00
|
|
|
preBuild = ''
|
2014-12-12 01:53:25 +00:00
|
|
|
local topDir=$out/${libDir}
|
|
|
|
mkdir -p $topDir
|
|
|
|
|
|
|
|
cp -r ${ghcjsBoot} $topDir/ghcjs-boot
|
|
|
|
chmod -R u+w $topDir/ghcjs-boot
|
|
|
|
|
|
|
|
cp -r ${shims} $topDir/shims
|
|
|
|
chmod -R u+w $topDir/shims
|
2014-12-25 02:58:45 +00:00
|
|
|
'';
|
|
|
|
postInstall = ''
|
2014-08-26 18:35:29 +01:00
|
|
|
PATH=$out/bin:${CabalGhcjs}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.gcc}/lib64:$LD_LIBRARY_PATH \
|
2014-12-12 01:53:25 +00:00
|
|
|
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
|
2014-08-26 18:35:29 +01:00
|
|
|
'';
|
2014-12-12 01:53:25 +00:00
|
|
|
passthru = {
|
|
|
|
inherit libDir;
|
|
|
|
};
|
2014-08-26 18:35:29 +01: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 ];
|
|
|
|
};
|
|
|
|
})
|