about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/binaryen/default.nix
blob: 651c88704da3773fe7a17909c76a2168562d0024 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ stdenv, cmake, python3, fetchFromGitHub, emscriptenRev ? null, substituteAll }:

let
  defaultVersion = "94";

  # Map from git revs to SHA256 hashes
  sha256s = {
    version_94 = "1wk20fhyppb2ljni7ifqnsx9kl1kcl6c0svc0qljf0bs6rvr9qdm";
    "1.39.1" = "0ygm9m5322h4vfpf3j63q32qxk2l26yk62hh7dkb49j51zwl1y3y";
  };
in

stdenv.mkDerivation rec {
  version = if emscriptenRev == null
            then defaultVersion
            else "emscripten-${emscriptenRev}";
  rev = if emscriptenRev == null
        then "version_${version}"
        else emscriptenRev;
  pname = "binaryen";

  src = fetchFromGitHub {
    owner = "WebAssembly";
    repo = "binaryen";
    sha256 =
      if builtins.hasAttr rev sha256s
      then builtins.getAttr rev sha256s
      else null;
    inherit rev;
  };

  patches = stdenv.lib.optional (emscriptenRev != null) (substituteAll {
    src = ./0001-Get-rid-of-git-dependency.patch;
    emscriptenv = "1.39.1";
  });

  nativeBuildInputs = [ cmake python3 ];

  meta = with stdenv.lib; {
    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;
  };
}