summary refs log tree commit diff
path: root/pkgs/development/compilers/binaryen/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/binaryen/default.nix')
-rw-r--r--pkgs/development/compilers/binaryen/default.nix41
1 files changed, 15 insertions, 26 deletions
diff --git a/pkgs/development/compilers/binaryen/default.nix b/pkgs/development/compilers/binaryen/default.nix
index e9dc939b5ed..6de4e0fb304 100644
--- a/pkgs/development/compilers/binaryen/default.nix
+++ b/pkgs/development/compilers/binaryen/default.nix
@@ -1,38 +1,23 @@
-{ stdenv, cmake, python3, fetchFromGitHub, emscriptenRev ? null, substituteAll }:
-
-let
-  defaultVersion = "95";
-
-  # Map from git revs to SHA256 hashes
-  sha256s = {
-    version_95 = "1w4js9bm5qv5aws8bzz4f0n3ni2l7h4fidkq9v5bldf0zxncy8m3";
-    "1.39.1" = "0ygm9m5322h4vfpf3j63q32qxk2l26yk62hh7dkb49j51zwl1y3y";
-  };
-in
+{ stdenv, cmake, python3, fetchFromGitHub, fetchpatch, emscripten }:
 
 stdenv.mkDerivation rec {
-  version = if emscriptenRev == null
-            then defaultVersion
-            else "emscripten-${emscriptenRev}";
-  rev = if emscriptenRev == null
-        then "version_${version}"
-        else emscriptenRev;
   pname = "binaryen";
+  version = "96";
 
   src = fetchFromGitHub {
     owner = "WebAssembly";
     repo = "binaryen";
-    sha256 =
-      if builtins.hasAttr rev sha256s
-      then builtins.getAttr rev sha256s
-      else null;
-    inherit rev;
+    rev = "version_${version}";
+    sha256 = "1mqpb6yy87aifpbcy0lczi3bp6kddrwi6d0g6lrhjrdxx2kvbdag";
   };
 
-  patches = stdenv.lib.optional (emscriptenRev != null) (substituteAll {
-    src = ./0001-Get-rid-of-git-dependency.patch;
-    emscriptenv = "1.39.1";
-  });
+  patches = [
+    # Adds --minimize-wasm-changes option required by emscripten 2.0.1
+    (fetchpatch {
+      url = "https://patch-diff.githubusercontent.com/raw/WebAssembly/binaryen/pull/3044.patch";
+      sha256 = "1hdbc9h9zhh2d3bl4sqv6v9psfmny715612bwpjdln0ibdvc129s";
+    })
+  ];
 
   nativeBuildInputs = [ cmake python3 ];
 
@@ -43,4 +28,8 @@ stdenv.mkDerivation rec {
     maintainers = with maintainers; [ asppsa ];
     license = licenses.asl20;
   };
+
+  passthru.tests = {
+    inherit emscripten;
+  };
 }