Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, cmake, python3, fetchFromGitHub, emscriptenRev ? null, substituteAll }:
2
3let
4 defaultVersion = "91";
5
6 # Map from git revs to SHA256 hashes
7 sha256s = {
8 version_91 = "1qsjqnzc5w9ny9v01bxkdvhh4kgbsia01x5vvac72m075v4mpgs4";
9 "1.39.1" = "0ygm9m5322h4vfpf3j63q32qxk2l26yk62hh7dkb49j51zwl1y3y";
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 patches = stdenv.lib.optional (emscriptenRev != null) (substituteAll {
33 src = ./0001-Get-rid-of-git-dependency.patch;
34 emscriptenv = "1.39.1";
35 });
36
37 nativeBuildInputs = [ cmake python3 ];
38
39 meta = with stdenv.lib; {
40 homepage = https://github.com/WebAssembly/binaryen;
41 description = "Compiler infrastructure and toolchain library for WebAssembly, in C++";
42 platforms = platforms.all;
43 maintainers = with maintainers; [ asppsa ];
44 license = licenses.asl20;
45 };
46}