1{ stdenv, fetchgit, emscriptenfastcomp, python, nodejs, closurecompiler, jre }:
2
3let
4 tag = "1.29.10";
5in
6
7stdenv.mkDerivation rec {
8 name = "emscripten-${tag}";
9
10 src = fetchgit {
11 url = git://github.com/kripken/emscripten;
12 rev = "refs/tags/${tag}";
13 sha256 = "0d7ed2b801ac37acaf907bd03ba42cce3ac4a4c330bf1ef28de25bbb3f39ba87";
14 };
15
16 buildCommand = ''
17 mkdir $out
18 cp -a $src $out/bin
19 chmod -R +w $out/bin
20 grep -rl '^#!/usr.*python' $out/bin | xargs sed -i -s 's@^#!/usr.*python.*@#!${python}/bin/python@'
21 sed -i -e "s,EM_CONFIG = '~/.emscripten',EM_CONFIG = '$out/config'," $out/bin/tools/shared.py
22 sed -i -e 's,^.*did not see a source tree above the LLVM.*$, return True,' $out/bin/tools/shared.py
23 sed -i -e 's,def check_sanity(force=False):,def check_sanity(force=False):\n return,' $out/bin/tools/shared.py
24
25 echo "EMSCRIPTEN_ROOT = '$out/bin'" > $out/config
26 echo "LLVM_ROOT = '${emscriptenfastcomp}'" >> $out/config
27 echo "PYTHON = '${python}/bin/python'" >> $out/config
28 echo "NODE_JS = '${nodejs}/bin/node'" >> $out/config
29 echo "JS_ENGINES = [NODE_JS]" >> $out/config
30 echo "COMPILER_ENGINE = NODE_JS" >> $out/config
31 echo "CLOSURE_COMPILER = '${closurecompiler}/bin/closure-compiler'" >> $out/config
32 echo "JAVA = '${jre}/bin/java'" >> $out/config
33 '';
34 meta = with stdenv.lib; {
35 homepage = https://github.com/kripken/emscripten;
36 description = "An LLVM-to-JavaScript Compiler";
37 maintainers = with maintainers; [ bosu ];
38 license = licenses.ncsa;
39 };
40}