1{ stdenv, cmake, python, fetchFromGitHub, emscriptenRev ? null }:
2
3let
4 defaultVersion = "89";
5
6 # Map from git revs to SHA256 hashes
7 sha256s = {
8 version_89 = "0rh1dq33ilq54szfgi1ajaiaj7rbylai02rhp9zm9vpwp0rw8mij";
9 "1.38.28" = "172s7y5f38736ic8ri3mnbdqcrkadd40a26cxcfwbscc53phl11v";
10 };
11in
12
13stdenv.mkDerivation rec {
14 version = if emscriptenRev == null
15 then defaultVersion
16 else "emscripten-${emscriptenRev}";
17 rev = if emscriptenRev == null
18 then "version_${version}"
19 else emscriptenRev;
20 pname = "binaryen";
21
22 src = fetchFromGitHub {
23 owner = "WebAssembly";
24 repo = "binaryen";
25 sha256 =
26 if builtins.hasAttr rev sha256s
27 then builtins.getAttr rev sha256s
28 else null;
29 inherit rev;
30 };
31
32 nativeBuildInputs = [ cmake python ];
33
34 meta = with stdenv.lib; {
35 homepage = https://github.com/WebAssembly/binaryen;
36 description = "Compiler infrastructure and toolchain library for WebAssembly, in C++";
37 platforms = platforms.all;
38 maintainers = with maintainers; [ asppsa ];
39 license = licenses.asl20;
40 };
41}