depot/third_party/nixpkgs/pkgs/development/interpreters/wasmtime/default.nix
Default email 94427deb9d Project import generated by Copybara.
GitOrigin-RevId: f91ee3065de91a3531329a674a45ddcb3467a650
2023-05-24 16:37:59 +03:00

49 lines
1.7 KiB
Nix

{ rustPlatform, fetchFromGitHub, Security, lib, stdenv }:
rustPlatform.buildRustPackage rec {
pname = "wasmtime";
version = "9.0.0";
src = fetchFromGitHub {
owner = "bytecodealliance";
repo = pname;
rev = "v${version}";
hash = "sha256-9ga7BKJoaw7naX8t4o+zNnWkjIvSII5oVRM0dYMrseo=";
fetchSubmodules = true;
};
cargoHash = "sha256-GkL78aAIGdSlcxeRTIVp1jcXIg1ZtvB2LNIoPEViNcs=";
cargoBuildFlags = [ "--package" "wasmtime-cli" "--package" "wasmtime-c-api" ];
outputs = [ "out" "dev" ];
buildInputs = lib.optionals stdenv.isDarwin [ Security ];
# SIMD tests are only executed on platforms that support all
# required processor features (e.g. SSE3, SSSE3 and SSE4.1 on x86_64):
# https://github.com/bytecodealliance/wasmtime/blob/v9.0.0/cranelift/codegen/src/isa/x64/mod.rs#L220
doCheck = with stdenv.buildPlatform; (isx86_64 -> sse3Support && ssse3Support && sse4_1Support);
cargoTestFlags = ["--package" "wasmtime-runtime"];
postInstall = ''
# move libs from out to dev
install -d -m 0755 $dev/lib
install -m 0644 ''${!outputLib}/lib/* $dev/lib
rm -r ''${!outputLib}/lib
install -d -m0755 $dev/include/wasmtime
install -m0644 $src/crates/c-api/include/*.h $dev/include
install -m0644 $src/crates/c-api/include/wasmtime/*.h $dev/include/wasmtime
install -m0644 $src/crates/c-api/wasm-c-api/include/* $dev/include
'';
meta = with lib; {
description =
"Standalone JIT-style runtime for WebAssembly, using Cranelift";
homepage = "https://github.com/bytecodealliance/wasmtime";
license = licenses.asl20;
maintainers = with maintainers; [ ereslibre matthewbauer ];
platforms = platforms.unix;
};
}