emscripten: 1.39.1 -> 2.0.0
This commit is contained in:
parent
40fafd53b1
commit
2d39da2084
@ -1,63 +1,66 @@
|
|||||||
{ emscriptenVersion, stdenv, fetchFromGitHub, emscriptenfastcomp, python, nodejs, closurecompiler
|
{ stdenv, fetchFromGitHub, python3, nodejs, closurecompiler
|
||||||
, jre, binaryen, enableWasm ? true , cmake
|
, jre, binaryen
|
||||||
|
, llvmPackages_11
|
||||||
|
, symlinkJoin, makeWrapper
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
stdenv.mkDerivation rec {
|
||||||
rev = emscriptenVersion;
|
pname = "emscripten";
|
||||||
appdir = "share/emscripten";
|
# 2.0.1 requires unreleased binaryen version (as of 2020-08-28)
|
||||||
binaryenVersioned = binaryen.override { emscriptenRev = rev; };
|
version = "2.0.0";
|
||||||
in
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
llvmEnv = symlinkJoin {
|
||||||
name = "emscripten-${rev}";
|
name = "emscripten-llvm-${version}";
|
||||||
|
paths = with llvmPackages_11; [ clang-unwrapped lld llvm ];
|
||||||
|
};
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "emscripten-core";
|
owner = "emscripten-core";
|
||||||
repo = "emscripten";
|
repo = "emscripten";
|
||||||
sha256 = "1j3f0hpy05qskaiyv75l7wv4n0nzxhrh9b296zchx3f6f9h2rghq";
|
sha256 = "1ihr1v8dlq5xq97i59n7s1hhz5pkafi6556ppgzjmmhiiraz2mkh";
|
||||||
inherit rev;
|
rev = version;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ nodejs cmake python ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
buildInputs = [ nodejs python3 ];
|
||||||
|
|
||||||
buildCommand = ''
|
outputs = [ "out" "appdir" ];
|
||||||
mkdir -p $out/${appdir}
|
|
||||||
cp -r $src/* $out/${appdir}
|
buildPhase = ''
|
||||||
chmod -R +w $out/${appdir}
|
patchShebangs .
|
||||||
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
|
|
||||||
# fixes cmake support
|
# fixes cmake support
|
||||||
sed -i -e "s/print \('emcc (Emscript.*\)/sys.stderr.write(\1); sys.stderr.flush()/g" $out/${appdir}/emcc.py
|
sed -i -e "s/print \('emcc (Emscript.*\)/sys.stderr.write(\1); sys.stderr.flush()/g" emcc.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
|
|
||||||
|
|
||||||
echo "EMSCRIPTEN_ROOT = '$out/${appdir}'" > $out/${appdir}/config
|
echo "EMSCRIPTEN_ROOT = '$appdir'" > .emscripten
|
||||||
echo "LLVM_ROOT = '${emscriptenfastcomp}/bin'" >> $out/${appdir}/config
|
echo "LLVM_ROOT = '${llvmEnv}/bin'" >> .emscripten
|
||||||
echo "PYTHON = '${python}/bin/python'" >> $out/${appdir}/config
|
echo "NODE_JS = '${nodejs}/bin/node'" >> .emscripten
|
||||||
echo "NODE_JS = '${nodejs}/bin/node'" >> $out/${appdir}/config
|
echo "JS_ENGINES = [NODE_JS]" >> .emscripten
|
||||||
echo "JS_ENGINES = [NODE_JS]" >> $out/${appdir}/config
|
echo "COMPILER_ENGINE = NODE_JS" >> .emscripten
|
||||||
echo "COMPILER_ENGINE = NODE_JS" >> $out/${appdir}/config
|
echo "CLOSURE_COMPILER = '${closurecompiler}/share/java/closure-compiler-v${closurecompiler.version}.jar'" >> .emscripten
|
||||||
echo "CLOSURE_COMPILER = '${closurecompiler}/share/java/closure-compiler-v${closurecompiler.version}.jar'" >> $out/${appdir}/config
|
echo "JAVA = '${jre}/bin/java'" >> .emscripten
|
||||||
echo "JAVA = '${jre}/bin/java'" >> $out/${appdir}/config
|
|
||||||
# to make the test(s) below work
|
# to make the test(s) below work
|
||||||
echo "SPIDERMONKEY_ENGINE = []" >> $out/${appdir}/config
|
echo "SPIDERMONKEY_ENGINE = []" >> .emscripten
|
||||||
''
|
echo "BINARYEN_ROOT = '${binaryen}'" >> .emscripten
|
||||||
+ stdenv.lib.optionalString enableWasm ''
|
'';
|
||||||
echo "BINARYEN_ROOT = '${binaryenVersioned}'" >> $out/share/emscripten/config
|
|
||||||
''
|
|
||||||
+
|
|
||||||
''
|
|
||||||
echo "--------------- running test -----------------"
|
|
||||||
# quick hack to get the test working
|
|
||||||
HOME=$TMPDIR
|
|
||||||
cp $out/${appdir}/config $HOME/.emscripten
|
|
||||||
export PATH=$PATH:$out/bin
|
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
rm -rf cache
|
||||||
|
cp -r . $appdir
|
||||||
|
chmod -R +w $appdir
|
||||||
|
|
||||||
|
mkdir -p $out/bin
|
||||||
|
for b in em++ em-config emar embuilder.py emcc emcmake emconfigure emlink.py emmake emranlib emrun emscons; do
|
||||||
|
makeWrapper $appdir/$b $out/bin/$b \
|
||||||
|
--set PYTHON ${python3}/bin/python
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
checkPhase = ''
|
||||||
#export EMCC_DEBUG=2
|
#export EMCC_DEBUG=2
|
||||||
${python}/bin/python $src/tests/runner.py test_hello_world
|
export PYTHON=${python3}/bin/python
|
||||||
echo "--------------- /running test -----------------"
|
export HOME=$TMPDIR
|
||||||
|
python tests/runner.py test_hello_world
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
{ newScope, stdenv, binutils, wrapCCWith, symlinkJoin }:
|
|
||||||
let
|
|
||||||
callPackage = newScope (self // {inherit stdenv;});
|
|
||||||
|
|
||||||
self = {
|
|
||||||
emscriptenfastcomp-unwrapped = callPackage ./emscripten-fastcomp.nix {};
|
|
||||||
emscriptenfastcomp-wrapped = wrapCCWith {
|
|
||||||
cc = self.emscriptenfastcomp-unwrapped;
|
|
||||||
# Never want Apple's cctools for WASM target
|
|
||||||
bintools = binutils;
|
|
||||||
libc = stdenv.cc.libc;
|
|
||||||
extraBuildCommands = ''
|
|
||||||
# hardening flags break WASM support
|
|
||||||
cat > $out/nix-support/add-hardening.sh
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
emscriptenfastcomp = symlinkJoin {
|
|
||||||
name = "emscriptenfastcomp-${stdenv.lib.getVersion self.emscriptenfastcomp-unwrapped}";
|
|
||||||
paths = [ self.emscriptenfastcomp-wrapped self.emscriptenfastcomp-unwrapped ];
|
|
||||||
preferLocalBuild = false;
|
|
||||||
allowSubstitutes = true;
|
|
||||||
postBuild = ''
|
|
||||||
# replace unwrapped clang-3.9 binary by wrapper
|
|
||||||
ln -sf $out/bin/clang $out/bin/clang-[0-9]*
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in self
|
|
@ -1,53 +0,0 @@
|
|||||||
{ emscriptenVersion, stdenv, fetchFromGitHub, cmake, python, gtest, gccForLibs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
rev = emscriptenVersion;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
name = "emscripten-fastcomp-${rev}";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "emscripten-core";
|
|
||||||
repo = "emscripten-fastcomp";
|
|
||||||
sha256 = "0bd0l5k2fa4k0nax2cpxi003pqffqivx4z4m2j5xdha1a12sid8i";
|
|
||||||
inherit rev;
|
|
||||||
};
|
|
||||||
|
|
||||||
srcFL = fetchFromGitHub {
|
|
||||||
owner = "emscripten-core";
|
|
||||||
repo = "emscripten-fastcomp-clang";
|
|
||||||
sha256 = "1iw2qplhp489qzw0rma73sab7asnm27g4m95sr36c6kq9cq6agri";
|
|
||||||
inherit rev;
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python gtest ];
|
|
||||||
preConfigure = ''
|
|
||||||
cp -Lr ${srcFL} tools/clang
|
|
||||||
chmod +w -R tools/clang
|
|
||||||
'';
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DCMAKE_BUILD_TYPE=Release"
|
|
||||||
"-DLLVM_TARGETS_TO_BUILD='X86;JSBackend'"
|
|
||||||
"-DLLVM_INCLUDE_EXAMPLES=OFF"
|
|
||||||
"-DLLVM_INCLUDE_TESTS=ON"
|
|
||||||
#"-DLLVM_CONFIG=${llvm}/bin/llvm-config"
|
|
||||||
"-DLLVM_BUILD_TESTS=ON"
|
|
||||||
"-DCLANG_INCLUDE_TESTS=ON"
|
|
||||||
] ++ (stdenv.lib.optional stdenv.isLinux
|
|
||||||
# necessary for clang to find crtend.o
|
|
||||||
"-DGCC_INSTALL_PREFIX=${gccForLibs}"
|
|
||||||
);
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
isClang = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
homepage = "https://github.com/emscripten-core/emscripten-fastcomp";
|
|
||||||
description = "Emscripten LLVM";
|
|
||||||
platforms = platforms.all;
|
|
||||||
maintainers = with maintainers; [ qknight matthewbauer ];
|
|
||||||
license = stdenv.lib.licenses.ncsa;
|
|
||||||
};
|
|
||||||
}
|
|
@ -3369,14 +3369,8 @@ in
|
|||||||
|
|
||||||
cholmod-extra = callPackage ../development/libraries/science/math/cholmod-extra { };
|
cholmod-extra = callPackage ../development/libraries/science/math/cholmod-extra { };
|
||||||
|
|
||||||
emscriptenVersion = "1.39.1";
|
|
||||||
|
|
||||||
emscripten = callPackage ../development/compilers/emscripten { };
|
emscripten = callPackage ../development/compilers/emscripten { };
|
||||||
|
|
||||||
emscriptenfastcompPackages = dontRecurseIntoAttrs (callPackage ../development/compilers/emscripten/fastcomp { });
|
|
||||||
|
|
||||||
emscriptenfastcomp = emscriptenfastcompPackages.emscriptenfastcomp;
|
|
||||||
|
|
||||||
emscriptenPackages = recurseIntoAttrs (callPackage ./emscripten-packages.nix { });
|
emscriptenPackages = recurseIntoAttrs (callPackage ./emscripten-packages.nix { });
|
||||||
|
|
||||||
emscriptenStdenv = stdenv // { mkDerivation = buildEmscriptenPackage; };
|
emscriptenStdenv = stdenv // { mkDerivation = buildEmscriptenPackage; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user