emscriptenfastcomp: build using cmake and use cc-wrapper
This commit is contained in:
parent
1fa75a5bb7
commit
db0120dea2
@ -1,13 +1,13 @@
|
||||
{ stdenv, fetchFromGitHub, python }:
|
||||
{ stdenv, fetchFromGitHub, cmake, python, ... }:
|
||||
|
||||
let
|
||||
rev = "1.36.4";
|
||||
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "emscripten-fastcomp-${rev}";
|
||||
|
||||
srcFC = fetchFromGitHub {
|
||||
src = fetchFromGitHub {
|
||||
owner = "kripken";
|
||||
repo = "emscripten-fastcomp";
|
||||
sha256 = "0838rl0n9hyq5dd0gmj5rvigbmk5mhrhzyjk0zd8mjs2mk8z510l";
|
||||
@ -21,24 +21,32 @@ stdenv.mkDerivation rec {
|
||||
inherit rev;
|
||||
};
|
||||
|
||||
buildInputs = [ python ];
|
||||
buildCommand = ''
|
||||
cp -as ${srcFC} $TMPDIR/src
|
||||
chmod +w $TMPDIR/src/tools
|
||||
cp -as ${srcFL} $TMPDIR/src/tools/clang
|
||||
|
||||
chmod +w $TMPDIR/src
|
||||
mkdir $TMPDIR/src/build
|
||||
cd $TMPDIR/src/build
|
||||
|
||||
../configure --enable-optimized --disable-assertions --enable-targets=host,js
|
||||
make
|
||||
cp -a Release/bin $out
|
||||
nativeBuildInputs = [ cmake python ];
|
||||
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=OFF"
|
||||
# "-DCLANG_INCLUDE_EXAMPLES=OFF"
|
||||
"-DCLANG_INCLUDE_TESTS=OFF"
|
||||
] ++ (stdenv.lib.optional stdenv.isLinux
|
||||
# necessary for clang to find crtend.o
|
||||
"-DGCC_INSTALL_PREFIX=${gcc}"
|
||||
);
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru = {
|
||||
isClang = true;
|
||||
inherit gcc;
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = https://github.com/kripken/emscripten-fastcomp;
|
||||
description = "Emscripten llvm";
|
||||
description = "Emscripten LLVM";
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ qknight matthewbauer ];
|
||||
license = stdenv.lib.licenses.ncsa;
|
||||
|
@ -27,7 +27,7 @@ stdenv.mkDerivation {
|
||||
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 "LLVM_ROOT = '${emscriptenfastcomp}'" >> $out/${appdir}/config
|
||||
echo "LLVM_ROOT = '${emscriptenfastcomp}/bin'" >> $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
|
||||
|
@ -1555,7 +1555,18 @@ in
|
||||
|
||||
emscripten = callPackage ../development/compilers/emscripten { };
|
||||
|
||||
emscriptenfastcomp = callPackage ../development/compilers/emscripten-fastcomp { };
|
||||
emscriptenfastcomp-unwrapped = callPackage ../development/compilers/emscripten-fastcomp { };
|
||||
emscriptenfastcomp-wrapped = wrapCC emscriptenfastcomp-unwrapped;
|
||||
emscriptenfastcomp = symlinkJoin {
|
||||
name = "emscriptenfastcomp";
|
||||
paths = [ emscriptenfastcomp-wrapped 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]*
|
||||
'';
|
||||
};
|
||||
|
||||
emscriptenPackages = recurseIntoAttrs (callPackage ./emscripten-packages.nix { });
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user