2022-07-14 12:49:19 +00:00
|
|
|
{ lib, stdenv, cmake, python3, fetchFromGitHub, emscripten,
|
|
|
|
gtest, lit, nodejs, filecheck, fetchpatch
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "binaryen";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "111";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "WebAssembly";
|
|
|
|
repo = "binaryen";
|
2020-09-25 04:45:31 +00:00
|
|
|
rev = "version_${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
sha256 = "sha256-wSwLs/YvrH7nswDSbtR6onOMArCdPE2zi6G7oA10U4Y=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
patches = [
|
2023-02-02 18:25:31 +00:00
|
|
|
# https://github.com/WebAssembly/binaryen/pull/5378
|
2022-07-14 12:49:19 +00:00
|
|
|
(fetchpatch {
|
2023-02-02 18:25:31 +00:00
|
|
|
url = "https://github.com/WebAssembly/binaryen/commit/a96fe1a8422140072db7ad7db421378b87898a0d.patch";
|
|
|
|
sha256 = "sha256-Wred1IoRxcQBi0nLBWpiUSgt2ApGoGsq9GkoO3mSS6o=";
|
2022-07-14 12:49:19 +00:00
|
|
|
})
|
2023-02-02 18:25:31 +00:00
|
|
|
# https://github.com/WebAssembly/binaryen/pull/5391
|
2022-09-09 14:08:57 +00:00
|
|
|
(fetchpatch {
|
2023-02-02 18:25:31 +00:00
|
|
|
url = "https://github.com/WebAssembly/binaryen/commit/f92350d2949934c0e0ce4a27ec8b799ac2a85e45.patch";
|
|
|
|
sha256 = "sha256-fBwdGSIPjF2WKNnD8I0/2hnQvqevdk3NS9fAxutkZG0=";
|
2022-09-09 14:08:57 +00:00
|
|
|
})
|
2022-07-14 12:49:19 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
preConfigure = ''
|
|
|
|
if [ $doCheck -eq 1 ]; then
|
|
|
|
sed -i '/googletest/d' third_party/CMakeLists.txt
|
|
|
|
else
|
|
|
|
cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0)
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ gtest lit nodejs filecheck ];
|
2022-07-14 12:49:19 +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-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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;
|
|
|
|
};
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
inherit emscripten;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|