From nobody Sun Nov 24 01:07:21 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1728299213; cv=none; d=zohomail.com; s=zohoarc; b=JP5f2TCo8gnDoT2mdMhpYV1PtN5RndZpc97t3UrowLcO7pJW7aD1KBkASX0THOP381RlLMxJkDDb1Uj2mSX579J0UWMUMAA+7ZUorabPb+7mmUweqQiDDstZ73p5HA7M3L7r2qSPPOHhywfDl2bW3zMWHF2sC4/E2iys3+iByH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728299213; 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=CeV6EY183bfuM+XUE1UfKE7DRa4bTrUF6uqcDnlyIPg=; b=kyD/3QNU/uVwW8TZVTj8pK9/7V6FnoyrflEkt3iB75hRLp0Gp0UYsSG1l2cNLfE79T97IiAi+zOSyAAHWV1NoqvMM34lHsEiJU1BPxliK2Yz+8oH+CHb+Tt8e+a81oeT5OaRFiWuj785SK+y40yH5sbUGIKhX0aTn/47cNgdLCE= 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 1728299213350952.5181677517963; Mon, 7 Oct 2024 04:06:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxlX7-0001lc-NO; Mon, 07 Oct 2024 07:04:09 -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 1sxlX5-0001km-KT for qemu-devel@nongnu.org; Mon, 07 Oct 2024 07:04:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sxlX3-0006Ti-Hd for qemu-devel@nongnu.org; Mon, 07 Oct 2024 07:04:07 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-WjlwII2QPxOPV4Bwo1wKgA-1; Mon, 07 Oct 2024 07:04:02 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-42ac185e26cso38119305e9.3 for ; Mon, 07 Oct 2024 04:04:01 -0700 (PDT) Received: from avogadro.local ([151.62.111.131]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d1695e62bsm5489247f8f.81.2024.10.07.04.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 04:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728299044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CeV6EY183bfuM+XUE1UfKE7DRa4bTrUF6uqcDnlyIPg=; b=D+eHeIyjEsmjGadx0ZMGIMES6tFEpcd2Ed62SO3IMWjlWwf/H6wfnUJvkXvnMQWJmRcELp 2CfePaG+1lE1oAxlGfYFmGgyct9oCg6WNZPIMdM7G6IbaEDrQaMSUwULmXC+hE5y/e2vvG UNnCgeLZecRZv+2tDQXhADRjB4LvXk4= X-MC-Unique: WjlwII2QPxOPV4Bwo1wKgA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728299040; x=1728903840; 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=CeV6EY183bfuM+XUE1UfKE7DRa4bTrUF6uqcDnlyIPg=; b=ta3o1aCq7COt5WGVoCyHYnBW67XzPQFJjBoHsi1MmIrx43qRY10mL46AkNtutSfK58 W9AWF10aOVDhqMh5fCDpOHlfiajhdRc1JXEW9WqnZ7Yz0yrRMcSQUnOogaw47K+kKxUU xx4IwYlaoPnMQvM6KS3aXAOZ5gg05cGzO6aj0+c6KuPrFwfQy+KYCINRMLcYY1LDf2Zy RbMC2uzaL21G8AZ5aFAieOQQmaLT5t9f4q7fDl0RL9WdafYtn1ivVlSsUFdKX5gBReBi 5vk1S0yYwaVtt0Y3uYGy0ygcmyK9A4vSyG+19GtiTsVX7gfkDqmLqQb00xGh+Om3Afb7 7qDQ== X-Gm-Message-State: AOJu0YzDD7+MB+vBT6hPY/BF6YWxIGSpy+QzMPg9V5/Ou2Dqg9j72ORQ a2in4eUAHM0XGl8/U9e/0gd/Eg76PrvXISypm8eElxNpVeGtGhRlln7glBGeJgw0DSNzvo+iNc1 ljUR6UdjFo1ltJeQgSLgNsBUcp6aFQLwVoByNxmYiuwt0NbvUUz9WY9UwVMLvEqZox8UaeV+SE3 L5t0QCNE6En7Gw7sGArrl7MihTd9u4EjG3rNM9FYU= X-Received: by 2002:a05:600c:3c90:b0:426:647b:1bfc with SMTP id 5b1f17b1804b1-42f85aef748mr80289005e9.30.1728299039976; Mon, 07 Oct 2024 04:03:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkod+hjeZrHuwTg1czjijAflyqQfqXRVeLz4Ihc8KO+RUO2BcR0IGQeJc561F0DKRH+r4hzA== X-Received: by 2002:a05:600c:3c90:b0:426:647b:1bfc with SMTP id 5b1f17b1804b1-42f85aef748mr80288755e9.30.1728299039456; Mon, 07 Oct 2024 04:03:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: manos.pitsidianakis@linaro.org, zhao1.liu@intel.com, junjie.mao@intel.com, pierrick.bouvier@linaro.org, alex.bennee@linaro.org Subject: [PULL 02/12] build-sys: Add rust feature option Date: Mon, 7 Oct 2024 13:03:30 +0200 Message-ID: <20241007110342.1298598-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241007110342.1298598-1-pbonzini@redhat.com> References: <20241007110342.1298598-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1728299214963116600 From: Manos Pitsidianakis Add rust feature in meson.build, configure, to prepare for adding Rust code in the followup commits. Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Benn=C3=A9e Link: https://lore.kernel.org/r/14642d80fbccbc60f7aa78b449a7deb5e2784ed9.17= 27961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini --- MAINTAINERS | 5 +++++ meson.build | 22 +++++++++++++++++++++- Kconfig | 1 + Kconfig.host | 3 +++ meson_options.txt | 3 +++ rust/Kconfig | 0 scripts/meson-buildoptions.sh | 3 +++ 7 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 rust/Kconfig diff --git a/MAINTAINERS b/MAINTAINERS index 72359066d39..fb3188c053e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4188,6 +4188,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/meson.build b/meson.build index e6a65463ff9..93ddaef500f 100644 --- a/meson.build +++ b/meson.build @@ -70,6 +70,19 @@ if host_os =3D=3D 'darwin' and \ all_languages +=3D ['objc'] objc =3D meson.get_compiler('objc') 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 @@ -2158,6 +2171,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 { @@ -3097,7 +3111,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 @@ -4308,6 +4323,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 fb6a24a2de8..63ca7f46df7 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 17f405004b3..4ade7899d67 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 5ee1d95c9ca..5a5c2300261 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -373,3 +373,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 00000000000..e69de29bb2d diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 3bee1c56df3..6d08605b771 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -172,6 +172,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' @@ -456,6 +457,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 2.46.1