at 23.05-pre 66 lines 1.9 kB view raw
1{ lib, stdenv, cmake, python3, fetchFromGitHub, emscripten, 2 gtest, lit, nodejs, filecheck, fetchpatch 3}: 4 5stdenv.mkDerivation rec { 6 pname = "binaryen"; 7 version = "109"; 8 9 src = fetchFromGitHub { 10 owner = "WebAssembly"; 11 repo = "binaryen"; 12 rev = "version_${version}"; 13 sha256 = "sha256-HMPoiuTvYhTDaBUfSOfh/Dt4FdO9jGqUaFpi92pnscI="; 14 }; 15 16 patches = [ 17 # https://github.com/WebAssembly/binaryen/pull/4321 18 (fetchpatch { 19 url = "https://github.com/WebAssembly/binaryen/commit/93b8849d9f98ef7ed812938ff0b3219819c2be77.patch"; 20 sha256 = "sha256-Duan/B9A+occ5Lj2SbRX793xIfhzHbdYPI5PyTNCZoU="; 21 }) 22 # https://github.com/WebAssembly/binaryen/pull/4913 23 (fetchpatch { 24 url = "https://github.com/WebAssembly/binaryen/commit/b70fe755aa4c90727edfd91dc0a9a51febf0239d.patch"; 25 sha256 = "sha256-kjPLbdiMVQepSJ7J1gK6dRSMI/2SsH39k7W5AMOIrkM="; 26 }) 27 ]; 28 29 nativeBuildInputs = [ cmake python3 ]; 30 31 preConfigure = '' 32 if [ $doCheck -eq 1 ]; then 33 sed -i '/googletest/d' third_party/CMakeLists.txt 34 else 35 cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0) 36 fi 37 ''; 38 39 checkInputs = [ gtest lit nodejs filecheck ]; 40 checkPhase = '' 41 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib python3 ../check.py $tests 42 ''; 43 44 tests = [ 45 "version" "wasm-opt" "wasm-dis" 46 "crash" "dylink" "ctor-eval" 47 "wasm-metadce" "wasm-reduce" "spec" 48 "lld" "wasm2js" "validator" 49 "example" "unit" 50 # "binaryenjs" "binaryenjs_wasm" # not building this 51 "lit" "gtest" 52 ]; 53 doCheck = stdenv.isLinux; 54 55 meta = with lib; { 56 homepage = "https://github.com/WebAssembly/binaryen"; 57 description = "Compiler infrastructure and toolchain library for WebAssembly, in C++"; 58 platforms = platforms.all; 59 maintainers = with maintainers; [ asppsa ]; 60 license = licenses.asl20; 61 }; 62 63 passthru.tests = { 64 inherit emscripten; 65 }; 66}