2024-08-21 18:18:11 +00:00
|
|
|
{ lib, rustPlatform, cmake, rustfmt, fetchFromGitHub, Security, stdenv }:
|
2019-04-16 02:22:16 +00:00
|
|
|
|
2020-01-07 16:36:29 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2019-06-09 09:48:14 +00:00
|
|
|
pname = "wasmtime";
|
2024-11-08 06:41:40 +00:00
|
|
|
version = "26.0.1";
|
2019-04-16 02:22:16 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2019-11-25 11:04:40 +00:00
|
|
|
owner = "bytecodealliance";
|
2020-11-01 22:39:49 +00:00
|
|
|
repo = pname;
|
2020-04-14 17:49:12 +00:00
|
|
|
rev = "v${version}";
|
2024-11-08 06:41:40 +00:00
|
|
|
hash = "sha256-Q7f35Y3ZZ7BHLwmdsa0I5gtlNMObscVD/3jKrVetGnA=";
|
2019-04-16 02:22:16 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2023-10-16 16:20:51 +00:00
|
|
|
# Disable cargo-auditable until https://github.com/rust-secure-code/cargo-auditable/issues/124 is solved.
|
|
|
|
auditable = false;
|
2024-11-08 06:41:40 +00:00
|
|
|
cargoHash = "sha256-kaE+LoqnWPZcM9H5FM7SRPRq2J78yrL5zWdV2klVLDU=";
|
2023-05-09 11:29:59 +00:00
|
|
|
cargoBuildFlags = [ "--package" "wasmtime-cli" "--package" "wasmtime-c-api" ];
|
2022-02-20 08:18:36 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
2019-04-16 02:22:16 +00:00
|
|
|
|
2023-05-23 19:42:42 +00:00
|
|
|
buildInputs = lib.optional stdenv.hostPlatform.isDarwin Security;
|
2023-05-22 15:51:14 +00:00
|
|
|
|
2024-05-24 22:12:37 +00:00
|
|
|
# rustfmt is brought into scope to fix the following
|
|
|
|
# warning: cranelift-codegen@0.108.0:
|
|
|
|
# Failed to run `rustfmt` on ISLE-generated code: Os
|
|
|
|
# { code: 2, kind: NotFound, message: "No such file or directory" }
|
2024-08-21 18:18:11 +00:00
|
|
|
nativeBuildInputs = [ cmake rustfmt ];
|
2024-05-24 22:12:37 +00:00
|
|
|
|
|
|
|
doCheck = with stdenv.buildPlatform;
|
|
|
|
# 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
|
|
|
|
(isx86_64 -> sse3Support && ssse3Support && sse4_1Support) &&
|
|
|
|
# The dependency `wasi-preview1-component-adapter` fails to build because of:
|
|
|
|
# error: linker `rust-lld` not found
|
2024-05-24 22:28:13 +00:00
|
|
|
!isAarch64;
|
2020-02-29 11:58:22 +00:00
|
|
|
|
2022-02-20 08:18:36 +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
|
2023-05-29 20:30:29 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
install_name_tool -id \
|
|
|
|
$dev/lib/libwasmtime.dylib \
|
|
|
|
$dev/lib/libwasmtime.dylib
|
2022-02-20 08:18:36 +00:00
|
|
|
'';
|
|
|
|
|
2019-04-16 02:22:16 +00:00
|
|
|
meta = with lib; {
|
2023-05-09 11:29:59 +00:00
|
|
|
description =
|
|
|
|
"Standalone JIT-style runtime for WebAssembly, using Cranelift";
|
2023-05-28 06:31:27 +00:00
|
|
|
homepage = "https://wasmtime.dev/";
|
2019-04-16 02:22:16 +00:00
|
|
|
license = licenses.asl20;
|
2023-08-22 12:33:28 +00:00
|
|
|
mainProgram = "wasmtime";
|
2022-05-23 06:39:29 +00:00
|
|
|
maintainers = with maintainers; [ ereslibre matthewbauer ];
|
2022-04-03 20:15:42 +00:00
|
|
|
platforms = platforms.unix;
|
2023-05-28 06:31:27 +00:00
|
|
|
changelog = "https://github.com/bytecodealliance/wasmtime/blob/v${version}/RELEASES.md";
|
2019-04-16 02:22:16 +00:00
|
|
|
};
|
|
|
|
}
|