From b79697e89b8aeda548ecf5865c42b5488ceb650b Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Tue, 22 Nov 2022 20:05:44 +0800 Subject: [PATCH] wasmer: 2.3.0 -> 3.0.1 --- .../interpreters/wasmer/default.nix | 57 ++++++++++++------- pkgs/top-level/all-packages.nix | 5 +- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/pkgs/development/interpreters/wasmer/default.nix b/pkgs/development/interpreters/wasmer/default.nix index b0ab011d38d2..d285a148b3d7 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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index aa4255b0fa7a..922fe7fe701c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37506,7 +37506,10 @@ with pkgs; wacomtablet = libsForQt5.callPackage ../tools/misc/wacomtablet { }; - wasmer = callPackage ../development/interpreters/wasmer { }; + wasmer = callPackage ../development/interpreters/wasmer { + llvmPackages = llvmPackages_12; + inherit (darwin.apple_sdk.frameworks) CoreFoundation SystemConfiguration Security; + }; yabasic = callPackage ../development/interpreters/yabasic { };