From nobody Sat Nov 23 23:46:00 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=1728666806; cv=none; d=zohomail.com; s=zohoarc; b=IYF4hZhhEaYphmU7KyvVNW9/SDIHHOD1cQxvf+1XhvTfufuQmC9lhxzCt3eR+MlcFZzbtxyVQqJKzEQ9H1WkSiUnN995cys7AqJcoZP6zNbKQLK+SVXx5AHc8HSRir3oXJ/zQkumAEUIg361EWEQgyxB81Ff2wT6xBowgYrcu5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728666806; 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=mV7Tp8dmnhymCVmSWJYoL4oQgjfzsvl281g33/SIjEw=; b=NgXSlln/2hSYuI3hIBpJ6Nk6VSUcqrx4Z65qAmrIHZ/Cissg+qQxmAIn8F/LfMVIYOSvjayTkg4mvweZH/3XD0spoKIiqb+PG0xjMyg4AFfjtfrPZ89SPJSCm4qFspNGsgy1yyj1nhwp3l32QCRw1dqhW5nuRxDVJJb0RTKQkks= 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 172866680697742.11121629578065; Fri, 11 Oct 2024 10:13:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1szJ4Y-0001DW-NI; Fri, 11 Oct 2024 13:05:02 -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 1szJ4U-0000hu-GI for qemu-devel@nongnu.org; Fri, 11 Oct 2024 13:04:58 -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 1szHdH-0007CB-C8 for qemu-devel@nongnu.org; Fri, 11 Oct 2024 11:32:49 -0400 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-xmkHKUoQNEWgwl3bDIhidg-1; Fri, 11 Oct 2024 11:32:45 -0400 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a996be26171so346442666b.0 for ; Fri, 11 Oct 2024 08:32:45 -0700 (PDT) Received: from avogadro.local ([151.81.124.37]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a80bfabfsm221280266b.122.2024.10.11.08.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 08:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728660766; 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=mV7Tp8dmnhymCVmSWJYoL4oQgjfzsvl281g33/SIjEw=; b=Cf0MTJ0Z5COwqhkLfhYyqUhe6rptHXftiXR9DjSzdfszKdzr2h6bdZQ3kYZ6EKUw+hs4/3 +enzvRJ6TPy8id5te9utHDGoroEprt0Z7eXNMVaq9CNfV+WQRl5HXy6jJu8HklWtR4Q//H DyL8f2LkDjaFRb7FcC6Y7ZY6Y6WGxr8= X-MC-Unique: xmkHKUoQNEWgwl3bDIhidg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728660764; x=1729265564; 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=mV7Tp8dmnhymCVmSWJYoL4oQgjfzsvl281g33/SIjEw=; b=PJOCmhvtgG0O03mItg9FPLmGR6AMaBH3XGzlVJH7zG7Ojz9zatCruneZR6J9jSFspC lSHqilBam4n/modtGIu+rEKrNNTo81H7P/YeNxwlYLbwGjjK6QaSR9mmVds7LDTRNXUH MPHoczqAarLwhNPpJnRxcnFKxY/imCGel4tkzOAQJv0AMdyswCGJIEBv5TEIIsbtrzHp 11YGqeaz+7ftG+6tGRJ6tXyhBAHPJXzyiLcZ71tXaR4XIi+1VqB5yjjQV99yj99noweS g8EpgGgxuljUhByIrpeUZAMfcaW+NYK7YZTd21sAAhVG8jL4WBzL2uCe2enrTsjWha70 92KA== X-Gm-Message-State: AOJu0YzI8dgzju7qysO0JYvi0V8NmAedxhrkm6Anin5ydcC1gPL4nX35 YV5+xcV+6YEOpBPL1jbSKsrgrzjArccx2zpUPkK/KXfpLRrv3uDX0yQyo1M0dMsQ93fr+9ogO7T TYJHEAJRw8YezxQSBaMpI6m3tkp0zn7od+1gq6aSRhiDDVUsHiTz/9c+JwYN6dCaSdw6PaTrpnK +SnC7IdpMjfKp0KtqW/HBVPitKcs+tFEy/iazkQOw= X-Received: by 2002:a17:907:7e8d:b0:a99:a18d:9793 with SMTP id a640c23a62f3a-a99b8775270mr270687066b.7.1728660763658; Fri, 11 Oct 2024 08:32:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHryCFwHWbBC7X7Zb8eTdneHOdO6Pw4LqT82/31zgi+BTc7NwY/+0fysN1bk9KpABsSw9rm8A== X-Received: by 2002:a17:907:7e8d:b0:a99:a18d:9793 with SMTP id a640c23a62f3a-a99b8775270mr270684766b.7.1728660763172; Fri, 11 Oct 2024 08:32:43 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL v3 02/18] build-sys: Add rust feature option Date: Fri, 11 Oct 2024 17:32:10 +0200 Message-ID: <20241011153227.81770-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241011153227.81770-1-pbonzini@redhat.com> References: <20241011153227.81770-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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.15, 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.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1728666808088116600 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.2