From: "Alex Bennée" <alex.bennee@linaro.org>
To: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Gustavo Romero" <gustavo.romero@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Junjie Mao" <junjie.mao@intel.com>,
"Zhao Liu" <zhao1.liu@intel.com>
Subject: Re: [PATCH RESEND v9 2/9] build-sys: Add rust feature option
Date: Wed, 28 Aug 2024 12:26:32 +0100 [thread overview]
Message-ID: <87cyls51nb.fsf@draig.linaro.org> (raw)
In-Reply-To: <20240828-rust-pl011-v9-2-35579191f17c@linaro.org> (Manos Pitsidianakis's message of "Wed, 28 Aug 2024 07:11:43 +0300")
Manos Pitsidianakis <manos.pitsidianakis@linaro.org> writes:
> Add rust feature in meson.build, configure, to prepare for adding Rust
> code in the followup commits.
>
> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> ---
> MAINTAINERS | 5 +++++
> meson.build | 25 ++++++++++++++++++++++++-
> Kconfig | 1 +
> Kconfig.host | 3 +++
> meson_options.txt | 3 +++
> rust/Kconfig | 0
> scripts/meson-buildoptions.sh | 3 +++
> 7 files changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3584d6a6c6da9a3210150534d640d29ddf329dce..0bc8e515daf7e63320620b52b42a799b99dbe035 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4243,6 +4243,11 @@ F: docs/sphinx/
> F: docs/_templates/
> F: docs/devel/docs.rst
>
> +Rust build system integration
> +M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> +S: Maintained
> +F: rust/Kconfig
> +
> Miscellaneous
> -------------
> Performance Tools and Tests
> diff --git a/meson.build b/meson.build
> index 7eb4b8a41c0a667cacf693cfa2764f326ba72b1f..67eb4eda649d5f0566de2b75466b5a9d9ca87ab4 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -70,6 +70,22 @@ if host_os == 'darwin' and \
> all_languages += ['objc']
> objc = meson.get_compiler('objc')
> endif
> +if get_option('rust').enabled() and meson.version().version_compare('<1.0.0')
> + error('Rust support requires Meson version >=1.0.0')
> +endif
Isn't this test obsolete as patch 1 ensures we have at least 1.50 anyway?
> +have_rust = false
> +if not get_option('rust').disabled() and add_languages('rust', required: get_option('rust'), native: false)
> + rustc = meson.get_compiler('rust')
> + have_rust = true
> + if rustc.version().version_compare('<1.80.0')
> + if get_option('rust').enabled()
> + error('rustc version ' + rustc.version() + ' is unsupported: Please upgrade to at least 1.80.0')
> + else
> + warning('rustc version ' + rustc.version() + ' is unsupported: Disabling Rust compilation. Please upgrade to at least 1.80.0 to use Rust.')
> + have_rust = false
> + endif
> + endif
> +endif
>
> dtrace = not_found
> stap = not_found
> @@ -2131,6 +2147,7 @@ endif
>
> config_host_data = configuration_data()
>
> +config_host_data.set('CONFIG_HAVE_RUST', have_rust)
> audio_drivers_selected = []
> if have_system
> audio_drivers_available = {
> @@ -3076,7 +3093,8 @@ host_kconfig = \
> (host_os == 'linux' ? ['CONFIG_LINUX=y'] : []) + \
> (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : []) + \
> (vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=y'] : []) + \
> - (hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=y'] : [])
> + (hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=y'] : []) + \
> + (have_rust ? ['CONFIG_HAVE_RUST=y'] : [])
>
> ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
>
> @@ -4287,6 +4305,11 @@ if 'objc' in all_languages
> else
> summary_info += {'Objective-C compiler': false}
> endif
> +summary_info += {'Rust support': have_rust}
> +if have_rust
> + summary_info += {'rustc version': rustc.version()}
> + summary_info += {'rustc': ' '.join(rustc.cmd_array())}
> +endif
> option_cflags = (get_option('debug') ? ['-g'] : [])
> if get_option('optimization') != 'plain'
> option_cflags += ['-O' + get_option('optimization')]
> diff --git a/Kconfig b/Kconfig
> index fb6a24a2de8c3ff11d4ee432d65ad000ba9d6c4d..63ca7f46df788144864b26ef5a64b29ad6547435 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -4,3 +4,4 @@ source accel/Kconfig
> source target/Kconfig
> source hw/Kconfig
> source semihosting/Kconfig
> +source rust/Kconfig
I was wondering if we should call out the directory structure in
docs/devel but we don't currently. docs/devel/build-system.rst is
probably the wrong place for it so maybe we need a new section for code
layout. Anyway not a problem for this patch.
> diff --git a/Kconfig.host b/Kconfig.host
> index 17f405004b3bc765890688304322a1937ca8c01c..4ade7899d67a5ed91928f8ee1e287f5ba3331949 100644
> --- a/Kconfig.host
> +++ b/Kconfig.host
> @@ -52,3 +52,6 @@ config VFIO_USER_SERVER_ALLOWED
>
> config HV_BALLOON_POSSIBLE
> bool
> +
> +config HAVE_RUST
> + bool
Not this patches fault but the top of this Kconfig states:
# These are "proxy" symbols used to pass config-host.mak values
# down to Kconfig. See also kconfig_external_symbols in
# meson.build: these two need to be kept in sync.
but that was updated in 0a18911074 (meson: cleanup Kconfig.host
handling) and I can see host_kconfig has been updated. It would be nice
to put a patch in before just cleaning up that comment.
> diff --git a/meson_options.txt b/meson_options.txt
> index 0269fa0f16ed6b6f734fcefa2cfa94aa029fa837..fa94a5ce97bb14ab108e21cccb651923ac6a58f8 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -371,3 +371,6 @@ option('hexagon_idef_parser', type : 'boolean', value : true,
>
> option('x86_version', type : 'combo', choices : ['0', '1', '2', '3', '4'], value: '1',
> description: 'tweak required x86_64 architecture version beyond compiler default')
> +
> +option('rust', type: 'feature', value: 'auto',
> + description: 'Rust support')
> diff --git a/rust/Kconfig b/rust/Kconfig
> new file mode 100644
> index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index c97079a38c9e4ed24a0fe9b44e492b7108481048..5e8a225a6b343cf506950a3146af718d52a6c1a0 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -170,6 +170,7 @@ meson_options_help() {
> printf "%s\n" ' rbd Ceph block device driver'
> printf "%s\n" ' rdma Enable RDMA-based migration'
> printf "%s\n" ' replication replication support'
> + printf "%s\n" ' rust Rust support'
> printf "%s\n" ' rutabaga-gfx rutabaga_gfx support'
> printf "%s\n" ' sdl SDL user interface'
> printf "%s\n" ' sdl-image SDL Image support for icons'
> @@ -452,6 +453,8 @@ _meson_option_parse() {
> --disable-replication) printf "%s" -Dreplication=disabled ;;
> --enable-rng-none) printf "%s" -Drng_none=true ;;
> --disable-rng-none) printf "%s" -Drng_none=false ;;
> + --enable-rust) printf "%s" -Drust=enabled ;;
> + --disable-rust) printf "%s" -Drust=disabled ;;
> --enable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=enabled ;;
> --disable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=disabled ;;
> --enable-safe-stack) printf "%s" -Dsafe_stack=true ;;
Without the unneeded version check:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-08-28 11:27 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 4:11 [PATCH RESEND v9 0/9] Add Rust build support, ARM PL011 device impl Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 1/9] Require meson version 1.5.0 Manos Pitsidianakis
2024-08-28 10:43 ` Alex Bennée
2024-08-28 4:11 ` [PATCH RESEND v9 2/9] build-sys: Add rust feature option Manos Pitsidianakis
2024-08-28 11:26 ` Alex Bennée [this message]
2024-08-28 4:11 ` [PATCH RESEND v9 3/9] configure, meson: detect Rust toolchain Manos Pitsidianakis
2024-08-28 12:11 ` Alex Bennée
2024-08-28 12:28 ` Daniel P. Berrangé
2024-09-04 11:03 ` Paolo Bonzini
2024-09-04 11:32 ` Paolo Bonzini
2024-08-28 4:11 ` [PATCH RESEND v9 4/9] rust: add bindgen step as a meson dependency Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 5/9] .gitattributes: add Rust diff and merge attributes Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 6/9] meson.build: add HAVE_GLIB_WITH_ALIGNED_ALLOC flag Manos Pitsidianakis
2024-08-28 13:15 ` Alex Bennée
2024-08-28 4:11 ` [PATCH RESEND v9 7/9] rust: add crate to expose bindings and interfaces Manos Pitsidianakis
2024-08-28 13:08 ` Alex Bennée
2024-08-30 1:19 ` Junjie Mao
2024-08-30 6:43 ` Manos Pitsidianakis
2024-08-30 8:50 ` Junjie Mao
2024-08-30 11:03 ` Alex Bennée
2024-08-31 8:25 ` Manos Pitsidianakis
2024-09-02 5:58 ` Junjie Mao
2024-09-06 7:56 ` Paolo Bonzini
2024-09-04 11:01 ` Paolo Bonzini
2024-09-05 3:05 ` Junjie Mao
2024-09-05 7:50 ` Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 8/9] rust: add utility procedural macro crate Manos Pitsidianakis
2024-08-28 4:11 ` [PATCH RESEND v9 9/9] rust: add PL011 device model Manos Pitsidianakis
2024-09-04 11:04 ` Paolo Bonzini
2024-09-06 10:41 ` Paolo Bonzini
2024-08-28 13:18 ` [PATCH RESEND v9 0/9] Add Rust build support, ARM PL011 device impl Alex Bennée
2024-09-04 11:31 ` 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=87cyls51nb.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=gustavo.romero@linaro.org \
--cc=junjie.mao@intel.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=zhao1.liu@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.