at master 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 cmake, 5 python3, 6 fetchFromGitHub, 7 emscripten, 8 gtest, 9 lit, 10 nodejs, 11 filecheck, 12}: 13let 14 testsuite = fetchFromGitHub { 15 owner = "WebAssembly"; 16 repo = "testsuite"; 17 rev = "e05365077e13a1d86ffe77acfb1a835b7aa78422"; 18 hash = "sha256-yvZ5AZTPUA6nsD3xpFC0VLthiu2CxVto66RTXBXXeJM="; 19 }; 20in 21stdenv.mkDerivation rec { 22 pname = "binaryen"; 23 version = "124"; 24 25 src = fetchFromGitHub { 26 owner = "WebAssembly"; 27 repo = "binaryen"; 28 rev = "version_${version}"; 29 hash = "sha256-tkvO0gNESliRV6FOpXDQd7ZKujGe6q1mGX5V+twcE1o="; 30 }; 31 32 nativeBuildInputs = [ 33 cmake 34 python3 35 ]; 36 37 strictDeps = true; 38 39 preConfigure = '' 40 if [ $doCheck -eq 1 ]; then 41 sed -i '/gtest/d' third_party/CMakeLists.txt 42 rmdir test/spec/testsuite 43 ln -s ${testsuite} test/spec/testsuite 44 else 45 cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0) 46 fi 47 ''; 48 49 nativeCheckInputs = [ 50 lit 51 nodejs 52 filecheck 53 ]; 54 checkInputs = [ gtest ]; 55 checkPhase = '' 56 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib python3 ../check.py $tests 57 ''; 58 59 tests = [ 60 "version" 61 "wasm-opt" 62 "wasm-dis" 63 "crash" 64 "dylink" 65 "ctor-eval" 66 "wasm-metadce" 67 "wasm-reduce" 68 "spec" 69 "lld" 70 "wasm2js" 71 # "unit" # fails on test.unit.test_cluster_fuzz.ClusterFuzz 72 # "binaryenjs" "binaryenjs_wasm" # not building this 73 # "lit" # fails on d8/fuzz_shell* 74 "gtest" 75 ] 76 ++ lib.optionals stdenv.hostPlatform.isLinux [ 77 "example" 78 "validator" 79 ]; 80 81 doCheck = (stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin); 82 83 meta = with lib; { 84 homepage = "https://github.com/WebAssembly/binaryen"; 85 description = "Compiler infrastructure and toolchain library for WebAssembly, in C++"; 86 platforms = platforms.all; 87 maintainers = with maintainers; [ 88 asppsa 89 willcohen 90 ]; 91 license = licenses.asl20; 92 }; 93 passthru.tests = { inherit emscripten; }; 94}