22 lib ,
33 rustPlatform ,
44 cmake ,
5- rustfmt ,
65 fetchFromGitHub ,
76 Security ,
87 stdenv ,
98} :
10-
11- rustPlatform . buildRustPackage rec {
9+ let
10+ inherit ( stdenv . targetPlatform . rust ) cargoShortTarget ;
11+ in
12+ rustPlatform . buildRustPackage ( finalAttrs : {
1213 pname = "wasmtime" ;
1314 version = "31.0.0" ;
1415
1516 src = fetchFromGitHub {
1617 owner = "bytecodealliance" ;
17- repo = pname ;
18- rev = "v${ version } " ;
18+ repo = "wasmtime" ;
19+ tag = "v${ finalAttrs . version } " ;
1920 hash = "sha256-IQeYmqCXhzWsuufrLKeBI2sw86dXbn7c5DbmcoJTWvo=" ;
2021 fetchSubmodules = true ;
2122 } ;
@@ -37,15 +38,7 @@ rustPlatform.buildRustPackage rec {
3738 ] ;
3839
3940 buildInputs = lib . optional stdenv . hostPlatform . isDarwin Security ;
40-
41- # rustfmt is brought into scope to fix the following
42- 43- # Failed to run `rustfmt` on ISLE-generated code: Os
44- # { code: 2, kind: NotFound, message: "No such file or directory" }
45- nativeBuildInputs = [
46- cmake
47- rustfmt
48- ] ;
41+ nativeBuildInputs = [ cmake ] ;
4942
5043 doCheck =
5144 with stdenv . buildPlatform ;
@@ -65,26 +58,32 @@ rustPlatform.buildRustPackage rec {
6558 install -m 0644 '' ${!outputLib}/lib/* $dev/lib
6659 rm -r '' ${!outputLib}/lib
6760
61+ # copy the build.rs generated c-api headers
6862 install -d -m0755 $dev/include/wasmtime
69- install -m0644 $src/crates/c-api/include/*.h $dev/include
70- install -m0644 $src/crates/c-api/include/wasmtime/*.h $dev/include/wasmtime
63+ # https://github.com/rust-lang/cargo/issues/9661
64+ install -m0644 \
65+ target/${ cargoShortTarget } /release/build/wasmtime-c-api-impl-*/out/include/*.h \
66+ $dev/include
67+ install -m0644 \
68+ target/${ cargoShortTarget } /release/build/wasmtime-c-api-impl-*/out/include/wasmtime/*.h \
69+ $dev/include/wasmtime
7170 ''
7271 + lib . optionalString stdenv . hostPlatform . isDarwin ''
7372 install_name_tool -id \
7473 $dev/lib/libwasmtime.dylib \
7574 $dev/lib/libwasmtime.dylib
7675 '' ;
7776
78- meta = with lib ; {
77+ meta = {
7978 description = "Standalone JIT-style runtime for WebAssembly, using Cranelift" ;
8079 homepage = "https://wasmtime.dev/" ;
81- license = licenses . asl20 ;
80+ license = lib . licenses . asl20 ;
8281 mainProgram = "wasmtime" ;
83- maintainers = with maintainers ; [
82+ maintainers = with lib . maintainers ; [
8483 ereslibre
8584 matthewbauer
8685 ] ;
87- platforms = platforms . unix ;
88- changelog = "https://github.com/bytecodealliance/wasmtime/blob/v${ version } /RELEASES.md" ;
86+ platforms = lib . platforms . unix ;
87+ changelog = "https://github.com/bytecodealliance/wasmtime/blob/v${ finalAttrs . version } /RELEASES.md" ;
8988 } ;
90- }
89+ } )
0 commit comments