2023-05-24 13:37:59 +00:00
|
|
|
{ rustPlatform, fetchFromGitHub, Security, lib, stdenv }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "wasmtime";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "17.0.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bytecodealliance";
|
2020-11-03 02:18:15 +00:00
|
|
|
repo = pname;
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "v${version}";
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-HGs82LMDJJZl1bPaFsVetpMR7ytBgGmOkH1tt7xmUMA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
# Disable cargo-auditable until https://github.com/rust-secure-code/cargo-auditable/issues/124 is solved.
|
|
|
|
auditable = false;
|
2024-02-07 01:22:34 +00:00
|
|
|
cargoHash = "sha256-bNGpBgAhLN4s90saQqIgFb6hXtfC9NIjOfy+hvkRJ6E=";
|
2023-05-24 13:37:59 +00:00
|
|
|
cargoBuildFlags = [ "--package" "wasmtime-cli" "--package" "wasmtime-c-api" ];
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs = lib.optional stdenv.isDarwin Security;
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
# 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"];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
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
|
2023-07-15 17:15:38 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
install_name_tool -id \
|
|
|
|
$dev/lib/libwasmtime.dylib \
|
|
|
|
$dev/lib/libwasmtime.dylib
|
2022-09-09 14:08:57 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2023-05-24 13:37:59 +00:00
|
|
|
description =
|
|
|
|
"Standalone JIT-style runtime for WebAssembly, using Cranelift";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://wasmtime.dev/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2023-10-09 19:29:22 +00:00
|
|
|
mainProgram = "wasmtime";
|
2022-06-26 10:26:21 +00:00
|
|
|
maintainers = with maintainers; [ ereslibre matthewbauer ];
|
2022-06-16 17:23:12 +00:00
|
|
|
platforms = platforms.unix;
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/bytecodealliance/wasmtime/blob/v${version}/RELEASES.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|