From nobody Sun Nov 24 15:05:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1722805540; cv=none; d=zohomail.com; s=zohoarc; b=d5zmAAtE0DPHEym9ur1KZSZyOqWA4vHSQtedjvzLsVMfzJV/MrwIJe9UlqRJ3PAhsLN9g4bYeESLG/ztAliTIZTGqGRuwtrSa2ViIZuy3lfY87ETvkv5tW55ouPQS7x8uQ6yLAYB+AOfOKH4hgAqHRLMh9wUh42NhLKn1NscK4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722805540; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SJdRSPH/xM+z+0nBRsC0mklzYhlrkNq7AnAF+TlID90=; b=ObJf6HHAnq4w9XgHqF61MgVyGT0euZiKySW82XitqOAL8WbPI/Ah8aht9K1eN7m4lsjQs+AzFP/AXib9A3E5p/s2gzaW1osKvqmsJNchVcksneshFuZRP0IcRBWt4bw2SywMs2bPcfIbmgZjk1Bn0/Ie5M13demj1ShLubikm1c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722805539994450.9610846759514; Sun, 4 Aug 2024 14:05:39 -0700 (PDT) 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) 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) 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) From: Manos Pitsidianakis To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Mads Ynddal , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Thomas Huth , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1722805540493116600 Content-Type: text/plain; charset="utf-8" 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 =20 +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 includi= ng desired devices in configs/devices/) --with-devices-ARCH=3DNAME 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=3DCPU 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 =3D=3D 'darwin' and \ all_languages +=3D ['objc'] objc =3D meson.get_compiler('objc') endif +if get_option('rust').enabled() and meson.version().version_compare('<1.0.= 0') + error('Rust support requires Meson version >=3D1.0.0') +endif +have_rust =3D false +if not get_option('rust').disabled() and add_languages('rust', required: g= et_option('rust'), native: false) + rustc =3D meson.get_compiler('rust') + have_rust =3D 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: Disab= ling Rust compilation. Please upgrade to at least 1.80.0 to use Rust.') + have_rust =3D false + endif + endif +endif =20 dtrace =3D not_found stap =3D not_found @@ -2119,6 +2135,7 @@ endif =20 config_host_data =3D configuration_data() =20 +config_host_data.set('CONFIG_HAVE_RUST', have_rust) audio_drivers_selected =3D [] if have_system audio_drivers_available =3D { @@ -3062,7 +3079,8 @@ host_kconfig =3D \ (host_os =3D=3D 'linux' ? ['CONFIG_LINUX=3Dy'] : []) + \ (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=3Dy'] : []) + \ (vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=3Dy'] : []= ) + \ - (hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=3Dy'] : []) + (hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=3Dy'] : []) + \ + (have_rust ? ['CONFIG_HAVE_RUST=3Dy'] : []) =20 ignored =3D [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ] =20 @@ -4273,6 +4291,11 @@ if 'objc' in all_languages else summary_info +=3D {'Objective-C compiler': false} endif +summary_info +=3D {'Rust support': have_rust} +if have_rust + summary_info +=3D {'rustc version': rustc.version()} + summary_info +=3D {'rustc': ' '.join(rustc.cmd_array())} +endif option_cflags =3D (get_option('debug') ? ['-g'] : []) if get_option('optimization') !=3D 'plain' option_cflags +=3D ['-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 =20 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, =20 option('x86_version', type : 'combo', choices : ['0', '1', '2', '3', '4'],= value: '1', description: 'tweak required x86_64 architecture version beyond com= piler 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=3Ddisabled ;; --enable-rng-none) printf "%s" -Drng_none=3Dtrue ;; --disable-rng-none) printf "%s" -Drng_none=3Dfalse ;; + --enable-rust) printf "%s" -Drust=3Denabled ;; + --disable-rust) printf "%s" -Drust=3Ddisabled ;; --enable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=3Denabled ;; --disable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=3Ddisabled ;; --enable-safe-stack) printf "%s" -Dsafe_stack=3Dtrue ;; --=20 =CE=B3=CE=B1=E1=BF=96=CE=B1 =CF=80=CF=85=CF=81=CE=AF =CE=BC=CE=B9=CF=87=CE= =B8=CE=AE=CF=84=CF=89