mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-29 13:23:54 -06:00
subprojects: add the foreign crate
This is a cleaned up and separated version of the patches at https://lore.kernel.org/all/20240701145853.1394967-4-pbonzini@redhat.com/ https://lore.kernel.org/all/20240701145853.1394967-5-pbonzini@redhat.com/ Its first user will be the Error bindings; for example a QEMU Error ** can be converted to a Rust Option using unsafe { Option::<Error>::from_foreign(c_error) } Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a95ad49bbf
commit
bfe0f6b02a
7 changed files with 41 additions and 3 deletions
|
@ -1,11 +1,13 @@
|
||||||
subproject('anyhow-1-rs', required: true)
|
subproject('anyhow-1-rs', required: true)
|
||||||
subproject('bilge-0.2-rs', required: true)
|
subproject('bilge-0.2-rs', required: true)
|
||||||
subproject('bilge-impl-0.2-rs', required: true)
|
subproject('bilge-impl-0.2-rs', required: true)
|
||||||
|
subproject('foreign-0.3-rs', required: true)
|
||||||
subproject('libc-0.2-rs', required: true)
|
subproject('libc-0.2-rs', required: true)
|
||||||
|
|
||||||
anyhow_rs = dependency('anyhow-1-rs')
|
anyhow_rs = dependency('anyhow-1-rs')
|
||||||
bilge_rs = dependency('bilge-0.2-rs')
|
bilge_rs = dependency('bilge-0.2-rs')
|
||||||
bilge_impl_rs = dependency('bilge-impl-0.2-rs')
|
bilge_impl_rs = dependency('bilge-impl-0.2-rs')
|
||||||
|
foreign_rs = dependency('foreign-0.3-rs')
|
||||||
libc_rs = dependency('libc-0.2-rs')
|
libc_rs = dependency('libc-0.2-rs')
|
||||||
|
|
||||||
subproject('proc-macro2-1-rs', required: true)
|
subproject('proc-macro2-1-rs', required: true)
|
||||||
|
|
|
@ -35,7 +35,7 @@ _qemu_api_rs = static_library(
|
||||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||||
rust_abi: 'rust',
|
rust_abi: 'rust',
|
||||||
rust_args: _qemu_api_cfg,
|
rust_args: _qemu_api_cfg,
|
||||||
dependencies: [anyhow_rs, libc_rs, qemu_api_macros, qemuutil_rs,
|
dependencies: [anyhow_rs, foreign_rs, libc_rs, qemu_api_macros, qemuutil_rs,
|
||||||
qom, hwcore, chardev, migration],
|
qom, hwcore, chardev, migration],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@ sub_file="${sub_tdir}/submodule.tar"
|
||||||
# different to the host OS.
|
# different to the host OS.
|
||||||
subprojects="keycodemapdb libvfio-user berkeley-softfloat-3
|
subprojects="keycodemapdb libvfio-user berkeley-softfloat-3
|
||||||
berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs bilge-0.2-rs
|
berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs bilge-0.2-rs
|
||||||
bilge-impl-0.2-rs either-1-rs itertools-0.11-rs libc-0.2-rs proc-macro2-1-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
|
||||||
proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
|
proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
|
||||||
syn-2-rs unicode-ident-1-rs"
|
syn-2-rs unicode-ident-1-rs"
|
||||||
sub_deinit=""
|
sub_deinit=""
|
||||||
|
|
|
@ -41,7 +41,8 @@ fi
|
||||||
# Only include wraps that are invoked with subproject()
|
# Only include wraps that are invoked with subproject()
|
||||||
SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3
|
SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3
|
||||||
berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs bilge-0.2-rs
|
berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs bilge-0.2-rs
|
||||||
bilge-impl-0.2-rs either-1-rs itertools-0.11-rs libc-0.2-rs proc-macro2-1-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
|
||||||
proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
|
proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
|
||||||
syn-2-rs unicode-ident-1-rs"
|
syn-2-rs unicode-ident-1-rs"
|
||||||
|
|
||||||
|
|
1
subprojects/.gitignore
vendored
1
subprojects/.gitignore
vendored
|
@ -11,6 +11,7 @@
|
||||||
/bilge-0.2.0
|
/bilge-0.2.0
|
||||||
/bilge-impl-0.2.0
|
/bilge-impl-0.2.0
|
||||||
/either-1.12.0
|
/either-1.12.0
|
||||||
|
/foreign-0.3.1
|
||||||
/itertools-0.11.0
|
/itertools-0.11.0
|
||||||
/libc-0.2.162
|
/libc-0.2.162
|
||||||
/proc-macro-error-1.0.4
|
/proc-macro-error-1.0.4
|
||||||
|
|
7
subprojects/foreign-0.3-rs.wrap
Normal file
7
subprojects/foreign-0.3-rs.wrap
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[wrap-file]
|
||||||
|
directory = foreign-0.3.1
|
||||||
|
source_url = https://crates.io/api/v1/crates/foreign/0.3.1/download
|
||||||
|
source_filename = foreign-0.3.1.tar.gz
|
||||||
|
source_hash = 17ca1b5be8c9d320daf386f1809c7acc0cb09accbae795c2001953fa50585846
|
||||||
|
#method = cargo
|
||||||
|
patch_directory = foreign-0.3-rs
|
26
subprojects/packagefiles/foreign-0.3-rs/meson.build
Normal file
26
subprojects/packagefiles/foreign-0.3-rs/meson.build
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
project('foreign-0.3-rs', 'rust',
|
||||||
|
meson_version: '>=1.5.0',
|
||||||
|
version: '0.2.0',
|
||||||
|
license: 'MIT OR Apache-2.0',
|
||||||
|
default_options: [])
|
||||||
|
|
||||||
|
subproject('libc-0.2-rs', required: true)
|
||||||
|
libc_rs = dependency('libc-0.2-rs')
|
||||||
|
|
||||||
|
_foreign_rs = static_library(
|
||||||
|
'foreign',
|
||||||
|
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',
|
||||||
|
],
|
||||||
|
dependencies: [libc_rs],
|
||||||
|
)
|
||||||
|
|
||||||
|
foreign_dep = declare_dependency(
|
||||||
|
link_with: _foreign_rs,
|
||||||
|
)
|
||||||
|
|
||||||
|
meson.override_dependency('foreign-0.3-rs', foreign_dep)
|
Loading…
Add table
Add a link
Reference in a new issue