Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / compilers / binaryen / default.nix
blobdcadf054bc30f346bac40ce7042f8764fb59fc33
1 { lib, stdenv, cmake, python3, fetchFromGitHub, emscripten,
2   gtest, lit, nodejs, filecheck
3 }:
5 stdenv.mkDerivation rec {
6   pname = "binaryen";
7   version = "116";
9   src = fetchFromGitHub {
10     owner = "WebAssembly";
11     repo = "binaryen";
12     rev = "version_${version}";
13     hash = "sha256-gMwbWiP+YDCVafQMBWhTuJGWmkYtnhEdn/oofKaUT08=";
14   };
16   nativeBuildInputs = [ cmake python3 ];
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   '';
26   nativeCheckInputs = [ gtest lit nodejs filecheck ];
27   checkPhase = ''
28     LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib python3 ../check.py $tests
29   '';
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.isLinux;
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 ];
47     license = licenses.asl20;
48   };
50   passthru.tests = {
51     inherit emscripten;
52   };