From nobody Sun Nov 24 08:17:43 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=1724818444; cv=none; d=zohomail.com; s=zohoarc; b=B5uVI/bJq2glQ3uEmwIoWrblzbuk+t/Qovg/n67HOEXNDm0VFpOD7s/gkVdNDe0fk40z6z44xOk8BpQhvZYRNNweaPaJI/Uq+05fz5jCOAaqJlti+JpGF+yNZA7PP4NyK9WDUQkZxH31iLrfAFAqem/vJpvFyF3GUZPr2ZJuF24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724818444; 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=21QEmzDujIgpkUBwy6KBNuVdg09H8SzoucFGAIhOGAk=; b=RffLdJvq40hD1KTfVHnTfueNIOjsGufkB0/JSQ7nt1/DfOHk0uY02B/u3nI36Lb/clHXM8u7O50T4gR3qSDEdfVcdhypFusX2BHIItKfi4cRIx7TzvrfVlGcaxzYeB1m7ZRS4tWBH7Hw2wifZSL4BP1jXZG/eg9sAbU5PF8LXk4= 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 1724818444836555.5527840596382; Tue, 27 Aug 2024 21:14:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjA2h-0005Qk-7I; Wed, 28 Aug 2024 00:12:23 -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 1sjA2g-0005Px-Da for qemu-devel@nongnu.org; Wed, 28 Aug 2024 00:12:22 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjA2d-0000ld-Rv for qemu-devel@nongnu.org; Wed, 28 Aug 2024 00:12:22 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5c210e23651so679586a12.3 for ; Tue, 27 Aug 2024 21:12:19 -0700 (PDT) Received: from [127.0.1.1] (adsl-98.109.242.227.tellas.gr. [109.242.227.98]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c0bb1c29b9sm1712814a12.18.2024.08.27.21.12.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 21:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724818338; x=1725423138; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=21QEmzDujIgpkUBwy6KBNuVdg09H8SzoucFGAIhOGAk=; b=ZIKQYxmHgMUabne88e4vlGnl9W5mghbK3usGhLHyBO+sQzGgraWN6FOH2zd366pC6B u9qMgAELqKYtT1tlW1EOIZqgvE9kiw6dVbglyRgTBWt1vVIPa373Jod4nG6Xen61p6fN IDRV+dFcrBJNwPFtyohNht5rLbLGtUSNnOcxuxb0R9ysT272mKX+CieszGBqvV4JFZaX 5AyKQckcqEdfiI+4aHpKY2VjVJyAeOXq5Pit/H4GnbLG2suokfdPjR1Sw8clE3iqc9rO tDG0p9dI7vOWSekqqoGhsK8AZNeFZej48JevWxLHJ3/c4Q4zuFkxGZaIZUMhTPxNvUZ9 VNrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724818338; x=1725423138; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=21QEmzDujIgpkUBwy6KBNuVdg09H8SzoucFGAIhOGAk=; b=NnZmMx4dSSidiU8GArUSbH5tQEUQ1ZrHB6xFH88OlvDsMwzcMT3vuo2zqa2Ioe7MpR e6FfB0m5jKY69BPty4cI3qOdK4uJBZ06FnP1hy5xDBRBgQvmpgLErJG383jcwLhTUsFC 84txqhLSIZ8/jvx0ezJzdjDR3ptTQXOKLUfKgaGjS3IaOeQoXjD9iryGKRCeSEkPHJLX 5s5HIT9oSSM1Cmr9pXsEiMaUeQO7vHAVbC62vibetwpyp8+xtVzf2VttFttSTV2AjMdV gNsRHgNqo0sqVDwxReaeigeidm7d+3tq+EbM2llzx5J9JRsROTO80ra0rbaPeFaFZko+ lPLQ== X-Gm-Message-State: AOJu0YwskzSyXM1aAcvg86neFPcKlSYR3N0W/eYZfV+dKBWgcZv3M9Bm 99Rx/NnQPFt25mJT6qXnmBge6LU6s4INggAuejccmKD5ojyVn+cwWmIrDxr9Q+0= X-Google-Smtp-Source: AGHT+IH9KE1oN1ihGD9nOTi3dVn+vAk+brW/aIeBd1kD8yPAYNLaAzQNNPObQ2CPic2OSUiet0PiZw== X-Received: by 2002:a05:6402:2546:b0:5be:eb19:ee56 with SMTP id 4fb4d7f45d1cf-5c214c597c2mr471528a12.24.1724818337807; Tue, 27 Aug 2024 21:12:17 -0700 (PDT) From: Manos Pitsidianakis Date: Wed, 28 Aug 2024 07:11:44 +0300 Subject: [PATCH RESEND v9 3/9] configure, meson: detect Rust toolchain MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240828-rust-pl011-v9-3-35579191f17c@linaro.org> References: <20240828-rust-pl011-v9-0-35579191f17c@linaro.org> In-Reply-To: <20240828-rust-pl011-v9-0-35579191f17c@linaro.org> To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Richard Henderson , Gustavo Romero , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Maydell , Junjie Mao , Zhao Liu , Manos Pitsidianakis X-Mailer: b4 0.15-dev-c2c95 X-Developer-Signature: v=1; a=openpgp-sha256; l=6904; i=manos.pitsidianakis@linaro.org; h=from:subject:message-id; bh=qISo7oo0rfeUGD0BnZly+vsOKnxOKDn62ksH0VVpgRc=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0VCYlFLUy9aQU5Bd0FLQVhjcHgzQi9mZ 25RQWNzbVlnQm16cU9MUy9ObUxaYjViQm9UaUhHY0hxNVFTU0xUCnhNNndHQ0ttL25oSnJvd0g5 WWlKQWpNRUFBRUtBQjBXSVFUTVhCdE9SS0JXODRkd0hSQjNLY2R3ZjM0SjBBVUMKWnM2aml3QUt DUkIzS2Nkd2YzNEowTnp3RC85Z0RFYjN5SVdKNmtaZFRMK3ZNMFJaUWJ1OHNyOWU0cXZnMzFoVA orSHZ5YTMzSXViajNiU3NrRGhjb0FNS2M1dGhDR21vWE1PVEtQWWg3b2U2cXBtMHRrWUV5aWtrZ k1LNGY5R0c1CnlmRnNYM2ZGbjFub1V1WnM0aVVYM3dGalpJckNzcEtWMlJIYU5sZnduUUZKUTJ1 aHU1UVFBRFVkKys4Nkt6bnIKYXYvYVRTNVVVY2Y4T0pKVENaSE0venNQbE8xSFliVjVMS1Ivblh 0U2pxUlFIK3EyVFV6N2UrMGhvd1ArLzFrawpGcnMwcDczVzhjcllCMXNXSmxaSGUvc29BWE5rUE xDTHNuRmhIa1JnNFl0OTYvcjk5WDNuNDZ3U25kSmhROFVjCmliN2l3TlBoK1N4aXRkb3Rod012Z TZpLy9pUC8ydFMrUDdNYy94UkRZRHBEWDYrZlVlZkVqamg3MHpWUENBS0YKUWZtdUxLaS80MTFm dE1FR1ZTY1U0NnBwZGVoYUk4OTFXaTBMcUc0RHREU3BtR2lBRWtKOFZFZ09KaHoyT1pGSQp1WG5 MaXptb2Fjc1hOVGhMTTZWME5qTEpxMDlPeWJDNlJ1SzA4TnRjU0VXVEdqYTA4WVRaaTdPZkNLRE J4QmFpCjhsYVR5bkVPNEU5SXlmQW95V045QXhnNlZwdXVaaWVHajhzcVVyZzVQd2c4K1RNUTNLN UphWDIya0JEVGlXaFoKb2dZN1hVMjNLanZuNWdMcjV1UisyWHpudFhEY2lTelNPRDFaNXRlUVdO aW9lTDNIMHBReVJSYzVGM0RqVUhxYwpwaDJsdDhiYnE0ampwa3FYeVR5dktudlBWVmZ1N1hTWjF MaUtPYkhVaUVJcUFyYnpqWktWekhJbmptYlhXTUQzCng4N0k1UT09Cj16ano2Ci0tLS0tRU5EIF BHUCBNRVNTQUdFLS0tLS0K X-Developer-Key: i=manos.pitsidianakis@linaro.org; a=openpgp; fpr=7C721DF9DB3CC7182311C0BF68BC211D47B421E1 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::52d; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-ed1-x52d.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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1724818445479116600 From: Paolo Bonzini Include the correct path and arguments to rustc in the native and cross files (native compilation is needed for procedural macros). Signed-off-by: Paolo Bonzini --- configure | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- meson.build | 8 +++----- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 019fcbd0ef7b07e7b0280b358099cae72c73aa98..9ef6005c557fc627c7c6c732b4c= 92ed1b934f474 100755 --- a/configure +++ b/configure @@ -207,6 +207,8 @@ for opt do ;; --objcc=3D*) objcc=3D"$optarg" ;; + --rustc=3D*) RUSTC=3D"$optarg" + ;; --cpu=3D*) cpu=3D"$optarg" ;; --extra-cflags=3D*) @@ -252,6 +254,9 @@ python=3D download=3D"enabled" skip_meson=3Dno use_containers=3D"yes" +# do not enable by default because cross compilation requires --rust-targe= t-triple +rust=3D"disabled" +rust_target_triple=3D"" gdb_bin=3D$(command -v "gdb-multiarch" || command -v "gdb") gdb_arches=3D"" =20 @@ -317,6 +322,8 @@ windmc=3D"${WINDMC-${cross_prefix}windmc}" pkg_config=3D"${PKG_CONFIG-${cross_prefix}pkg-config}" sdl2_config=3D"${SDL2_CONFIG-${cross_prefix}sdl2-config}" =20 +rustc=3D"${RUSTC-rustc}" + check_define() { cat > $TMPC < "${TMPDIR1}/= ${TMPB}.out"; then + rust_host_triple=3D$(sed -n 's/^host: //p' "${TMPDIR1}/${TMPB}.out") +else + if test "$rust" =3D enabled; then + error_exit "could not execute rustc binary \"$rustc\"" + fi + rust=3Ddisabled +fi +if test "$rust" !=3D disabled && test -z "$rust_target_triple"; then + rust_target_triple=3D$rust_host_triple +fi + +########################################## # functions to probe cross compilers =20 container=3D"no" @@ -1604,6 +1636,9 @@ if test "$container" !=3D no; then echo "RUNC=3D$runc" >> $config_host_mak fi echo "SUBDIRS=3D$subdirs" >> $config_host_mak +if test "$rust" !=3D disabled; then + echo "RUST_TARGET_TRIPLE=3D$rust_target_triple" >> $config_host_mak +fi echo "PYTHON=3D$python" >> $config_host_mak echo "MKVENV_ENSUREGROUP=3D$mkvenv ensuregroup $mkvenv_online_flag" >> $co= nfig_host_mak echo "GENISOIMAGE=3D$genisoimage" >> $config_host_mak @@ -1735,6 +1770,13 @@ if test "$skip_meson" =3D no; then echo "c =3D [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross test -n "$cxx" && echo "cpp =3D [$(meson_quote $cxx $CPU_CFLAGS)]" >> $c= ross test -n "$objcc" && echo "objc =3D [$(meson_quote $objcc $CPU_CFLAGS)]" = >> $cross + if test "$rust" !=3D disabled; then + if test "$rust_host_triple" !=3D "$rust_target_triple"; then + echo "rust =3D [$(meson_quote $rustc --target "$rust_target_triple")= ]" >> $cross + else + echo "rust =3D [$(meson_quote $rustc)]" >> $cross + fi + fi echo "ar =3D [$(meson_quote $ar)]" >> $cross echo "dlltool =3D [$(meson_quote $dlltool)]" >> $cross echo "nm =3D [$(meson_quote $nm)]" >> $cross @@ -1770,6 +1812,9 @@ if test "$skip_meson" =3D no; then echo "# Automatically generated by configure - do not modify" > $native echo "[binaries]" >> $native echo "c =3D [$(meson_quote $host_cc)]" >> $native + if test "$rust" !=3D disabled; then + echo "rust =3D [$(meson_quote $rustc)]" >> $cross + fi mv $native config-meson.native meson_option_add --native-file meson_option_add config-meson.native @@ -1788,6 +1833,7 @@ if test "$skip_meson" =3D no; then test "$pie" =3D no && meson_option_add -Db_pie=3Dfalse =20 # QEMU options + test "$rust" !=3D "auto" && meson_option_add "-Drust=3D$rust" test "$cfi" !=3D false && meson_option_add "-Dcfi=3D$cfi" "-Db_lto=3D$cf= i" test "$docs" !=3D auto && meson_option_add "-Ddocs=3D$docs" test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engin= e=3D$LIB_FUZZING_ENGINE" diff --git a/meson.build b/meson.build index 67eb4eda649d5f0566de2b75466b5a9d9ca87ab4..065739ccb7300f4f0d487602485= 802f9f68fb095 100644 --- a/meson.build +++ b/meson.build @@ -70,9 +70,6 @@ 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') @@ -4307,8 +4304,9 @@ else 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())} + summary_info +=3D {'rustc version': rustc.version()} + summary_info +=3D {'rustc': ' '.join(rustc.cmd_array())} + summary_info +=3D {'Rust target': config_host['RUST_TARGET_TRIPLE']} endif option_cflags =3D (get_option('debug') ? ['-g'] : []) if get_option('optimization') !=3D 'plain' --=20 2.45.2