2022-05-30 11:02:20 +00:00
|
|
|
{ lib, stdenv, cmake, python3, fetchFromGitHub, emscripten,
|
2023-03-10 04:20:00 +00:00
|
|
|
gtest, lit, nodejs, filecheck
|
2022-05-30 11:02:20 +00:00
|
|
|
}:
|
2017-06-04 03:49:46 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "binaryen";
|
2023-07-05 19:17:31 +00:00
|
|
|
version = "114";
|
2017-06-04 03:49:46 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "WebAssembly";
|
|
|
|
repo = "binaryen";
|
2020-08-28 18:46:26 +00:00
|
|
|
rev = "version_${version}";
|
2023-07-05 19:17:31 +00:00
|
|
|
hash = "sha256-bzHNIQy0AN8mIFGG+638p/MBSqlkWuaOzKGSsMDAPH4=";
|
2017-06-04 03:49:46 +00:00
|
|
|
};
|
|
|
|
|
2020-03-14 01:00:27 +00:00
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
2017-06-04 03:49:46 +00:00
|
|
|
|
2022-05-30 11:02:20 +00:00
|
|
|
preConfigure = ''
|
|
|
|
if [ $doCheck -eq 1 ]; then
|
|
|
|
sed -i '/googletest/d' third_party/CMakeLists.txt
|
|
|
|
else
|
|
|
|
cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0)
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = [ gtest lit nodejs filecheck ];
|
2022-05-30 11:02:20 +00:00
|
|
|
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;
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/WebAssembly/binaryen";
|
2017-06-04 03:49:46 +00:00
|
|
|
description = "Compiler infrastructure and toolchain library for WebAssembly, in C++";
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ asppsa ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
2020-08-29 09:27:35 +00:00
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
inherit emscripten;
|
|
|
|
};
|
2017-06-04 03:49:46 +00:00
|
|
|
}
|