mirror of
https://github.com/qemu/qemu.git
synced 2026-02-04 02:24:51 +00:00
rust: use glib-sys
Don't generate FFI for glib, rely on glib-sys crate. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
4c18783a88
commit
9c40c1ff97
@@ -169,7 +169,7 @@ struct CPUClass {
|
||||
vaddr (*gdb_adjust_breakpoint)(CPUState *cpu, vaddr addr);
|
||||
|
||||
const char *gdb_core_xml_file;
|
||||
const gchar * (*gdb_arch_name)(CPUState *cpu);
|
||||
const char * (*gdb_arch_name)(CPUState *cpu);
|
||||
const char * (*gdb_get_core_xml_file)(CPUState *cpu);
|
||||
|
||||
void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
|
||||
|
||||
@@ -4239,6 +4239,7 @@ if have_rust
|
||||
'--no-prepend-enum-name',
|
||||
'--allowlist-file', meson.project_source_root() + '/include/.*',
|
||||
'--allowlist-file', meson.project_build_root() + '/.*',
|
||||
'--blocklist-file', glib_pc.get_variable('includedir') + '/glib-2.0/.*',
|
||||
]
|
||||
if not rustfmt.found()
|
||||
if bindgen.version().version_compare('<0.65.0')
|
||||
|
||||
180
rust/Cargo.lock
generated
180
rust/Cargo.lock
generated
@@ -58,15 +58,27 @@ dependencies = [
|
||||
name = "bql"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"migration",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-expr"
|
||||
version = "0.20.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a2c5f3bf25ec225351aa1c8e230d04d880d3bd89dea133537dafad4ae291e5c"
|
||||
dependencies = [
|
||||
"smallvec",
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chardev"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"migration",
|
||||
"qom",
|
||||
"util",
|
||||
@@ -86,6 +98,12 @@ version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "foreign"
|
||||
version = "0.3.1"
|
||||
@@ -95,6 +113,28 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.21.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d09d3d0fddf7239521674e57b0465dfbd844632fec54f059f7f56112e3f927e1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hpet"
|
||||
version = "0.1.0"
|
||||
@@ -115,6 +155,7 @@ dependencies = [
|
||||
"bql",
|
||||
"chardev",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"migration",
|
||||
"qemu_macros",
|
||||
"qom",
|
||||
@@ -122,6 +163,16 @@ dependencies = [
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.11.0"
|
||||
@@ -137,14 +188,27 @@ version = "0.2.162"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||
|
||||
[[package]]
|
||||
name = "migration"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"common",
|
||||
"glib-sys",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||
|
||||
[[package]]
|
||||
name = "pl011"
|
||||
version = "0.1.0"
|
||||
@@ -155,6 +219,7 @@ dependencies = [
|
||||
"bql",
|
||||
"chardev",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"hwcore",
|
||||
"migration",
|
||||
"qom",
|
||||
@@ -211,6 +276,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"migration",
|
||||
"qemu_macros",
|
||||
"util",
|
||||
@@ -225,6 +291,50 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.226"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.226"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.226"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.104"
|
||||
@@ -241,10 +351,30 @@ name = "system"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"common",
|
||||
"glib-sys",
|
||||
"qom",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "7.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4be53aa0cba896d2dc615bd42bbc130acdcffa239e0a2d965ea5b3b2a86ffdb"
|
||||
dependencies = [
|
||||
"cfg-expr",
|
||||
"heck",
|
||||
"pkg-config",
|
||||
"toml",
|
||||
"version-compare",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
||||
|
||||
[[package]]
|
||||
name = "tests"
|
||||
version = "0.1.0"
|
||||
@@ -259,6 +389,40 @@ dependencies = [
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trace"
|
||||
version = "0.1.0"
|
||||
@@ -279,11 +443,27 @@ dependencies = [
|
||||
"anyhow",
|
||||
"common",
|
||||
"foreign",
|
||||
"glib-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "version-compare"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
@@ -29,6 +29,7 @@ authors = ["The QEMU Project Developers <qemu-devel@nongnu.org>"]
|
||||
anyhow = "~1.0"
|
||||
foreign = "~0.3.1"
|
||||
libc = "0.2.162"
|
||||
glib-sys = { version = "0.21.2", features = ["v2_66"] }
|
||||
|
||||
[workspace.lints.rust]
|
||||
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(MESON)'] }
|
||||
|
||||
@@ -14,6 +14,7 @@ rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
migration = { path = "../migration" }
|
||||
glib-sys.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["debug_cell"]
|
||||
|
||||
@@ -38,6 +38,7 @@ _bql_rs = static_library(
|
||||
rust_abi: 'rust',
|
||||
rust_args: _bql_cfg,
|
||||
link_with: [_migration_rs],
|
||||
dependencies: [glib_sys_rs],
|
||||
)
|
||||
|
||||
bql_rs = declare_dependency(link_with: [_bql_rs],
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
use glib_sys::{
|
||||
guint, GArray, GHashTable, GHashTableIter, GList, GPollFD, GPtrArray, GQueue, GSList, GSource,
|
||||
};
|
||||
|
||||
#[cfg(MESON)]
|
||||
include!("bindings.inc.rs");
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
glib-sys = { workspace = true }
|
||||
common = { path = "../common" }
|
||||
bql = { path = "../bql" }
|
||||
migration = { path = "../migration" }
|
||||
|
||||
@@ -36,7 +36,7 @@ _chardev_rs = static_library(
|
||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_abi: 'rust',
|
||||
link_with: [_bql_rs, _migration_rs, _qom_rs, _util_rs],
|
||||
dependencies: [common_rs, qemu_macros],
|
||||
dependencies: [glib_sys_rs, common_rs, qemu_macros],
|
||||
)
|
||||
|
||||
chardev_rs = declare_dependency(link_with: [_chardev_rs], dependencies: [chardev, qemuutil])
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
)]
|
||||
|
||||
use common::Zeroable;
|
||||
use glib_sys::{
|
||||
gboolean, guint, GArray, GHashTable, GHashTableIter, GIOCondition, GList, GMainContext,
|
||||
GPollFD, GPtrArray, GQueue, GSList, GSource, GSourceFunc,
|
||||
};
|
||||
|
||||
#[cfg(MESON)]
|
||||
include!("bindings.inc.rs");
|
||||
|
||||
@@ -13,6 +13,7 @@ repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
glib-sys.workspace = true
|
||||
bilge = { version = "0.2.0" }
|
||||
bilge-impl = { version = "0.2.0" }
|
||||
bits = { path = "../../../bits" }
|
||||
|
||||
@@ -33,6 +33,7 @@ _libpl011_rs = static_library(
|
||||
bilge_impl_rs,
|
||||
bits_rs,
|
||||
common_rs,
|
||||
glib_sys_rs,
|
||||
util_rs,
|
||||
migration_rs,
|
||||
bql_rs,
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
|
||||
//! `bindgen`-generated declarations.
|
||||
|
||||
use glib_sys::{
|
||||
gboolean, guint, GArray, GByteArray, GHashTable, GHashTableIter, GIOCondition, GList,
|
||||
GMainContext, GPollFD, GPtrArray, GQueue, GSList, GSource, GSourceFunc, GString,
|
||||
};
|
||||
|
||||
#[cfg(MESON)]
|
||||
include!("bindings.inc.rs");
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
glib-sys.workspace = true
|
||||
qemu_macros = { path = "../../qemu-macros" }
|
||||
common = { path = "../../common" }
|
||||
bql = { path = "../../bql" }
|
||||
|
||||
@@ -59,7 +59,7 @@ _hwcore_rs = static_library(
|
||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_abi: 'rust',
|
||||
link_with: [_bql_rs, _chardev_rs, _migration_rs, _qom_rs, _system_rs, _util_rs],
|
||||
dependencies: [qemu_macros, common_rs],
|
||||
dependencies: [glib_sys_rs, qemu_macros, common_rs],
|
||||
)
|
||||
|
||||
hwcore_rs = declare_dependency(link_with: [_hwcore_rs],
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
use chardev::bindings::Chardev;
|
||||
use common::Zeroable;
|
||||
use glib_sys::{
|
||||
GArray, GByteArray, GHashTable, GHashTableIter, GList, GPtrArray, GQueue, GSList, GString,
|
||||
};
|
||||
use migration::bindings::VMStateDescription;
|
||||
use qom::bindings::ObjectClass;
|
||||
use system::bindings::MemoryRegion;
|
||||
|
||||
@@ -15,6 +15,7 @@ rust-version.workspace = true
|
||||
[dependencies]
|
||||
common = { path = "../common" }
|
||||
util = { path = "../util" }
|
||||
glib-sys.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -38,7 +38,7 @@ _migration_rs = static_library(
|
||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_abi: 'rust',
|
||||
link_with: [_util_rs],
|
||||
dependencies: [common_rs],
|
||||
dependencies: [common_rs, glib_sys_rs],
|
||||
)
|
||||
|
||||
migration_rs = declare_dependency(link_with: [_migration_rs],
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
)]
|
||||
|
||||
use common::Zeroable;
|
||||
use glib_sys::{GHashTable, GHashTableIter, GList, GPtrArray, GQueue, GSList};
|
||||
|
||||
#[cfg(MESON)]
|
||||
include!("bindings.inc.rs");
|
||||
|
||||
@@ -18,6 +18,7 @@ bql = { path = "../bql" }
|
||||
migration = { path = "../migration" }
|
||||
qemu_macros = { path = "../qemu-macros" }
|
||||
util = { path = "../util" }
|
||||
glib-sys.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -29,7 +29,7 @@ _qom_rs = static_library(
|
||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_abi: 'rust',
|
||||
link_with: [_bql_rs, _migration_rs],
|
||||
dependencies: [common_rs, qemu_macros],
|
||||
dependencies: [common_rs, glib_sys_rs, qemu_macros],
|
||||
)
|
||||
|
||||
qom_rs = declare_dependency(link_with: [_qom_rs], dependencies: [qemu_macros, qom])
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
use glib_sys::{GHashTable, GHashTableIter, GList, GPtrArray, GQueue, GSList};
|
||||
|
||||
#[cfg(MESON)]
|
||||
include!("bindings.inc.rs");
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ rust-version.workspace = true
|
||||
common = { path = "../common" }
|
||||
qom = { path = "../qom" }
|
||||
util = { path = "../util" }
|
||||
glib-sys.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -36,7 +36,7 @@ _system_rs = static_library(
|
||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_abi: 'rust',
|
||||
link_with: [_bql_rs, _migration_rs, _qom_rs, _util_rs],
|
||||
dependencies: [common_rs, qemu_macros],
|
||||
dependencies: [glib_sys_rs, common_rs, qemu_macros],
|
||||
)
|
||||
|
||||
system_rs = declare_dependency(link_with: [_system_rs],
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
)]
|
||||
|
||||
use common::Zeroable;
|
||||
use glib_sys::{
|
||||
guint, GArray, GByteArray, GHashTable, GHashTableIter, GList, GPollFD, GPtrArray, GQueue,
|
||||
GSList, GString,
|
||||
};
|
||||
|
||||
#[cfg(MESON)]
|
||||
include!("bindings.inc.rs");
|
||||
|
||||
@@ -15,6 +15,7 @@ rust-version.workspace = true
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
foreign = { workspace = true }
|
||||
glib-sys = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
common = { path = "../common" }
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ _util_rs = static_library(
|
||||
),
|
||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_abi: 'rust',
|
||||
dependencies: [anyhow_rs, libc_rs, foreign_rs, common_rs, qom, qemuutil],
|
||||
dependencies: [anyhow_rs, libc_rs, foreign_rs, glib_sys_rs, common_rs, qom, qemuutil],
|
||||
)
|
||||
|
||||
util_rs = declare_dependency(link_with: [_util_rs], dependencies: [qemuutil, qom])
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
use glib_sys::{guint, GList, GPollFD, GQueue, GSList, GString};
|
||||
|
||||
#[cfg(MESON)]
|
||||
include!("bindings.inc.rs");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user