From patchwork Sun Aug 4 21:04:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manos Pitsidianakis X-Patchwork-Id: 13752719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A28AFC3DA64 for ; Sun, 4 Aug 2024 21:05:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saiP2-0008AQ-6I; Sun, 04 Aug 2024 17:04:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1saiP1-00089L-3S for qemu-devel@nongnu.org; Sun, 04 Aug 2024 17:04:31 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saiOz-0005dv-60 for qemu-devel@nongnu.org; Sun, 04 Aug 2024 17:04:30 -0400 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a7a9a7af0d0so1233587866b.3 for ; Sun, 04 Aug 2024 14:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722805467; x=1723410267; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SJdRSPH/xM+z+0nBRsC0mklzYhlrkNq7AnAF+TlID90=; b=Retpld+z+59Uqn2O/7xXetnLaeaFPaLOrl/bH71LYZldSTuNdvv9GxF5Iz+0z1fm+y bvTjaEbhZ3ZjIrqhMwIwzWYAMS5DaBPuuRQ9VIRgMDc5t2YdC8PcZSCLUZPD5B+GkKoM hYdcbHYfS8eKzRB14Sir6WZrBzT8Dal8fp/+SeV5yLJ2Y5dzdlCRwgFGbWrBVk5SheHo +VcJQtTh+mAL7HRUrsLJnQD3pXed0+rG8/PpSmwfQzJh/705E2Y5IkAiTWdW7tLIQYlC gjb38jFNTxrj7qQ3ZHfBYjz7yUPvHgFH6+D23wNODbdXU2THSYui2Sh8WIFQP9819cB5 WMqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722805467; x=1723410267; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SJdRSPH/xM+z+0nBRsC0mklzYhlrkNq7AnAF+TlID90=; b=hAqsgVNizcTwoQ4eu+6S2BBsE7cp3dklRVueqkh3N5KX9/ry3izrGucTXowz4T2Zq5 jgg9sULoOvgceg7C67zZm9ADLKEnutKglrCqL+UZPzGJQMb/sTaQvwbXPgXR1GpRRpvc o4714ZdEOGD1E96BrFtlZToU6d19mFAnzfpqnBejxse2NDYzdtLhKWH0Ov00IoFyoYxk qZNeP5OSQhjgZQCpgRgEnZ1J9S8DMEVkIn26diS/V5s3r/ocXduEw4ZzHZ3p9iiAvOZa X+GetYfP7oFEzNUI5an6RL7bIMuKxd/1Ei2FRyKqFQWEqJnbcImlzjLOcb0dM1tgC87h W5RQ== X-Gm-Message-State: AOJu0YwZYaTgWPGMaVVE/ZGWaJ79rXqPGMje8X9mRkiCL0WztJRYNv8D j2xDUI/RYdXfULoGJ/s3aim4GhKGgG89LeqHpsRQ5xkTC3vzrgRnOHYMLHH9+xuLfUTGbIDvvHL GsCI= X-Google-Smtp-Source: AGHT+IHLrzRKSDJ9fRV+g5xcL34fSL0kHNh1jHH1EEvxeNX+jmPPzFvr6PbwK44eYb5u+4leEsmvtA== X-Received: by 2002:a17:907:6e86:b0:a72:8d2f:859c with SMTP id a640c23a62f3a-a7dc4fd88fbmr676558266b.33.1722805467044; Sun, 04 Aug 2024 14:04:27 -0700 (PDT) Received: from localhost.localdomain (adsl-146.37.6.160.tellas.gr. [37.6.160.146]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9d437a5sm366348766b.101.2024.08.04.14.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 14:04:26 -0700 (PDT) From: Manos Pitsidianakis To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Mads Ynddal , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_P?= =?utf-8?q?=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Thomas Huth , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Gustavo Romero , Pierrick Bouvier , rowan.hart@intel.com, Richard Henderson , Paolo Bonzini Subject: [RFC PATCH v6 1/5] build-sys: Add rust feature option Date: Mon, 5 Aug 2024 00:04:12 +0300 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add rust feature in meson.build, configure, to prepare for adding Rust code in the followup commits. Signed-off-by: Manos Pitsidianakis --- MAINTAINERS | 5 +++++ configure | 2 ++ meson.build | 25 ++++++++++++++++++++++++- Kconfig | 1 + Kconfig.host | 3 +++ meson_options.txt | 3 +++ rust/Kconfig | 0 scripts/meson-buildoptions.sh | 3 +++ 8 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 rust/Kconfig diff --git a/MAINTAINERS b/MAINTAINERS index e34c2bd4cd..4ba57c9c67 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4239,6 +4239,11 @@ F: docs/sphinx/ F: docs/_templates/ F: docs/devel/docs.rst +Rust build system integration +M: Manos Pitsidianakis +S: Maintained +F: rust/Kconfig + Miscellaneous ------------- Performance Tools and Tests diff --git a/configure b/configure index 019fcbd0ef..aac7f29f25 100755 --- a/configure +++ b/configure @@ -874,6 +874,8 @@ Advanced options (experts only): start the emulator (only use if you are including desired devices in configs/devices/) --with-devices-ARCH=NAME override default configs/devices + --enable-rust enable compilation of Rust code + --disable-rust disable compilation of Rust code --enable-debug enable common debug build options --cpu=CPU Build for host CPU [$cpu] --disable-containers don't use containers for cross-building diff --git a/meson.build b/meson.build index 97f63aa86c..9593fce47f 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 +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 @@ -2119,6 +2135,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 = { @@ -3062,7 +3079,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' ] @@ -4273,6 +4291,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 fb6a24a2de..63ca7f46df 100644 --- a/Kconfig +++ b/Kconfig @@ -4,3 +4,4 @@ source accel/Kconfig source target/Kconfig source hw/Kconfig source semihosting/Kconfig +source rust/Kconfig diff --git a/Kconfig.host b/Kconfig.host index 17f405004b..4ade7899d6 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 diff --git a/meson_options.txt b/meson_options.txt index 0269fa0f16..fa94a5ce97 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 0000000000..e69de29bb2 diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index c97079a38c..5e8a225a6b 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 ;;