depot/third_party/nixpkgs/pkgs/development/compilers/binaryen/default.nix
Default email 410b979fe2 Project import generated by Copybara.
GitOrigin-RevId: a64e169e396460d6b5763a1de1dd197df8421688
2023-03-24 01:07:29 +01:00

53 lines
1.3 KiB
Nix

{ lib, stdenv, cmake, python3, fetchFromGitHub, emscripten,
gtest, lit, nodejs, filecheck
}:
stdenv.mkDerivation rec {
pname = "binaryen";
version = "112";
src = fetchFromGitHub {
owner = "WebAssembly";
repo = "binaryen";
rev = "version_${version}";
hash = "sha256-xVumVmiLMHJp3SItE8eL8OBPeq58HtOOiK9LL8SP4CQ=";
};
nativeBuildInputs = [ cmake python3 ];
preConfigure = ''
if [ $doCheck -eq 1 ]; then
sed -i '/googletest/d' third_party/CMakeLists.txt
else
cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0)
fi
'';
nativeCheckInputs = [ gtest lit nodejs filecheck ];
checkPhase = ''
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib python3 ../check.py $tests
'';
tests = [
"version" "wasm-opt" "wasm-dis"
"crash" "dylink" "ctor-eval"
"wasm-metadce" "wasm-reduce" "spec"
"lld" "wasm2js" "validator"
"example" "unit"
# "binaryenjs" "binaryenjs_wasm" # not building this
"lit" "gtest"
];
doCheck = stdenv.isLinux;
meta = with lib; {
homepage = "https://github.com/WebAssembly/binaryen";
description = "Compiler infrastructure and toolchain library for WebAssembly, in C++";
platforms = platforms.all;
maintainers = with maintainers; [ asppsa ];
license = licenses.asl20;
};
passthru.tests = {
inherit emscripten;
};
}