diff mbox series

[bug#70146,095/147] gnu: Add rust-wasmtime-18.

Message ID 0627c13a59a7369a23f0d25db92411d6560e33e7.1712070308.git.jean@foundation.xyz
State New
Headers show
Series [bug#70146,001/147] gnu: rust-anyhow-1: Update to 1.0.80. | expand

Commit Message

Jean-Pierre De Jesus Diaz April 2, 2024, 4:04 p.m. UTC
* gnu/packages/patches/rust-wasmtime-18-remove-ittapi.patch: New patch.
* gnu/packages/crates-io.scm (rust-wasmtime-18): New variable.
* gnu/local.mk (dist_patch_DATA): Add rust-wasmtime-18-remove-ittapi.patch.

Change-Id: I359b25ceebdd2abf8b6589c1f715a7fdc5981c39
---
 gnu/local.mk                                  |  1 +
 gnu/packages/crates-io.scm                    | 59 +++++++++++++++++++
 .../rust-wasmtime-18-remove-ittapi.patch      | 46 +++++++++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 gnu/packages/patches/rust-wasmtime-18-remove-ittapi.patch
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f2b480bded..dd505b0654 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2024,6 +2024,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/rust-nettle-disable-vendor.patch		 \
   %D%/packages/patches/rust-rspec-1-remove-clippy.patch	\
   %D%/packages/patches/rust-trash-2-update-windows.patch	\
+  %D%/packages/patches/rust-wasmtime-18-remove-ittapi.patch	\
   %D%/packages/patches/rust-webbrowser-remove-unsupported-os.patch	\
   %D%/packages/patches/rust-wl-clipboard-rs-newer-wl.patch      \
   %D%/packages/patches/rw-igraph-0.10.patch			\
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 9724c4bd07..5cd8e0cd38 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -78571,6 +78571,65 @@  (define-public rust-wasmprinter-0.2
 WebAssembly binary format to the text format.")
     (license license:asl2.0))) ;; With the LLVM exception.
 
+(define-public rust-wasmtime-18
+  (package
+    (name "rust-wasmtime")
+    (version "18.0.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "wasmtime" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0x4p8kwlix5qdixzvwmspz40yvz40dxwqbg282wvrlb35p9df1l1"))
+       (patches
+        (search-patches "rust-wasmtime-18-remove-ittapi.patch"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f ;; use of undeclared crate or module `wasi_common`.
+       #:cargo-inputs
+       (("rust-addr2line" ,rust-addr2line-0.21)
+        ("rust-anyhow" ,rust-anyhow-1)
+        ("rust-async-trait" ,rust-async-trait-0.1)
+        ("rust-bincode" ,rust-bincode-1)
+        ("rust-bumpalo" ,rust-bumpalo-3)
+        ("rust-cfg-if" ,rust-cfg-if-1)
+        ("rust-encoding-rs" ,rust-encoding-rs-0.8)
+        ("rust-fxprof-processed-profile" ,rust-fxprof-processed-profile-0.6)
+        ("rust-gimli" ,rust-gimli-0.28)
+        ("rust-indexmap" ,rust-indexmap-2)
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-log" ,rust-log-0.4)
+        ("rust-object" ,rust-object-0.32)
+        ("rust-once-cell" ,rust-once-cell-1)
+        ("rust-paste" ,rust-paste-1)
+        ("rust-rayon" ,rust-rayon-1)
+        ("rust-rustix" ,rust-rustix-0.38)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-derive" ,rust-serde-derive-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-target-lexicon" ,rust-target-lexicon-0.12)
+        ("rust-wasm-encoder" ,rust-wasm-encoder-0.41)
+        ("rust-wasmparser" ,rust-wasmparser-0.121)
+        ("rust-wasmtime-cache" ,rust-wasmtime-cache-18)
+        ("rust-wasmtime-component-macro" ,rust-wasmtime-component-macro-18)
+        ("rust-wasmtime-component-util" ,rust-wasmtime-component-util-18)
+        ("rust-wasmtime-cranelift" ,rust-wasmtime-cranelift-18)
+        ("rust-wasmtime-environ" ,rust-wasmtime-environ-18)
+        ("rust-wasmtime-fiber" ,rust-wasmtime-fiber-18)
+        ("rust-wasmtime-jit-debug" ,rust-wasmtime-jit-debug-18)
+        ("rust-wasmtime-jit-icache-coherence"
+         ,rust-wasmtime-jit-icache-coherence-18)
+        ("rust-wasmtime-runtime" ,rust-wasmtime-runtime-18)
+        ("rust-wasmtime-winch" ,rust-wasmtime-winch-18)
+        ("rust-wat" ,rust-wat-1)
+        ("rust-windows-sys" ,rust-windows-sys-0.52))
+       #:cargo-development-inputs (("rust-tempfile" ,rust-tempfile-3))))
+    (home-page "https://github.com/bytecodealliance/wasmtime")
+    (synopsis "High-level API to expose the Wasmtime runtime")
+    (description "High-level API to expose the Wasmtime runtime")
+    (license license:asl2.0))) ;; With LLVM exception.
+
 (define-public rust-wasmtime-asm-macros-18
   (package
     (name "rust-wasmtime-asm-macros")
diff --git a/gnu/packages/patches/rust-wasmtime-18-remove-ittapi.patch b/gnu/packages/patches/rust-wasmtime-18-remove-ittapi.patch
new file mode 100644
index 0000000000..b6371dbb87
--- /dev/null
+++ b/gnu/packages/patches/rust-wasmtime-18-remove-ittapi.patch
@@ -0,0 +1,46 @@ 
+SPDX-FileCopyrightText: © 2024 Foundation Devices, Inc. <hello@foundation.xyz>
+SPDX-License-Identifier: Apache-2.0
+
+The Intel ITT API is a stub that doesn't provide functionality and requires a
+closed source library in order to work.
+
+This patch removes the need for the dependency and disables the vtune module.
+Index: wasmtime-18.0.3/Cargo.toml
+===================================================================
+--- wasmtime-18.0.3.orig/Cargo.toml
++++ wasmtime-18.0.3/Cargo.toml
+@@ -215,7 +215,6 @@ pooling-allocator = [
+ profiling = [
+     "dep:fxprof-processed-profile",
+     "dep:wasmtime-jit-debug",
+-    "dep:ittapi",
+ ]
+ runtime = [
+     "dep:wasmtime-runtime",
+@@ -227,10 +226,6 @@ wmemcheck = [
+     "wasmtime-cranelift?/wmemcheck",
+ ]
+ 
+-[target."cfg(all(target_arch = \"x86_64\", not(target_os = \"android\")))".dependencies.ittapi]
+-version = "0.4.0"
+-optional = true
+-
+ [target."cfg(target_os = \"linux\")".dependencies.rustix]
+ version = "0.38.21"
+ features = ["thread"]
+Index: wasmtime-18.0.3/src/profiling_agent.rs
+===================================================================
+--- wasmtime-18.0.3.orig/src/profiling_agent.rs
++++ wasmtime-18.0.3/src/profiling_agent.rs
+@@ -31,8 +31,9 @@ cfg_if::cfg_if! {
+     // Note: VTune support is disabled on windows mingw because the ittapi crate doesn't compile
+     // there; see also https://github.com/bytecodealliance/wasmtime/pull/4003 for rationale.
+     if #[cfg(all(feature = "profiling", target_arch = "x86_64", not(any(target_os = "android", all(target_os = "windows", target_env = "gnu")))))] {
+-        mod vtune;
+-        pub use vtune::new as new_vtune;
++        pub fn new_vtune() -> Result<Box<dyn ProfilingAgent>> {
++            bail!("VTune support disabled at compile time.");
++        }
+     } else {
+         pub fn new_vtune() -> Result<Box<dyn ProfilingAgent>> {
+             if cfg!(feature = "vtune") {