[PATCH v2 3/4] subprojects: add probe crate

Stefan Hajnoczi posted 4 patches 15 hours ago
Maintainers: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Mads Ynddal <mads@ynddal.dk>
[PATCH v2 3/4] subprojects: add probe crate
Posted by Stefan Hajnoczi 15 hours ago
The probe crate (https://crates.io/crates/probe) provides a probe!()
macro that defines SystemTap SDT probes on Linux hosts or does nothing
on other host OSes.

This crate will be used to implement DTrace support for Rust.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 rust/meson.build                              |  2 ++
 scripts/archive-source.sh                     |  1 +
 scripts/make-release                          |  2 +-
 subprojects/.gitignore                        |  1 +
 .../packagefiles/probe-0.5-rs/meson.build     | 22 +++++++++++++++++++
 subprojects/probe-0.5-rs.wrap                 |  7 ++++++
 6 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 subprojects/packagefiles/probe-0.5-rs/meson.build
 create mode 100644 subprojects/probe-0.5-rs.wrap

diff --git a/rust/meson.build b/rust/meson.build
index 76e10699b3..afbeeeb47a 100644
--- a/rust/meson.build
+++ b/rust/meson.build
@@ -4,6 +4,7 @@ subproject('bilge-impl-0.2-rs', required: true)
 subproject('foreign-0.3-rs', required: true)
 subproject('glib-sys-0.21-rs', required: true)
 subproject('libc-0.2-rs', required: true)
+subproject('probe-0.5-rs', required: true)
 
 anyhow_rs = dependency('anyhow-1-rs')
 bilge_rs = dependency('bilge-0.2-rs')
@@ -11,6 +12,7 @@ bilge_impl_rs = dependency('bilge-impl-0.2-rs')
 foreign_rs = dependency('foreign-0.3-rs')
 glib_sys_rs = dependency('glib-sys-0.21-rs')
 libc_rs = dependency('libc-0.2-rs')
+probe_rs = dependency('probe-0.5-rs')
 
 subproject('proc-macro2-1-rs', required: true)
 subproject('quote-1-rs', required: true)
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index 8f97b19a08..a37acab524 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -41,6 +41,7 @@ subprojects=(
   keycodemapdb
   libc-0.2-rs
   libvfio-user
+  probe-0.5-rs
   proc-macro-error-1-rs
   proc-macro-error-attr-1-rs
   proc-macro2-1-rs
diff --git a/scripts/make-release b/scripts/make-release
index bc1b43caa2..5f54b0e793 100755
--- a/scripts/make-release
+++ b/scripts/make-release
@@ -42,7 +42,7 @@ fi
 SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3
   berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs attrs-0.2-rs bilge-0.2-rs
   bilge-impl-0.2-rs either-1-rs foreign-0.3-rs itertools-0.11-rs
-  libc-0.2-rs proc-macro2-1-rs
+  libc-0.2-rs probe-0.5-rs proc-macro2-1-rs
   proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
   syn-2-rs unicode-ident-1-rs"
 
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
index c00c847837..011ce4dc3b 100644
--- a/subprojects/.gitignore
+++ b/subprojects/.gitignore
@@ -16,6 +16,7 @@
 /glib-sys-*
 /itertools-*
 /libc-*
+/probe-*
 /proc-macro-error-*
 /proc-macro-error-attr-*
 /proc-macro*
diff --git a/subprojects/packagefiles/probe-0.5-rs/meson.build b/subprojects/packagefiles/probe-0.5-rs/meson.build
new file mode 100644
index 0000000000..e6ea69533b
--- /dev/null
+++ b/subprojects/packagefiles/probe-0.5-rs/meson.build
@@ -0,0 +1,22 @@
+project('probe-0.5-rs', 'rust',
+  meson_version: '>=1.5.0',
+  version: '0.5.2',
+  license: 'Apache-2.0 OR MIT',
+  default_options: [])
+
+_probe_rs = static_library(
+  'probe',
+  files('src/lib.rs'),
+  gnu_symbol_visibility: 'hidden',
+  override_options: ['rust_std=2021', 'build.rust_std=2021'],
+  rust_abi: 'rust',
+  rust_args: [
+    '--cap-lints', 'allow',
+  ],
+)
+
+probe_deps = declare_dependency(
+  link_with: _probe_rs,
+)
+
+meson.override_dependency('probe-0.5-rs', probe_deps)
diff --git a/subprojects/probe-0.5-rs.wrap b/subprojects/probe-0.5-rs.wrap
new file mode 100644
index 0000000000..73229ee1c2
--- /dev/null
+++ b/subprojects/probe-0.5-rs.wrap
@@ -0,0 +1,7 @@
+[wrap-file]
+directory = probe-0.5.2
+source_url = https://crates.io/api/v1/crates/probe/0.5.2/download
+source_filename = probe-0.5.2.tar.gz
+source_hash = 136558b6e1ebaecc92755d0ffaf9421f519531bed30cc2ad23b22cb00965cc5e
+#method = cargo
+patch_directory = probe-0.5-rs
-- 
2.51.1