|
1 | 1 | { lib, stdenv, cmake, python3, fetchFromGitHub, emscripten, |
2 | 2 | gtest, lit, nodejs, filecheck |
3 | 3 | }: |
4 | | - |
5 | | -stdenv.mkDerivation rec { |
6 | | - pname = "binaryen"; |
7 | | - version = "118"; |
8 | | - |
9 | | - src = fetchFromGitHub { |
| 4 | +let |
| 5 | + testsuite = fetchFromGitHub { |
10 | 6 | owner = "WebAssembly"; |
11 | | - repo = "binaryen"; |
12 | | - rev = "version_${version}"; |
13 | | - hash = "sha256-akMW3S2/qUyLK8F77EtnaXPDXvIMpkGfNB2jOD6hQho="; |
14 | | - }; |
15 | | - |
16 | | - nativeBuildInputs = [ cmake python3 ]; |
17 | | - |
18 | | - preConfigure = '' |
19 | | - if [ $doCheck -eq 1 ]; then |
20 | | - sed -i '/googletest/d' third_party/CMakeLists.txt |
21 | | - else |
22 | | - cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0) |
23 | | - fi |
24 | | - ''; |
25 | | - |
26 | | - nativeCheckInputs = [ gtest lit nodejs filecheck ]; |
27 | | - checkPhase = '' |
28 | | - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib python3 ../check.py $tests |
29 | | - ''; |
30 | | - |
31 | | - tests = [ |
32 | | - "version" "wasm-opt" "wasm-dis" |
33 | | - "crash" "dylink" "ctor-eval" |
34 | | - "wasm-metadce" "wasm-reduce" "spec" |
35 | | - "lld" "wasm2js" "validator" |
36 | | - "example" "unit" |
37 | | - # "binaryenjs" "binaryenjs_wasm" # not building this |
38 | | - "lit" "gtest" |
39 | | - ]; |
40 | | - doCheck = stdenv.hostPlatform.isLinux; |
41 | | - |
42 | | - meta = with lib; { |
43 | | - homepage = "https://github.com/WebAssembly/binaryen"; |
44 | | - description = "Compiler infrastructure and toolchain library for WebAssembly, in C++"; |
45 | | - platforms = platforms.all; |
46 | | - maintainers = with maintainers; [ asppsa willcohen ]; |
47 | | - license = licenses.asl20; |
48 | | - }; |
49 | | - |
50 | | - passthru.tests = { |
51 | | - inherit emscripten; |
| 7 | + repo = "testsuite"; |
| 8 | + rev = "e05365077e13a1d86ffe77acfb1a835b7aa78422"; |
| 9 | + hash = "sha256-yvZ5AZTPUA6nsD3xpFC0VLthiu2CxVto66RTXBXXeJM="; |
52 | 10 | }; |
53 | | -} |
| 11 | +in |
| 12 | + stdenv.mkDerivation rec { |
| 13 | + pname = "binaryen"; |
| 14 | + version = "119"; |
| 15 | + |
| 16 | + src = fetchFromGitHub { |
| 17 | + owner = "WebAssembly"; |
| 18 | + repo = "binaryen"; |
| 19 | + rev = "version_${version}"; |
| 20 | + hash = "sha256-JYXtN3CW4qm/nnjGRvv3GxQ0x9O9wHtNYQLqHIYTTOA="; |
| 21 | + }; |
| 22 | + |
| 23 | + nativeBuildInputs = [ cmake python3 ]; |
| 24 | + |
| 25 | + preConfigure = '' |
| 26 | + if [ $doCheck -eq 1 ]; then |
| 27 | + sed -i '/googletest/d' third_party/CMakeLists.txt |
| 28 | + rmdir test/spec/testsuite |
| 29 | + ln -s ${testsuite} test/spec/testsuite |
| 30 | + else |
| 31 | + cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0) |
| 32 | + fi |
| 33 | + ''; |
| 34 | + |
| 35 | + nativeCheckInputs = [ gtest lit nodejs filecheck ]; |
| 36 | + checkPhase = '' |
| 37 | + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib python3 ../check.py $tests |
| 38 | + ''; |
| 39 | + |
| 40 | + tests = [ |
| 41 | + "version" "wasm-opt" "wasm-dis" |
| 42 | + "crash" "dylink" "ctor-eval" |
| 43 | + "wasm-metadce" "wasm-reduce" "spec" |
| 44 | + "lld" "wasm2js" "validator" |
| 45 | + "example" "unit" |
| 46 | + # "binaryenjs" "binaryenjs_wasm" # not building this |
| 47 | + "lit" "gtest" |
| 48 | + ]; |
| 49 | + doCheck = stdenv.isLinux; |
| 50 | + |
| 51 | + meta = with lib; { |
| 52 | + homepage = "https://github.com/WebAssembly/binaryen"; |
| 53 | + description = "Compiler infrastructure and toolchain library for WebAssembly, in C++"; |
| 54 | + platforms = platforms.all; |
| 55 | + maintainers = with maintainers; [ asppsa willcohen ]; |
| 56 | + license = licenses.asl20; |
| 57 | + }; |
| 58 | + passthru.tests = { |
| 59 | + inherit emscripten; |
| 60 | + }; |
| 61 | + } |
0 commit comments