From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-rust@nongnu.org, "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH 1/2] subprojects: add glib-sys-rs
Date: Wed, 1 Oct 2025 09:49:19 +0200 [thread overview]
Message-ID: <20251001074920.1041619-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20251001074920.1041619-1-pbonzini@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
rust/meson.build | 2 ++
scripts/archive-source.sh | 1 +
subprojects/.gitignore | 1 +
subprojects/glib-sys-0.21-rs.wrap | 7 ++++
.../packagefiles/glib-sys-0.21-rs/meson.build | 33 +++++++++++++++++++
5 files changed, 44 insertions(+)
create mode 100644 subprojects/glib-sys-0.21-rs.wrap
create mode 100644 subprojects/packagefiles/glib-sys-0.21-rs/meson.build
diff --git a/rust/meson.build b/rust/meson.build
index 7fd857215b0..76e10699b37 100644
--- a/rust/meson.build
+++ b/rust/meson.build
@@ -2,12 +2,14 @@ subproject('anyhow-1-rs', required: true)
subproject('bilge-0.2-rs', required: true)
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)
anyhow_rs = dependency('anyhow-1-rs')
bilge_rs = dependency('bilge-0.2-rs')
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')
subproject('proc-macro2-1-rs', required: true)
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index a725dd923dc..8f97b19a088 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -36,6 +36,7 @@ subprojects=(
bilge-impl-0.2-rs
either-1-rs
foreign-0.3-rs
+ glib-sys-0.21-rs
itertools-0.11-rs
keycodemapdb
libc-0.2-rs
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
index 0b5d9634094..c00c8478372 100644
--- a/subprojects/.gitignore
+++ b/subprojects/.gitignore
@@ -13,6 +13,7 @@
/bilge-impl-*
/either-*
/foreign-*
+/glib-sys-*
/itertools-*
/libc-*
/proc-macro-error-*
diff --git a/subprojects/glib-sys-0.21-rs.wrap b/subprojects/glib-sys-0.21-rs.wrap
new file mode 100644
index 00000000000..313ced731ac
--- /dev/null
+++ b/subprojects/glib-sys-0.21-rs.wrap
@@ -0,0 +1,7 @@
+[wrap-file]
+directory = glib-sys-0.21.2
+source_url = https://crates.io/api/v1/crates/glib-sys/0.21.2/download
+source_filename = glib-sys-0.21.2.tar.gz
+source_hash = d09d3d0fddf7239521674e57b0465dfbd844632fec54f059f7f56112e3f927e1
+#method = cargo
+patch_directory = glib-sys-0.21-rs
diff --git a/subprojects/packagefiles/glib-sys-0.21-rs/meson.build b/subprojects/packagefiles/glib-sys-0.21-rs/meson.build
new file mode 100644
index 00000000000..8c5483311ed
--- /dev/null
+++ b/subprojects/packagefiles/glib-sys-0.21-rs/meson.build
@@ -0,0 +1,33 @@
+project('glib-sys-0.21-rs', 'rust',
+ meson_version: '>=1.5.0',
+ version: '0.21.2',
+ license: 'MIT',
+ default_options: [])
+
+subproject('libc-0.2-rs', required: true)
+libc_rs = dependency('libc-0.2-rs')
+
+_glib_sys_rs = static_library(
+ 'glib_sys',
+ 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',
+ '--cfg', 'feature="v2_66"',
+ '--cfg', 'feature="v2_64"',
+ '--cfg', 'feature="v2_62"',
+ '--cfg', 'feature="v2_60"',
+ '--cfg', 'feature="v2_58"',
+ ],
+ # should also link with glib; don't bother doing it here since all
+ # QEMU targets have it
+ dependencies: [libc_rs],
+)
+
+glib_sys_dep = declare_dependency(
+ link_with: _glib_sys_rs,
+)
+
+meson.override_dependency('glib-sys-0.21-rs', glib_sys_dep)
--
2.51.0
next prev parent reply other threads:[~2025-10-01 7:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 7:49 [PATCH 0/2] rust: do not generate GLib bindings Paolo Bonzini
2025-10-01 7:49 ` Paolo Bonzini [this message]
2025-10-01 7:49 ` [PATCH 2/2] rust: use glib-sys Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251001074920.1041619-2-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).