2016-05-27 02:05:07 +02:00
|
|
|
{ stdenv, fetchFromGitHub, emscriptenfastcomp, python, nodejs, closurecompiler, jre }:
|
2014-07-12 17:17:50 +02:00
|
|
|
|
|
|
|
let
|
2016-05-27 02:05:07 +02:00
|
|
|
rev = "1.36.4";
|
2015-10-31 07:27:15 +01:00
|
|
|
appdir = "share/emscripten";
|
2014-07-12 17:17:50 +02:00
|
|
|
in
|
|
|
|
|
2016-05-27 02:05:07 +02:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "emscripten-${rev}";
|
2014-07-12 17:17:50 +02:00
|
|
|
|
2016-05-27 02:05:07 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kripken";
|
|
|
|
repo = "emscripten";
|
|
|
|
sha256 = "1c9592i891z1v9rp4a4lnsp14nwiqfxnh37g6xwwjd1bqx7x4hn7";
|
|
|
|
inherit rev;
|
2014-07-12 17:17:50 +02:00
|
|
|
};
|
|
|
|
|
2016-05-27 02:05:07 +02:00
|
|
|
buildCommand = ''
|
2015-10-31 07:27:15 +01:00
|
|
|
mkdir -p $out/${appdir}
|
|
|
|
cp -r $src/* $out/${appdir}
|
|
|
|
chmod -R +w $out/${appdir}
|
|
|
|
grep -rl '^#!/usr.*python' $out/${appdir} | xargs sed -i -s 's@^#!/usr.*python.*@#!${python}/bin/python@'
|
|
|
|
sed -i -e "s,EM_CONFIG = '~/.emscripten',EM_CONFIG = '$out/${appdir}/config'," $out/${appdir}/tools/shared.py
|
|
|
|
sed -i -e 's,^.*did not see a source tree above the LLVM.*$, return True,' $out/${appdir}/tools/shared.py
|
|
|
|
sed -i -e 's,def check_sanity(force=False):,def check_sanity(force=False):\n return,' $out/${appdir}/tools/shared.py
|
|
|
|
mkdir $out/bin
|
|
|
|
ln -s $out/${appdir}/{em++,em-config,emar,embuilder.py,emcc,emcmake,emconfigure,emlink.py,emmake,emranlib,emrun,emscons} $out/bin
|
2014-07-12 17:17:50 +02:00
|
|
|
|
2015-10-31 07:27:15 +01:00
|
|
|
echo "EMSCRIPTEN_ROOT = '$out/${appdir}'" > $out/${appdir}/config
|
|
|
|
echo "LLVM_ROOT = '${emscriptenfastcomp}'" >> $out/${appdir}/config
|
|
|
|
echo "PYTHON = '${python}/bin/python'" >> $out/${appdir}/config
|
|
|
|
echo "NODE_JS = '${nodejs}/bin/node'" >> $out/${appdir}/config
|
|
|
|
echo "JS_ENGINES = [NODE_JS]" >> $out/${appdir}/config
|
|
|
|
echo "COMPILER_ENGINE = NODE_JS" >> $out/${appdir}/config
|
|
|
|
echo "CLOSURE_COMPILER = '${closurecompiler}/share/java/compiler.jar'" >> $out/${appdir}/config
|
|
|
|
echo "JAVA = '${jre}/bin/java'" >> $out/${appdir}/config
|
2014-07-12 17:17:50 +02:00
|
|
|
'';
|
2016-05-27 02:05:13 +02:00
|
|
|
|
2014-07-12 17:17:50 +02:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = https://github.com/kripken/emscripten;
|
|
|
|
description = "An LLVM-to-JavaScript Compiler";
|
2015-11-21 13:33:22 +01:00
|
|
|
platforms = platforms.all;
|
2016-05-27 15:44:29 +02:00
|
|
|
maintainers = with maintainers; [ qknight matthewbauer ];
|
2015-05-28 19:20:29 +02:00
|
|
|
license = licenses.ncsa;
|
2014-07-12 17:17:50 +02:00
|
|
|
};
|
|
|
|
}
|