2015-03-13 03:20:56 +00:00
|
|
|
{ mkDerivation
|
|
|
|
, test-framework
|
|
|
|
, test-framework-hunit
|
|
|
|
, test-framework-quickcheck2
|
|
|
|
, data-default
|
|
|
|
, ghc-paths
|
|
|
|
, haskell-src-exts
|
|
|
|
, haskell-src-meta
|
|
|
|
, optparse-applicative
|
|
|
|
, system-fileio
|
|
|
|
, system-filepath
|
|
|
|
, text-binary
|
|
|
|
, unordered-containers
|
|
|
|
, cabal-install
|
|
|
|
, wl-pprint-text
|
|
|
|
, base16-bytestring
|
|
|
|
, executable-path
|
|
|
|
, transformers-compat
|
|
|
|
, haddock-api
|
|
|
|
, ghcjs-prim
|
|
|
|
, regex-posix
|
|
|
|
|
|
|
|
, ghc, gmp
|
|
|
|
, jailbreak-cabal
|
|
|
|
|
|
|
|
, nodejs, stdenv, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
|
|
|
|
, time
|
|
|
|
, zlib, aeson, attoparsec, bzlib, hashable
|
|
|
|
, lens
|
|
|
|
, parallel, safe, shelly, split, stringsearch, syb
|
|
|
|
, tar, terminfo
|
|
|
|
, vector, yaml, fetchgit, Cabal
|
|
|
|
, alex, happy, git, gnumake, autoconf, patch
|
|
|
|
, automake, libtool
|
|
|
|
, cryptohash
|
|
|
|
, haddock, hspec, xhtml, primitive, cacert, pkgs
|
2014-12-12 01:53:25 +00:00
|
|
|
, coreutils
|
2015-03-13 03:20:56 +00:00
|
|
|
, libiconv
|
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";
|
2015-03-13 03:20:56 +00:00
|
|
|
libDir = "share/ghcjs/${pkgs.stdenv.system}-${version}-${ghc.version}/ghcjs";
|
2014-12-12 01:53:25 +00:00
|
|
|
ghcjsBoot = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs-boot.git;
|
2015-03-13 03:20:56 +00:00
|
|
|
rev = "8cd6144870470258fb037b3e04a0a2a98c2b6551"; # 7.10 branch
|
|
|
|
sha256 = "16cbncx179n5khf8hkj9r221wf73rc8isffk8rv3n9psshv1jiji";
|
2015-01-11 23:03:45 +00:00
|
|
|
fetchSubmodules = true;
|
2014-08-26 18:35:29 +01:00
|
|
|
};
|
|
|
|
shims = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/shims.git;
|
2015-03-13 03:20:56 +00:00
|
|
|
rev = "6ada4bf1a084d1b80b993303d35ed863d219b031"; # master branch
|
|
|
|
sha256 = "0dhfnjj3rxdbb2m1pbnjc2yp4xcgsfdrsinljgdmg0hpqkafp4vc";
|
2014-08-26 18:35:29 +01:00
|
|
|
};
|
2015-03-13 03:20:56 +00:00
|
|
|
in mkDerivation (rec {
|
2014-12-12 01:53:25 +00:00
|
|
|
pname = "ghcjs";
|
|
|
|
inherit version;
|
|
|
|
src = fetchgit {
|
|
|
|
url = git://github.com/ghcjs/ghcjs.git;
|
2015-03-13 03:20:56 +00:00
|
|
|
rev = "35a59743c4027f26a227635cb24a6246bd851f8d"; # master branch
|
|
|
|
sha256 = "107sh36ji3psdl3py84vxgqbywjyzglj3p0akzpvcmbarxwfr1mw";
|
2014-12-12 01:53:25 +00:00
|
|
|
};
|
|
|
|
isLibrary = true;
|
|
|
|
isExecutable = true;
|
|
|
|
jailbreak = true;
|
2015-03-13 03:20:56 +00:00
|
|
|
doHaddock = false;
|
2014-12-12 01:53:25 +00:00
|
|
|
doCheck = false;
|
2014-08-26 18:35:29 +01:00
|
|
|
buildDepends = [
|
|
|
|
filepath HTTP mtl network random stm time zlib aeson attoparsec
|
2015-03-13 03:20:56 +00:00
|
|
|
bzlib data-default ghc-paths hashable haskell-src-exts haskell-src-meta
|
|
|
|
lens optparse-applicative parallel safe shelly split
|
|
|
|
stringsearch syb system-fileio system-filepath tar terminfo text-binary
|
|
|
|
unordered-containers vector wl-pprint-text yaml
|
|
|
|
alex happy git gnumake autoconf automake libtool patch gmp
|
|
|
|
base16-bytestring cryptohash executable-path haddock-api
|
|
|
|
transformers-compat QuickCheck haddock hspec xhtml
|
|
|
|
ghcjs-prim regex-posix libiconv
|
2014-08-26 18:35:29 +01:00
|
|
|
];
|
|
|
|
buildTools = [ nodejs git ];
|
|
|
|
testDepends = [
|
2015-03-13 03:20:56 +00:00
|
|
|
HUnit test-framework test-framework-hunit
|
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"
|
2015-03-13 03:20:56 +00:00
|
|
|
substituteInPlace src-bin/Boot.hs \
|
|
|
|
--replace "@PREFIX@" "$out" \
|
|
|
|
--replace "@CC@" "${stdenv.cc}/bin/cc"
|
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
|
2015-03-13 03:20:56 +00:00
|
|
|
|
|
|
|
# Make the patches be relative their corresponding package's directory.
|
|
|
|
# See: https://github.com/ghcjs/ghcjs-boot/pull/12
|
|
|
|
for patch in $topDir/ghcjs-boot/patches/*.patch; do
|
|
|
|
echo "fixing patch: $patch"
|
|
|
|
sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch
|
|
|
|
done
|
2014-12-25 02:58:45 +00:00
|
|
|
'';
|
|
|
|
postInstall = ''
|
2015-03-13 03:20:56 +00:00
|
|
|
PATH=$out/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${stdenv.cc}/lib64:$LD_LIBRARY_PATH \
|
2014-12-12 01:53:25 +00:00
|
|
|
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot \
|
|
|
|
--dev \
|
2015-03-13 03:20:56 +00:00
|
|
|
--with-cabal ${cabal-install}/bin/cabal \
|
2014-12-12 01:53:25 +00:00
|
|
|
--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;
|
2015-03-13 03:20:56 +00:00
|
|
|
isGhcjs = true;
|
|
|
|
nativeGhc = ghc;
|
2014-12-12 01:53:25 +00:00
|
|
|
};
|
2015-03-13 03:20:56 +00:00
|
|
|
|
|
|
|
homepage = "https://github.com/ghcjs/ghcjs";
|
|
|
|
description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API";
|
|
|
|
license = stdenv.lib.licenses.bsd3;
|
|
|
|
platforms = ghc.meta.platforms;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [
|
|
|
|
jwiegley cstrahan
|
|
|
|
];
|
2014-08-26 18:35:29 +01:00
|
|
|
})
|