summary refs log tree commit diff
path: root/pkgs/development/interpreters/wasmer/default.nix
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2022-11-22 20:05:44 +0800
committerNick Cao <nickcao@nichi.co>2022-11-24 22:04:20 +0800
commitb79697e89b8aeda548ecf5865c42b5488ceb650b (patch)
tree628882553de08236c2e58c955e8aa1f7812a6dc1 /pkgs/development/interpreters/wasmer/default.nix
parentd08a22c7ce80d38547da3b832d19ffe4aee3ba04 (diff)
downloadnixpkgs-b79697e89b8aeda548ecf5865c42b5488ceb650b.tar
nixpkgs-b79697e89b8aeda548ecf5865c42b5488ceb650b.tar.gz
nixpkgs-b79697e89b8aeda548ecf5865c42b5488ceb650b.tar.bz2
nixpkgs-b79697e89b8aeda548ecf5865c42b5488ceb650b.tar.lz
nixpkgs-b79697e89b8aeda548ecf5865c42b5488ceb650b.tar.xz
nixpkgs-b79697e89b8aeda548ecf5865c42b5488ceb650b.tar.zst
nixpkgs-b79697e89b8aeda548ecf5865c42b5488ceb650b.zip
wasmer: 2.3.0 -> 3.0.1
Diffstat (limited to 'pkgs/development/interpreters/wasmer/default.nix')
-rw-r--r--pkgs/development/interpreters/wasmer/default.nix57
1 files changed, 37 insertions, 20 deletions
diff --git a/pkgs/development/interpreters/wasmer/default.nix b/pkgs/development/interpreters/wasmer/default.nix
index b0ab011d38d..d285a148b3d 100644
--- a/pkgs/development/interpreters/wasmer/default.nix
+++ b/pkgs/development/interpreters/wasmer/default.nix
@@ -2,44 +2,61 @@
 , lib
 , rustPlatform
 , fetchFromGitHub
-, cmake
 , llvmPackages
-, pkg-config
+, libffi
+, libxml2
+, CoreFoundation
+, SystemConfiguration
+, Security
+, withLLVM ? !stdenv.isDarwin
+, withSinglepass ? !(stdenv.isDarwin && stdenv.isx86_64)
 }:
 
 rustPlatform.buildRustPackage rec {
   pname = "wasmer";
-  version = "2.3.0";
+  version = "3.0.1";
 
   src = fetchFromGitHub {
     owner = "wasmerio";
     repo = pname;
-    rev = version;
-    sha256 = "sha256-25wWgMNybbsEf/1xmm+8BPcjx8CSW9ZBzxGKT/DbBXw=";
-    fetchSubmodules = true;
+    rev = "v${version}";
+    sha256 = "sha256-os1TvqDTn+WJjX0fREFlNsd8bASdnOOvnCyAkplTVrA=";
   };
 
-  cargoSha256 = "sha256-tswsbijNN5UcSZovVmy66yehcEOpQDGMdRgR/1mkuE8=";
+  cargoSha256 = "sha256-zfGtRoCpTKomsq3xjfMC1VWUGbpb/qjdWNZ8pgwZfMQ=";
 
-  nativeBuildInputs = [ cmake pkg-config ];
+  nativeBuildInputs = [ rustPlatform.bindgenHook ];
 
-  # cranelift+jit works everywhere, see:
-  # https://github.com/wasmerio/wasmer/blob/master/Makefile#L22
-  buildFeatures = [ "cranelift" "jit" ];
-  cargoBuildFlags = [
-    # must target manifest and desired output bin, otherwise output is empty
-    "--manifest-path" "lib/cli/Cargo.toml"
-    "--bin" "wasmer"
+  buildInputs = lib.optionals withLLVM [
+    llvmPackages.llvm
+    libffi
+    libxml2
+  ] ++ lib.optionals stdenv.isDarwin [
+    CoreFoundation
+    SystemConfiguration
+    Security
   ];
 
-  # Can't use test-jit:
-  # error: Package `wasmer-workspace v2.3.0 (/build/source)` does not have the feature `test-jit`
-  checkFeatures = [ "test-cranelift" ];
+  LLVM_SYS_120_PREFIX = lib.optionalString withLLVM llvmPackages.llvm.dev;
 
-  LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
+  # check references to `compiler_features` in Makefile on update
+  buildFeatures = checkFeatures ++ [
+    "webc_runner"
+  ];
+
+  checkFeatures = [
+    "cranelift"
+    "wasmer-artifact-create"
+    "static-artifact-create"
+    "wasmer-artifact-load"
+    "static-artifact-load"
+  ]
+  ++ lib.optional withLLVM "llvm"
+  ++ lib.optional withSinglepass "singlepass";
+
+  cargoBuildFlags = [ "--manifest-path" "lib/cli/Cargo.toml" "--bin" "wasmer" ];
 
   meta = with lib; {
-    broken = stdenv.isDarwin;
     description = "The Universal WebAssembly Runtime";
     longDescription = ''
       Wasmer is a standalone WebAssembly runtime for running WebAssembly outside