From patchwork Wed Jun 4 02:13:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morgan Smith X-Patchwork-Id: 42994 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 38EED27BC4B; Wed, 4 Jun 2025 03:15:46 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CD64F27BC49 for ; Wed, 4 Jun 2025 03:15:43 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMdep-0004OQ-M3; Tue, 03 Jun 2025 22:15:11 -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 1uMdek-0004Mr-AC for guix-patches@gnu.org; Tue, 03 Jun 2025 22:15:06 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMdej-0002bm-Vf for guix-patches@gnu.org; Tue, 03 Jun 2025 22:15:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=v3M5LUhr2MToGQTUyLbs9tNjzUxDavFV3emhsz+2JmI=; b=BtaIRdXt0M/BJSgL4X7erDr2VeMVppBapUcEIJT4SLF8UVbZozyzdDT0ddKZ1FPXpO4GE7P4jjyry7L472t9gayhq8gNYf8J3nxEPGz6JHqKKj0/+r3pQe8FE0opkuTfnVOxvviHMkdsWu8l48CMU9PO8QYc8C9B/2A7Pp5pM3wCjSKaMmaUoJSZvx9TW4EBbzC7AUJm4y13yv9FT4PSTt5MDBc6MTktzpA4c/echCYjz2Y+g/+XFlWfJaV7Qp0lcwhMwBlCiKEnXDdp7BoSBws6IiNDMBLlCthrwHhbJKM3mJXKSuJ+e+YKrcPx0W1lZOdV2NYBD6wApCL1LZunhQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uMdeh-0003nQ-Of; Tue, 03 Jun 2025 22:15:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78688] [PATCH rust-team 1/3] gnu: rust and rust-bootstrap packages: Use gexps. References: In-Reply-To: Resent-From: Morgan Smith Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Wed, 04 Jun 2025 02:15:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78688 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78688@debbugs.gnu.org Cc: Morgan Smith , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 78688-submit@debbugs.gnu.org id=B78688.174900326114391 (code B ref 78688); Wed, 04 Jun 2025 02:15:03 +0000 Received: (at 78688) by debbugs.gnu.org; 4 Jun 2025 02:14:21 +0000 Received: from localhost ([127.0.0.1]:44367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uMddu-0003je-D6 for submit@debbugs.gnu.org; Tue, 03 Jun 2025 22:14:21 -0400 Received: from mail-dm6nam11olkn2017.outbound.protection.outlook.com ([40.92.19.17]:10848 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uMddi-0003hg-5Z for 78688@debbugs.gnu.org; Tue, 03 Jun 2025 22:14:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TEwXm81MquuN+PYHF1Q/1ZZlU4bEtkWL06c6Mz7eNhXonGjD9YAmfyPlEt+f1HELLYBmSIr9x2b6XXznB5pc7va+XHC0yCSNcy+fEv2WqHSpgodOMyp7Yzt7ryIjG5m5fQklZTRwTovSg7rRhwmQRNjFZrBiyC1Cqdq86Wugbf2SAL4xO0Alo061ntjv7CH1gw8Wdig2khcQbd4b+TqBQG9Z1xk8/2ieFpzBLDtFiqE1oftQ2YlDCJS52yVDjRgPg/4A/IMKRhSjx7ZgVQMHD7ItZ/IMUD/v4ibnd8ic7678Du0fcjpX90GEQAWjUZVhDiHWsQzmEERBQKG/deYrhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v3M5LUhr2MToGQTUyLbs9tNjzUxDavFV3emhsz+2JmI=; b=qaQfvfQXS7x3Txu5KR4rU5rZ7fjH2P4Q7IJVh6kswOGXjQIZ3JI+A1vNGF6308+el1s1g5JokPbJIkgQ8ogIlPHmCv1Aa2E3ltX61lM25uy9Fv6mpN1tepzHb7rJWtzaMbNLwOYaFztaP/Slh6nUjhmjs2ncDPwbIuSlvrc8zY21HRMsjguyrjz+0xT/4GPasCPcr2CynQSJAmOrcF+oD4+v86R9ehKgduOuOJR2dRaxJsauBJ57MlNQ17787ZHv8z2FaFJHT+wEGLi+51HmDKxVW4s1Mcnc7OBMiJw0RBJxOpmBD+nej2UD6R+yUho6HvEZOup8Y2FQhDph7dqNIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v3M5LUhr2MToGQTUyLbs9tNjzUxDavFV3emhsz+2JmI=; b=ho/1ty3rQwgtSyE5sHkkbbmpSPB8ASEoG08h1a+VDb6p7yX3AWSSgUEnaK/HqEAdym6hcTjhnk/mtI2sjWuIDha2dGgwKeUtqET9mh5e3ZGx2rZcZWJdtKt5s6KrU4YcjS6UHzJ7XS/PuouE9FoXUqiN/ENhE8RevZkjaCPf1XPaGdAe3VpuQ+/oxjlwemqLopLv1fcsDKqQHLa8P8tgjYKP6ulnyWROXeSX1KYU68pMeVhhoOLaN3S8jOmp5ScbpVtNGK7KcEqu9V75NtkqaxGSB93nRzFVqkjKmrHhzytvUC0GXEGH3R3RSssq/xoNEcrQ7Fmqbq1XxaNNDpMEWQ== Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) by CY5PR84MB3025.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:930:e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.20; Wed, 4 Jun 2025 02:13:55 +0000 Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5c77:7a58:48ed:9aef]) by CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5c77:7a58:48ed:9aef%3]) with mapi id 15.20.8769.035; Wed, 4 Jun 2025 02:13:55 +0000 From: Morgan Smith Date: Tue, 3 Jun 2025 22:13:21 -0400 Message-ID: X-Mailer: git-send-email 2.49.0 X-ClientProxiedBy: CH0PR03CA0449.namprd03.prod.outlook.com (2603:10b6:610:10e::25) To CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) X-Microsoft-Original-Message-ID: <9691d1c86caeed6b2a23505555735688637dd99b.1749003074.git.Morgan.J.Smith@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR84MB3424:EE_|CY5PR84MB3025:EE_ X-MS-Office365-Filtering-Correlation-Id: 76c9ae99-aa78-40a8-6d26-08dda30d74d5 X-MS-Exchange-SLBlob-MailProps: obhAqMD0nT/wHt6zADx6o2MwyeXnD1DP7qkZ/VyewdFtHTvRVCPEgMuzsPyI9FelFb35jlW4wxbSLZa+CgEeag/InAKUupwaMn8urcrza0RmkmTNlO3ETpUEFafYI6KGLCiANeRa7nUIwHlIoCDCSjiuAJlPITrMAunzcN52Xge1aKwMzVbnG9xjEhgUiptRv3QECYj0QIrVuNqBqjRyNI+XiTTe+mFwt6Hkq7oo9VwUrycXRJXK+8xAuI9+CuaTy6zycK8hayttcaztq+cGYS7Vx/ufKE+Zm3s9n1lqCTzlD+lBJ30MM788OofcItS7fHJuSFUkE4P3uOlk/N0riwsSiBM9UDR8EcaQ6ubLoS5AGLAscCrpGQZMUOo2kOj9T2vMo0NuTkeDwsoDCEDMuZ2oGN2u4Q705l5sW78U1DZUEY9jTp2iczXuM5imY5J8solAKL54uNGQYUmZzLmfU3PpRSTB8coNXpKTyQaYDwTXlFhB/YouLvjpDE/e0MtOXUXIz+kR1uaCzTMO3hnoshe9PldYi486wS+5yk7M5vjAQsAMt12pU9ynxJB0kErGLZhR1FxVYbSsyuu/Xr68nmebSaby/GHMloLgai88dyzzk12omdtP8ozYzgf5NZLjs+xKoMKmdKiRX7Ad5vB3eNR2+rLymDd6qsEeZ+Z4FnC8ernmLnfZV5QZj0ruyS7W1DR7ssmz4BJAAePcrbs7KhBwLLZx91GApQB8x8mtE1Jap2ouWj1G/BOK9IkQyvW7spep6/5lqcFzXYPYbrUdLTopqw4xfG2L2X9Fur4j01CKydhS7j2WdqbZRZ6VFxt4 X-Microsoft-Antispam: BCL:0; ARA:14566002|41001999006|5072599009|7092599006|8060799009|461199028|19110799006|15080799009|13041999003|440099028|3412199025|10035399007|12091999003|1710799026; X-Microsoft-Antispam-Message-Info: YYs5/Nk5p01Wyd4ErAn8YUqrRnAZgZkTeDfqbwThPhKTW068cPs1Fj+BLk606CVTNZv60qe0b0ci+gTwDVld5KUTH83LjT3vTzQ0fa6uIHIZVaG2cPgKAwZLuN7C8Qv5FDgyE99MM/+y3F8fwjlqZJMflI83nWq0720SyMuylQGXrC3KiOE9hs9gcbay9tte50W5VcQm3PJPGciw7LInSqaKFonDu3Z+baY1P7l81YGqgoPNfiDDOUHHAjKo2nmCl81Bhz0MK3FpDFMRk2q7spfxOarHiT4Pi8nnIvxiDzgCq6Ceuw4BKSa3dXxfII1oGuKsFO/WLRXjC/VTYoyUj23l21iPv1DH9gfk6vbBwZTA1dp5VT/FJCZ+JeEo9L5KO9ORN/XaYZ1Ai7YfIdT/aiPHhPM3Ahkd5oxLnq7KjTGG9YDWPuXWzdg7eiwST0I0zTVH+yRa1FNgytygGwIZWNBhE2yPPyQdzPRgj/Yn/V65QRw71pbcmSrvP0kVs0SrA0XIXKoT/JT1Pg5KMsU1B5epzpv9Yt+mDQGfSHsapy5PcRSGIYgCXlKCpGxwtuvpsQ+FHZtKT4NKbwiU5Gchwf/lCD8oYNTjfh6IWd3ECQjJ9Y4eU56Avk7V13ZD4djjg3Tz44C3/qaKM8dT/dhB4iaG1VAr3Bb/4cwHQHIYSlVM4J+E9YLZVHrdwiiE8kGbuYC/EqfHh5PPz9iyAfwmS4RD1Om3RMlFwudIcHwqpRRUvhUcWTF0rtDOi+1JTk1Rswfw27Ph3tgpI6ociVy45Liqy+nQ+JN5O4bLAHrByYK2ze9EkE7vq4vQ607720YWsa0OkFSZwOJ0afreq01zStnABL/1mhDfj8UDg9LZx3ckh+d5EwL6hF0YubTi15vjYpMKYVGxI+51h+DO9WezDmKmLAXiplZ0hu7tU8uQ3EzUfj+elA1s9TFQMpwY0fTA53geSq67SRsGwmyqkf5R9oh0wUsrfARtiTdTFBH4BEioN0EA6h8ylx3UY9tErfBXdPmvRfkNqnbZfSPW59t+Lp3B/8sAKIeOM04Qs6ocDgt8oWx8l7eTgeCZELjPlU5mom2b2Fk5nEDK0jEo27oqhByxqejp6svyX+LZijmY7rC4J7bOY/RZjRWN1h1m4OTDLMY5hXPHnmEp6dcajqL3hsVGK26bcsny69Ls50yPSGpYquZzGVjoHvRL+xqlDEnoU5OSGQ4b+hXk3BdiFj0ZSoBqe3tkzJP9X+iLB+uk9xMYab8QKZ58q2tan5ClyYECVyCPdhnj+R6+Y9QmeNV1wmax24NScWM11oSj9enHEa6EI2Vn5fsIEQEKWf92ARQI X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aT3EqKlRnrSfIAxRVjRDqjGv1X8OL23F5zOuzI/vnD/bei+wgeRxqERwQcRT7xjuPEY/kjGuFlyrWpf3JebIah9+oiFZ9Iw3GRvnVXYhFHrOo7Dc4HiefgMM43IwMigBg0fqThF4vhNTb1YEDJDBViSitfaY1fzIOR8N7oPP92iZuQDxUbWLuDWSbzNOEfxOKTDKE+rqpQF0QE1AH+pnlelQozv5iB0vse1B8tX95g/9aixBXC4tFgtMnXh/E97911tF/NiAY6+XmJbk9/JbgETF0AhFAAG6RERq9ZbM8VKLtAFCSGvtiAJXnGAOqMWFQJGKX6otO7tbpaznhT+nOgED51L7C7+c0S4UgO8b2mAP3PylE/JOZnK2MAut9tTDPdxJtpgYISXD2fEU+M6oIgMyL/+YzFRQXAAAolZjcbE+N6BMGk9DVZMvuuI/9bMqFnXehMaVDfRbulEwwyRTVPo0PEqU22XNHBrGzEEZmc8Sk7dyW88QC+Uhk7rO8F0M6slOLPnqmNHWNvbtcjXOhOPm67wJVRWlzapU5VQ4sv71xoC1OQQ2/kdYtzsTdMWQE5s3F7DkQ/gfCkhIrGRCxL4ynU2s6SHVgtKMVw57nnovFO7p+w5/a+kyfWnjISYbtX/5kwfEgj8x9OlPXA3EeU4up0M3BEGjjSIKgJKK9U/NV9rDB1wUoVert0YSKz9JDqOWC2u50yqOsKG9xVsE+9cwzVfL/iMtt2EId97hqo5hXIrcHHLGy8k18qnfMTe0EgYAX6whZRvc+bLmcb/E70EvUYWsES04+RH4SFFp/yHRshMKPT66d+CzUKi/mB6Ghs40XTHNRQ4lPFqvedRsCPJleJkq+fIoygRek64ZuWXgz6Rxl70a7Sas0G2pLpVKtBYqkvco9u8IfVd2Vc4S0hmVHPSQxfAcd8xFXEUggBlVQWCSZEnfscmSEAw/UuhqvgNV+ZuohjOv/snH+0sS4c9QsSeqfTN+fGFGyKvmmqgVmkrZ6QNKRwE4UYyPQQwByl8TK0AkeDN947JUYXI76eJZoScMiDJ3G/bKueElig9mnBASQ9H3HSOxtL3Lri6XjKnsj6dqKwsEEjkLHvzDzhTipcjZgojIC80mPUV9eryRCrf9o3UJ2kBUyfvyQhvslrE9alsbY3sf9jb+hmOUMbDZuSeE0UUPnsUOeBp4POhPJm7mIehFiaeLgAXQvIaVm8vrQaJmhRHCzQ+kRrvnhe1+dgt/QycXlhXREKPQV9Jluupfptlu04ZQclTVH16L/6Gi+Pd83xWFi84qD3rSVQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76c9ae99-aa78-40a8-6d26-08dda30d74d5 X-MS-Exchange-CrossTenant-AuthSource: CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2025 02:13:55.1435 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR84MB3025 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/rust.scm (rust-bootstrapped-package): Use correct package name now that custom labels are removed. (rust-bootstrap-1.54): Use gexps. Remove labels from native-inputs. (rust-1.55): Use gexps. Remove labels from inputs and native-inputs. (rust-1.56, rust-1.59, rust-1.64, rust-1.65, rust-1.74): Use gexps. (rust-1.75): Use gexps. Use correct package name now that custom labels are removed. (rust-1.76, rust-1.77, rust-1.82, rust-1.83) Use gexps. (rust): Use gexps. Remove labels from inputs and native-inputs. Change-Id: Ifc046388b251ea3db19e5b509fe04da372a529b9 --- gnu/packages/rust.scm | 1314 +++++++++++++++++++++-------------------- 1 file changed, 658 insertions(+), 656 deletions(-) base-commit: dd995e3a47340ed11b83b24fe71d13b929a7df8d diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index c24b771405..2130322942 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -127,8 +127,8 @@ (define* (rust-bootstrapped-package base-rust version checksum) (list base-rust)))) (native-inputs (modify-inputs (package-native-inputs base-rust) - (replace "rustc-bootstrap" base-rust) - (replace "cargo-bootstrap" (list base-rust "cargo")))))) + (replace "rust" base-rust) + (replace "rust:cargo" (list base-rust "cargo")))))) ;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's designed ;;; to be used in source form. @@ -203,132 +203,133 @@ (define-public rust-bootstrap-1.54 openssl-1.1 zlib)) (native-inputs - `(("pkg-config" ,pkg-config) - ("mrustc-source" ,%mrustc-source))) + (list pkg-config %mrustc-source)) (arguments - `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums' - #:modules ((guix build cargo-utils) + (list + #:imported-modules %cargo-utils-modules ;for `generate-all-checksums' + #:modules '((guix build cargo-utils) (guix build utils) (guix build gnu-build-system)) - #:test-target "test" - ;; Rust's own .so library files are not found in any RUNPATH, but - ;; that doesn't seem to cause issues. - #:validate-runpath? #f - #:make-flags - ,#~(let ((source #$(package-source this-package))) - (list (string-append "RUSTC_TARGET=" - #$(platform-rust-target - (lookup-platform-by-target-or-system - (or (%current-target-system) - (%current-system))))) - (string-append "RUSTC_VERSION=" #$version) - (string-append "MRUSTC_TARGET_VER=" - #$(version-major+minor version)) - (string-append "RUSTC_SRC_TARBALL=" source) - "OUTDIR_SUF=")) ;do not add version suffix to output dir - #:phases - (modify-phases %standard-phases - (replace 'unpack - (lambda* (#:key source inputs #:allow-other-keys) - ((assoc-ref %standard-phases 'unpack) - #:source (assoc-ref inputs "mrustc-source")))) - (add-after 'unpack 'patch-makefiles - ;; This disables building the (unbundled) LLVM. - (lambda* (#:key inputs #:allow-other-keys) - (substitute* '("minicargo.mk" - "run_rustc/Makefile") - ;; Use the system-provided LLVM. - (("LLVM_CONFIG [:|?]= .*") - (string-append "LLVM_CONFIG := " - (search-input-file inputs "/bin/llvm-config") "\n"))) - (substitute* "Makefile" - ;; Patch date and git obtained version information. - ((" -D VERSION_GIT_FULLHASH=.*") - (string-append - " -D VERSION_GIT_FULLHASH=\\\"" ,%mrustc-commit "\\\"" - " -D VERSION_GIT_BRANCH=\\\"master\\\"" - " -D VERSION_GIT_SHORTHASH=\\\"" - ,(string-take %mrustc-commit 7) "\\\"" - " -D VERSION_BUILDTIME=" - "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\"" - " -D VERSION_GIT_ISDIRTY=0\n"))) - (substitute* '("run_rustc/Makefile" - "run_rustc/rustc_proxy.sh") - ;; Patch the shebang of a generated wrapper for rustc - (("#!/bin/sh") - (string-append "#!" (which "sh")))))) - (add-before 'configure 'configure-cargo-home - (lambda _ - (let ((cargo-home (string-append (getcwd) "/.cargo"))) - (mkdir-p cargo-home) - (setenv "CARGO_HOME" cargo-home)))) - (replace 'configure - (lambda _ - (setenv "CC" "gcc") - (setenv "CXX" "g++") - ;; The Guix LLVM package installs only shared libraries. - (setenv "LLVM_LINK_SHARED" "1") - ;; rustc still insists on having 'cc' on PATH in some places - ;; (e.g. when building the 'test' library crate). - (mkdir-p "/tmp/bin") - (symlink (which "gcc") "/tmp/bin/cc") - (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH"))))) - (delete 'patch-generated-file-shebangs) - (replace 'build - (lambda* (#:key make-flags parallel-build? #:allow-other-keys) - (let ((job-count (if parallel-build? - (parallel-job-count) - 1))) - ;; Adapted from: - ;; https://github.com/dtolnay/bootstrap/blob/master/build-1.54.0.sh. - ;; Use PARLEVEL since both minicargo and mrustc use it - ;; to set the level of parallelism. - (setenv "PARLEVEL" (number->string job-count)) - (display "Building mrustc...\n") - (apply invoke "make" make-flags) + #:test-target "test" + ;; Rust's own .so library files are not found in any RUNPATH, but + ;; that doesn't seem to cause issues. + #:validate-runpath? #f + #:make-flags + #~(let ((source #$(package-source this-package))) + (list (string-append "RUSTC_TARGET=" + #$(platform-rust-target + (lookup-platform-by-target-or-system + (or (%current-target-system) + (%current-system))))) + (string-append "RUSTC_VERSION=" #$version) + (string-append "MRUSTC_TARGET_VER=" + #$(version-major+minor version)) + (string-append "RUSTC_SRC_TARBALL=" source) + "OUTDIR_SUF=")) ;do not add version suffix to output dir + #:phases + #~(modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key source inputs #:allow-other-keys) + ((assoc-ref %standard-phases 'unpack) + #:source #$(this-package-native-input + (origin-file-name %mrustc-source))))) + (add-after 'unpack 'patch-makefiles + ;; This disables building the (unbundled) LLVM. + (lambda* (#:key inputs #:allow-other-keys) + (substitute* '("minicargo.mk" + "run_rustc/Makefile") + ;; Use the system-provided LLVM. + (("LLVM_CONFIG [:|?]= .*") + (string-append "LLVM_CONFIG := " + (search-input-file inputs "/bin/llvm-config") "\n"))) + (substitute* "Makefile" + ;; Patch date and git obtained version information. + ((" -D VERSION_GIT_FULLHASH=.*") + (string-append + " -D VERSION_GIT_FULLHASH=\\\"" #$%mrustc-commit "\\\"" + " -D VERSION_GIT_BRANCH=\\\"master\\\"" + " -D VERSION_GIT_SHORTHASH=\\\"" + #$(string-take %mrustc-commit 7) "\\\"" + " -D VERSION_BUILDTIME=" + "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\"" + " -D VERSION_GIT_ISDIRTY=0\n"))) + (substitute* '("run_rustc/Makefile" + "run_rustc/rustc_proxy.sh") + ;; Patch the shebang of a generated wrapper for rustc + (("#!/bin/sh") + (string-append "#!" (which "sh")))))) + (add-before 'configure 'configure-cargo-home + (lambda _ + (let ((cargo-home (string-append (getcwd) "/.cargo"))) + (mkdir-p cargo-home) + (setenv "CARGO_HOME" cargo-home)))) + (replace 'configure + (lambda _ + (setenv "CC" "gcc") + (setenv "CXX" "g++") + ;; The Guix LLVM package installs only shared libraries. + (setenv "LLVM_LINK_SHARED" "1") + ;; rustc still insists on having 'cc' on PATH in some places + ;; (e.g. when building the 'test' library crate). + (mkdir-p "/tmp/bin") + (symlink (which "gcc") "/tmp/bin/cc") + (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH"))))) + (delete 'patch-generated-file-shebangs) + (replace 'build + (lambda* (#:key make-flags parallel-build? #:allow-other-keys) + (let ((job-count (if parallel-build? + (parallel-job-count) + 1))) + ;; Adapted from: + ;; https://github.com/dtolnay/bootstrap/blob/master/build-1.54.0.sh. + ;; Use PARLEVEL since both minicargo and mrustc use it + ;; to set the level of parallelism. + (setenv "PARLEVEL" (number->string job-count)) + (display "Building mrustc...\n") + (apply invoke "make" make-flags) - ;; This doesn't seem to build anything, but it - ;; sets additional minicargo flags. - (display "Building RUSTCSRC...\n") - (apply invoke "make" "RUSTCSRC" make-flags) + ;; This doesn't seem to build anything, but it + ;; sets additional minicargo flags. + (display "Building RUSTCSRC...\n") + (apply invoke "make" "RUSTCSRC" make-flags) - ;; This probably doesn't need to be called explicitly. - (display "Building LIBS...\n") - (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags) + ;; This probably doesn't need to be called explicitly. + (display "Building LIBS...\n") + (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags) - ;; The psm crate FTBFS on ppc64le with gcc. - (display "Building rustc...\n") - (apply invoke "make" "-f" "minicargo.mk" "output/rustc" - make-flags) + ;; The psm crate FTBFS on ppc64le with gcc. + (display "Building rustc...\n") + (apply invoke "make" "-f" "minicargo.mk" "output/rustc" + make-flags) - (display "Building cargo...\n") - (apply invoke "make" "-f" "minicargo.mk" "output/cargo" - make-flags) + (display "Building cargo...\n") + (apply invoke "make" "-f" "minicargo.mk" "output/cargo" + make-flags) - ;; This one isn't listed in the build script. - (display "Rebuilding stdlib with rustc...\n") - (apply invoke "make" "-C" "run_rustc" make-flags)))) - (replace 'install - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (cargo (assoc-ref outputs "cargo")) - (bin (string-append out "/bin")) - (rustc (string-append bin "/rustc")) - (cargo-bin (string-append cargo "/bin")) - (lib (string-append out "/lib")) - (system-lib-prefix + ;; This one isn't listed in the build script. + (display "Rebuilding stdlib with rustc...\n") + (apply invoke "make" "-C" "run_rustc" make-flags)))) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (cargo (assoc-ref outputs "cargo")) + (bin (string-append out "/bin")) + (rustc (string-append bin "/rustc")) + (cargo-bin (string-append cargo "/bin")) + (lib (string-append out "/lib")) + (system-lib-prefix (string-append lib "/rustlib/" - ,(platform-rust-target + #$(platform-rust-target (lookup-platform-by-target-or-system - (or (%current-target-system) - (%current-system)))) "/lib"))) - (mkdir-p (dirname rustc)) - (copy-file "run_rustc/output/prefix/bin/rustc_binary" rustc) - (wrap-program rustc - `("LD_LIBRARY_PATH" = (,system-lib-prefix))) - (mkdir-p lib) - (copy-recursively "run_rustc/output/prefix/lib" lib) - (install-file "run_rustc/output/prefix/bin/cargo" cargo-bin))))))) + (or (%current-target-system) + (%current-system)))) "/lib"))) + (mkdir-p (dirname rustc)) + (copy-file "run_rustc/output/prefix/bin/rustc_binary" rustc) + (wrap-program rustc + `("LD_LIBRARY_PATH" = (,system-lib-prefix))) + (mkdir-p lib) + (copy-recursively "run_rustc/output/prefix/lib" lib) + (install-file "run_rustc/output/prefix/bin/cargo" cargo-bin))))))) (synopsis "Compiler for the Rust programming language") (description "Rust is a systems programming language that provides memory safety and thread safety guarantees.") @@ -558,53 +559,54 @@ (define-public rust-1.55 (max-silent-time . 18000))) ;5 hours (for armel) (build-system gnu-build-system) (arguments - `(#:validate-runpath? #f - ;; Only the final Rust is tested, not the intermediate bootstrap ones, - ;; for performance and simplicity. - #:tests? #f - #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums' - #:modules ((guix build cargo-utils) + (list + #:validate-runpath? #f + ;; Only the final Rust is tested, not the intermediate bootstrap ones, + ;; for performance and simplicity. + #:tests? #f + #:imported-modules %cargo-utils-modules ;for `generate-all-checksums' + #:modules '((guix build cargo-utils) (guix build utils) (guix build gnu-build-system) (ice-9 match) (srfi srfi-1)) - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'set-env - (lambda* (#:key inputs #:allow-other-keys) - (setenv "SHELL" (which "sh")) - (setenv "CONFIG_SHELL" (which "sh")) - (setenv "CC" (search-input-file inputs "/bin/gcc")) - ;; The Guix LLVM package installs only shared libraries. - (setenv "LLVM_LINK_SHARED" "1"))) - (add-after 'unpack 'set-linker-locale-to-utf8 - (lambda _ - (substitute* (find-files "." "^linker.rs$") - (("linker.env\\(\"LC_ALL\", \"C\"\\);") - "linker.env(\"LC_ALL\", \"C.UTF-8\");")))) - (add-after 'unpack 'add-cc-shim-to-path - (lambda _ - (mkdir-p "/tmp/bin") - (symlink (which "gcc") "/tmp/bin/cc") - (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH"))))) - (replace 'configure - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (gcc (assoc-ref inputs "gcc")) - (python (assoc-ref inputs "python")) - (binutils (assoc-ref inputs "binutils")) - (rustc (assoc-ref inputs "rustc-bootstrap")) - (cargo (assoc-ref inputs "cargo-bootstrap")) - (llvm (assoc-ref inputs "llvm"))) - (call-with-output-file "config.toml" - (lambda (port) - (display (string-append " + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'set-env + (lambda* (#:key inputs #:allow-other-keys) + (setenv "SHELL" (which "sh")) + (setenv "CONFIG_SHELL" (which "sh")) + (setenv "CC" (search-input-file inputs "/bin/gcc")) + ;; The Guix LLVM package installs only shared libraries. + (setenv "LLVM_LINK_SHARED" "1"))) + (add-after 'unpack 'set-linker-locale-to-utf8 + (lambda _ + (substitute* (find-files "." "^linker.rs$") + (("linker.env\\(\"LC_ALL\", \"C\"\\);") + "linker.env(\"LC_ALL\", \"C.UTF-8\");")))) + (add-after 'unpack 'add-cc-shim-to-path + (lambda _ + (mkdir-p "/tmp/bin") + (symlink (which "gcc") "/tmp/bin/cc") + (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH"))))) + (replace 'configure + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (gcc (assoc-ref inputs "gcc")) + (python (search-input-file inputs "/bin/python")) + (binutils (assoc-ref inputs "binutils")) + (rustc (search-input-file inputs "/bin/rustc")) + (cargo (search-input-file inputs "/bin/cargo")) + (llvm (assoc-ref inputs "llvm"))) + (call-with-output-file "config.toml" + (lambda (port) + (display (string-append " [llvm] [build] -cargo = \"" cargo "/bin/cargo" "\" -rustc = \"" rustc "/bin/rustc" "\" +cargo = \"" cargo "\" +rustc = \"" rustc "\" docs = false -python = \"" python "/bin/python" "\" +python = \"" python "\" vendor = true submodules = false [install] @@ -616,72 +618,71 @@ (define-public rust-1.55 default-linker = \"" gcc "/bin/gcc" "\" channel = \"stable\" rpath = true -[target." ,(platform-rust-target (lookup-platform-by-system (%current-system))) "] +[target." #$(platform-rust-target (lookup-platform-by-system (%current-system))) "] llvm-config = \"" llvm "/bin/llvm-config" "\" cc = \"" gcc "/bin/gcc" "\" cxx = \"" gcc "/bin/g++" "\" ar = \"" binutils "/bin/ar" "\" [dist] ") port)))))) - (replace 'build - ;; The standard library source location moved in this release. - (lambda* (#:key parallel-build? #:allow-other-keys) - (let ((job-spec (string-append - "-j" (if parallel-build? - (number->string (parallel-job-count)) - "1")))) - (invoke "./x.py" job-spec "build" "--stage=1" - "library/std" - "src/tools/cargo")))) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (cargo-out (assoc-ref outputs "cargo")) - (build (string-append "build/" - ,(platform-rust-target - (lookup-platform-by-target-or-system + (replace 'build + ;; The standard library source location moved in this release. + (lambda* (#:key parallel-build? #:allow-other-keys) + (let ((job-spec (string-append + "-j" (if parallel-build? + (number->string (parallel-job-count)) + "1")))) + (invoke "./x.py" job-spec "build" "--stage=1" + "library/std" + "src/tools/cargo")))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (cargo-out (assoc-ref outputs "cargo")) + (build (string-append "build/" + #$(platform-rust-target + (lookup-platform-by-target-or-system (or (%current-target-system) (%current-system))))))) - ;; Manually do the installation instead of calling './x.py - ;; install', as that is slow and needlessly rebuilds some - ;; things. - (install-file (string-append build "/stage1/bin/rustc") - (string-append out "/bin")) - (copy-recursively (string-append build "/stage1/lib") - (string-append out "/lib")) - (install-file (string-append build "/stage1-tools-bin/cargo") - (string-append cargo-out "/bin"))))) - (add-after 'install 'delete-install-logs - (lambda* (#:key outputs #:allow-other-keys) - (for-each (lambda (f) - (false-if-exception (delete-file f))) - (append-map (lambda (output) - (find-files (string-append - output "/lib/rustlib") - "(^install.log$|^manifest-)")) - (map cdr outputs))))) - (add-after 'install 'wrap-rustc - (lambda* (#:key inputs outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out")) - (libc (assoc-ref inputs "libc")) - (ld-wrapper (assoc-ref inputs "ld-wrapper"))) - ;; Let gcc find ld and libc startup files. - (wrap-program (string-append out "/bin/rustc") - `("PATH" ":" prefix (,(string-append ld-wrapper "/bin"))) - `("LIBRARY_PATH" ":" - suffix (,(string-append libc "/lib")))))))))) + ;; Manually do the installation instead of calling './x.py + ;; install', as that is slow and needlessly rebuilds some + ;; things. + (install-file (string-append build "/stage1/bin/rustc") + (string-append out "/bin")) + (copy-recursively (string-append build "/stage1/lib") + (string-append out "/lib")) + (install-file (string-append build "/stage1-tools-bin/cargo") + (string-append cargo-out "/bin"))))) + (add-after 'install 'delete-install-logs + (lambda* (#:key outputs #:allow-other-keys) + (for-each (lambda (f) + (false-if-exception (delete-file f))) + (append-map (lambda (output) + (find-files (string-append + output "/lib/rustlib") + "(^install.log$|^manifest-)")) + (map cdr outputs))))) + (add-after 'install 'wrap-rustc + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (libc (assoc-ref inputs "libc")) + (ld-wrapper (assoc-ref inputs "ld-wrapper"))) + ;; Let gcc find ld and libc startup files. + (wrap-program (string-append out "/bin/rustc") + `("PATH" ":" prefix (,(string-append ld-wrapper "/bin"))) + `("LIBRARY_PATH" ":" + suffix (,(string-append libc "/lib")))))))))) (native-inputs - `(("pkg-config" ,pkg-config) - ("python" ,python-minimal-wrapper) - ("rustc-bootstrap" ,rust-bootstrap-1.54) - ("cargo-bootstrap" ,rust-bootstrap-1.54 "cargo"))) + (list + pkg-config + python-minimal-wrapper + rust-bootstrap-1.54 + `(,rust-bootstrap-1.54 "cargo"))) (inputs - `(("bash" ,bash-minimal) - ("llvm" ,llvm-13) - ("openssl" ,openssl))) + (list bash-minimal llvm-13 openssl)) ;; rustc invokes gcc, so we need to set its search paths accordingly. (native-search-paths - %gcc-search-paths) + %gcc-search-paths) ;; Limit this to systems where the final rust compiler builds successfully. (supported-systems '("x86_64-linux" "aarch64-linux" "riscv64-linux")) (synopsis "Compiler for the Rust programming language") @@ -699,17 +700,17 @@ (define-public rust-1.56 (inherit base-rust) (arguments (substitute-keyword-arguments - (strip-keyword-arguments '(#:validate-runpath?) - (package-arguments base-rust)) + (strip-keyword-arguments '(#:validate-runpath?) + (package-arguments base-rust)) ((#:phases phases) - `(modify-phases ,phases - (delete 'add-cc-shim-to-path) - (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums - (lambda _ - (substitute* "Cargo.lock" - (("(checksum = )\".*\"" all name) - (string-append name "\"" ,%cargo-reference-hash "\""))) - (generate-all-checksums "vendor")))))))))) + #~(modify-phases #$phases + (delete 'add-cc-shim-to-path) + (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums + (lambda _ + (substitute* "Cargo.lock" + (("(checksum = )\".*\"" all name) + (string-append name "\"" #$%cargo-reference-hash "\""))) + (generate-all-checksums "vendor")))))))))) (define-public rust-1.57 (rust-bootstrapped-package @@ -729,31 +730,31 @@ (define-public rust-1.58 (define-public rust-1.59 (let ((base-rust - (rust-bootstrapped-package - ;; Verified that it *doesn't* build with 1.57. e.g.: - ;; * error: `doc(primitive)` should never have been stable - ;; * error[E0522]: definition of an unknown language item: - ;; `generator_return` - ;; * error[E0206]: the trait `Copy` may not be implemented for this type - rust-1.58 "1.59.0" "1yc5bwcbmbwyvpfq7zvra78l0r8y3lbv60kbr62fzz2vx2pfxj57"))) + (rust-bootstrapped-package + ;; Verified that it *doesn't* build with 1.57. e.g.: + ;; * error: `doc(primitive)` should never have been stable + ;; * error[E0522]: definition of an unknown language item: + ;; `generator_return` + ;; * error[E0206]: the trait `Copy` may not be implemented for this type + rust-1.58 "1.59.0" "1yc5bwcbmbwyvpfq7zvra78l0r8y3lbv60kbr62fzz2vx2pfxj57"))) (package (inherit base-rust) - (arguments - (if (target-riscv64?) + (arguments + (if (target-riscv64?) (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'revert-riscv-pause-instruction - (lambda _ - ;; This fails with: - ;; error: unknown directive, referring to '.insn'. - ;; This is due to building with llvm < 14. - ;; https://github.com/rust-lang/stdarch/issues/1291 - ;; Partial roll-back from this commit: - ;; https://github.com/rust-lang/stdarch/pull/1271 - (substitute* - "library/stdarch/crates/core_arch/src/riscv_shared/mod.rs" - (("\\.insn i 0x0F, 0, x0, x0, 0x010") ".word 0x0100000F"))))))) + #~(modify-phases #$phases + (add-after 'unpack 'revert-riscv-pause-instruction + (lambda _ + ;; This fails with: + ;; error: unknown directive, referring to '.insn'. + ;; This is due to building with llvm < 14. + ;; https://github.com/rust-lang/stdarch/issues/1291 + ;; Partial roll-back from this commit: + ;; https://github.com/rust-lang/stdarch/pull/1271 + (substitute* + "library/stdarch/crates/core_arch/src/riscv_shared/mod.rs" + (("\\.insn i 0x0F, 0, x0, x0, 0x010") ".word 0x0100000F"))))))) (package-arguments base-rust)))))) (define-public rust-1.60 @@ -828,15 +829,15 @@ (define-public rust-1.64 (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) - `(modify-phases ,phases - (replace 'patch-cargo-checksums - (lambda _ - (substitute* '("Cargo.lock" - "src/bootstrap/Cargo.lock" - "src/tools/rust-analyzer/Cargo.lock") - (("(checksum = )\".*\"" all name) - (string-append name "\"" ,%cargo-reference-hash "\""))) - (generate-all-checksums "vendor")))))))))) + #~(modify-phases #$phases + (replace 'patch-cargo-checksums + (lambda _ + (substitute* '("Cargo.lock" + "src/bootstrap/Cargo.lock" + "src/tools/rust-analyzer/Cargo.lock") + (("(checksum = )\".*\"" all name) + (string-append name "\"" #$%cargo-reference-hash "\""))) + (generate-all-checksums "vendor")))))))))) (define-public rust-1.65 (let ((base-rust @@ -983,15 +984,15 @@ (define-public rust-1.71 (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) - `(modify-phases ,phases - (replace 'patch-cargo-checksums - (lambda _ - (substitute* (cons* "Cargo.lock" - "src/bootstrap/Cargo.lock" - (find-files "src/tools" "Cargo.lock")) - (("(checksum = )\".*\"" all name) - (string-append name "\"" ,%cargo-reference-hash "\""))) - (generate-all-checksums "vendor")))))))))) + #~(modify-phases #$phases + (replace 'patch-cargo-checksums + (lambda _ + (substitute* (cons* "Cargo.lock" + "src/bootstrap/Cargo.lock" + (find-files "src/tools" "Cargo.lock")) + (("(checksum = )\".*\"" all name) + (string-append name "\"" #$%cargo-reference-hash "\""))) + (generate-all-checksums "vendor")))))))))) (define-public rust-1.72 (let ((base-rust @@ -1071,12 +1072,12 @@ (define-public rust-1.74 (string-append all ", \"use-libc\""))))))) (arguments (if (target-riscv64?) - (substitute-keyword-arguments (package-arguments base-rust) - ((#:phases phases) - `(modify-phases ,phases - ;; This phase is no longer needed. - (delete 'revert-riscv-pause-instruction)))) - (package-arguments base-rust)))))) + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + #~(modify-phases #$phases + ;; This phase is no longer needed. + (delete 'revert-riscv-pause-instruction)))) + (package-arguments base-rust)))))) (define-public rust-1.75 (let ((base-rust (rust-bootstrapped-package rust-1.74 "1.75.0" @@ -1091,18 +1092,18 @@ (define-public rust-1.75 (if (supported-package? rust-bootstrap-1.74) (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'add-cc-shim-to-path - (lambda _ - (mkdir-p "/tmp/bin") - (symlink (which "gcc") "/tmp/bin/cc") - (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))))) + #~(modify-phases #$phases + (add-after 'unpack 'add-cc-shim-to-path + (lambda _ + (mkdir-p "/tmp/bin") + (symlink (which "gcc") "/tmp/bin/cc") + (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))))) (package-arguments base-rust))) (native-inputs (if (supported-package? rust-bootstrap-1.74) (modify-inputs (package-native-inputs base-rust) - (replace "cargo-bootstrap" (list rust-bootstrap-1.74 "cargo")) - (replace "rustc-bootstrap" rust-bootstrap-1.74)) + (replace "rust" rust-bootstrap-1.74) + (replace "rust:cargo" (list rust-bootstrap-1.74 "cargo"))) (package-native-inputs base-rust))) (inputs (modify-inputs (package-inputs base-rust) (replace "llvm" llvm-17)))))) @@ -1115,8 +1116,8 @@ (define-public rust-1.76 (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) - `(modify-phases ,phases - (delete 'add-cc-shim-to-path)))))))) + #~(modify-phases #$phases + (delete 'add-cc-shim-to-path)))))))) (define-public rust-1.77 (let ((base-rust (rust-bootstrapped-package rust-1.76 "1.77.1" @@ -1126,21 +1127,21 @@ (define-public rust-1.77 (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) - `(modify-phases ,phases - (add-after 'configure 'no-optimized-compiler-builtins - (lambda _ - ;; Pre-1.77, the behavior was equivalent to this flag being - ;; "false" if the llvm-project submodule wasn't checked out. - ;; - ;; Now there's an explicit check, so the build fails if we don't - ;; manually disable this (given that we don't have the submodule checked out). - ;; Thus making the build behave the same as it did in 1.76 and earlier. - ;; - ;; TODO - make the build system depend on system llvm for this, so we - ;; can get the performance benefits of setting this to true? - (substitute* "config.toml" - (("\\[build\\]") - "[build]\noptimized-compiler-builtins = false"))))))))))) + #~(modify-phases #$phases + (add-after 'configure 'no-optimized-compiler-builtins + (lambda _ + ;; Pre-1.77, the behavior was equivalent to this flag being + ;; "false" if the llvm-project submodule wasn't checked out. + ;; + ;; Now there's an explicit check, so the build fails if we don't + ;; manually disable this (given that we don't have the submodule checked out). + ;; Thus making the build behave the same as it did in 1.76 and earlier. + ;; + ;; TODO - make the build system depend on system llvm for this, so we + ;; can get the performance benefits of setting this to true? + (substitute* "config.toml" + (("\\[build\\]") + "[build]\noptimized-compiler-builtins = false"))))))))))) (define-public rust-1.78 (let ((base-rust (rust-bootstrapped-package rust-1.77 "1.78.0" @@ -1229,22 +1230,22 @@ (define-public rust-1.82 (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) - `(modify-phases ,phases - (replace 'patch-cargo-checksums - (lambda _ - (substitute* (cons* "Cargo.lock" - "src/bootstrap/Cargo.lock" - "library/Cargo.lock" - (filter - ;; Don't mess with the lock files in the - ;; Cargo testsuite; it messes up the tests. - (lambda (path) - (not (string-contains + #~(modify-phases #$phases + (replace 'patch-cargo-checksums + (lambda _ + (substitute* (cons* "Cargo.lock" + "src/bootstrap/Cargo.lock" + "library/Cargo.lock" + (filter + ;; Don't mess with the lock files in the + ;; Cargo testsuite; it messes up the tests. + (lambda (path) + (not (string-contains path "cargo/tests/testsuite"))) - (find-files "src/tools" "Cargo.lock"))) - (("(checksum = )\".*\"" all name) - (string-append name "\"" ,%cargo-reference-hash "\""))) - (generate-all-checksums "vendor")))))))))) + (find-files "src/tools" "Cargo.lock"))) + (("(checksum = )\".*\"" all name) + (string-append name "\"" #$%cargo-reference-hash "\""))) + (generate-all-checksums "vendor")))))))))) (define-public rust-1.83 (let ((base-rust (rust-bootstrapped-package rust-1.82 "1.83.0" @@ -1277,15 +1278,15 @@ (define-public rust-1.83 (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) - `(modify-phases ,phases - (add-after 'configure 'use-system-llvm - (lambda _ - (substitute* "config.toml" - (("\\[llvm\\]") "[llvm]\ndownload-ci-llvm = false") - (("\\[rust\\]") "[rust]\ndownload-rustc = false")))))))) + #~(modify-phases #$phases + (add-after 'configure 'use-system-llvm + (lambda _ + (substitute* "config.toml" + (("\\[llvm\\]") "[llvm]\ndownload-ci-llvm = false") + (("\\[rust\\]") "[rust]\ndownload-rustc = false")))))))) ;; Need llvm >= 18.0 (inputs (modify-inputs (package-inputs base-rust) - (replace "llvm" llvm-19)))))) + (replace "llvm" llvm-19)))))) (define-public rust-1.84 (rust-bootstrapped-package rust-1.83 "1.84.1" @@ -1395,359 +1396,360 @@ (define-public rust "3.14.0")))))) (arguments (substitute-keyword-arguments - (strip-keyword-arguments '(#:tests?) - (package-arguments base-rust)) + (strip-keyword-arguments '(#:tests?) + (package-arguments base-rust)) ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'relax-gdb-auto-load-safe-path - ;; Allow GDB to load binaries from any location, otherwise the - ;; gdbinfo tests fail. This is only useful when testing with a - ;; GDB version newer than 8.2. - (lambda _ - (setenv "HOME" (getcwd)) - (with-output-to-file (string-append (getenv "HOME") "/.gdbinit") - (lambda _ - (format #t "set auto-load safe-path /~%"))) - ;; Do not launch gdb with '-nx' which causes it to not execute - ;; any init file. - (substitute* "src/tools/compiletest/src/runtest.rs" - (("\"-nx\".as_ref\\(\\), ") - "")))) - (add-after 'unpack 'disable-tests-requiring-git - (lambda _ - (substitute* "src/tools/cargo/tests/testsuite/git.rs" - ,@(make-ignore-test-list - '("fn fetch_downloads_with_git2_first_" - "fn corrupted_checkout_with_cli"))) - (substitute* "src/tools/cargo/tests/testsuite/build.rs" - ,@(make-ignore-test-list - '("fn build_with_symlink_to_path_dependency_with_build_script_in_git"))) - (substitute* "src/tools/cargo/tests/testsuite/publish_lockfile.rs" - ,@(make-ignore-test-list - '("fn note_resolve_changes"))))) - (add-after 'unpack 'disable-tests-requiring-mercurial - (lambda _ - (with-directory-excursion "src/tools/cargo/tests/testsuite/cargo_init" - (substitute* '("mercurial_autodetect/mod.rs" - "simple_hg_ignore_exists/mod.rs") - ,@(make-ignore-test-list - '("fn case")))))) - (add-after 'unpack 'disable-tests-using-cargo-publish - (lambda _ - (with-directory-excursion "src/tools/cargo/tests/testsuite" - (substitute* "alt_registry.rs" - ,@(make-ignore-test-list - '("fn warn_for_unused_fields"))) - (substitute* '("cargo_add/locked_unchanged/mod.rs" - "cargo_add/lockfile_updated/mod.rs" - "cargo_remove/update_lock_file/mod.rs") - ,@(make-ignore-test-list - '("fn case"))) - (substitute* "git_shallow.rs" - ,@(make-ignore-test-list - '("fn gitoxide_clones_git_dependency_with_shallow_protocol_and_git2_is_used_for_followup_fetches" - "fn gitoxide_clones_registry_with_shallow_protocol_and_aborts_and_updates_again" - "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_fetch_maintains_shallowness" - "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_with_git2_fetch" - "fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_shallowness" - "fn gitoxide_shallow_clone_followed_by_non_shallow_update" - "fn gitoxide_clones_shallow_two_revs_same_deps" - "fn gitoxide_git_dependencies_switch_from_branch_to_rev" - "fn shallow_deps_work_with_revisions_and_branches_mixed_on_same_dependency"))) - (substitute* "install.rs" - ,@(make-ignore-test-list - '("fn failed_install_retains_temp_directory"))) - (substitute* "offline.rs" - ,@(make-ignore-test-list - '("fn gitoxide_cargo_compile_offline_with_cached_git_dep_shallow_dep"))) - (substitute* "patch.rs" - ,@(make-ignore-test-list - '("fn gitoxide_clones_shallow_old_git_patch")))))) - ,@(if (target-riscv64?) - ;; Keep this phase separate so it can be adjusted without needing - ;; to adjust the skipped tests on other architectures. - `((add-after 'unpack 'disable-tests-broken-on-riscv64 - (lambda _ - (with-directory-excursion "src/tools/cargo/tests/testsuite" - (substitute* "build.rs" - ,@(make-ignore-test-list - '("fn uplift_dwp_of_bin_on_linux"))) - (substitute* "cache_lock.rs" - ,@(make-ignore-test-list - '("fn multiple_shared" - "fn multiple_download" - "fn download_then_mutate" - "fn mutate_err_is_atomic"))) - (substitute* "global_cache_tracker.rs" - ,@(make-ignore-test-list - '("fn package_cache_lock_during_build")))) - (with-directory-excursion "src/tools/clippy/tests" - ;; `"vectorcall"` is not a supported ABI for the current target - (delete-file "ui/missing_const_for_fn/could_be_const.rs") - (substitute* "missing-test-files.rs" - ,@(make-ignore-test-list - '("fn test_missing_tests"))))))) - `()) - ,@(if (target-aarch64?) - ;; Keep this phase separate so it can be adjusted without needing - ;; to adjust the skipped tests on other architectures. - `((add-after 'unpack 'disable-tests-broken-on-aarch64 - (lambda _ - (with-directory-excursion "src/tools/cargo/tests/testsuite" - (substitute* "build_script_extra_link_arg.rs" - ,@(make-ignore-test-list - '("fn build_script_extra_link_arg_bin_single"))) - (substitute* "build_script.rs" - ,@(make-ignore-test-list - '("fn env_test"))) - (substitute* "cache_lock.rs" - ,@(make-ignore-test-list - '("fn download_then_mutate"))) - (substitute* "collisions.rs" - ,@(make-ignore-test-list - '("fn collision_doc_profile_split"))) - (substitute* "concurrent.rs" - ,@(make-ignore-test-list - '("fn no_deadlock_with_git_dependencies"))) - (substitute* "features2.rs" - ,@(make-ignore-test-list - '("fn dep_with_optional_host_deps_activated")))) - (with-directory-excursion "src/tools/clippy/tests" - ;; `"vectorcall"` is not a supported ABI for the current target - (delete-file "ui/missing_const_for_fn/could_be_const.rs") - (substitute* "missing-test-files.rs" - ,@(make-ignore-test-list - '("fn test_missing_tests"))))))) - `()) - (add-after 'unpack 'disable-tests-requiring-crates.io - (lambda _ - (with-directory-excursion "src/tools/cargo/tests/testsuite" - (substitute* "install.rs" - ,@(make-ignore-test-list - '("fn install_global_cargo_config"))) - (substitute* '("cargo_add/normalize_name_path_existing/mod.rs" - "cargo_info/within_ws_with_alternative_registry/mod.rs") - ,@(make-ignore-test-list - '("fn case"))) - (substitute* "package.rs" - ,@(make-ignore-test-list - '("fn workspace_with_local_deps_index_mismatch")))))) - (add-after 'unpack 'disable-miscellaneous-broken-tests - (lambda _ - (substitute* "src/tools/cargo/tests/testsuite/check_cfg.rs" - ;; These apparently get confused by the fact that - ;; we're building in a directory containing the - ;; string "rustc" - ,@(make-ignore-test-list - '("fn config_fingerprint" - "fn features_fingerprint"))) - (substitute* "src/tools/cargo/tests/testsuite/git_auth.rs" - ;; This checks for a specific networking error message - ;; that's different from the one we see in the builder - ,@(make-ignore-test-list - '("fn net_err_suggests_fetch_with_cli"))))) - (add-after 'unpack 'patch-command-exec-tests - ;; This test suite includes some tests that the stdlib's - ;; `Command` execution properly handles in situations where - ;; the environment or PATH variable are empty, but this fails - ;; since we don't have `echo` available at its usual FHS - ;; location. - (lambda _ - (substitute* "tests/ui/command/command-exec.rs" - (("Command::new\\(\"echo\"\\)") - (format #f "Command::new(~s)" (which "echo")))))) - (add-after 'unpack 'patch-command-uid-gid-test - (lambda _ - (substitute* "tests/ui/command/command-uid-gid.rs" - (("/bin/sh") (which "sh")) - (("/bin/ls") (which "ls"))))) - (add-after 'unpack 'skip-shebang-tests - ;; This test make sure that the parser behaves properly when a - ;; source file starts with a shebang. Unfortunately, the - ;; patch-shebangs phase changes the meaning of these edge-cases. - ;; We skip the test since it's drastically unlikely Guix's - ;; packaging will introduce a bug here. - (lambda _ - (delete-file "tests/ui/parser/shebang/sneaky-attrib.rs"))) - (add-after 'unpack 'patch-process-tests - (lambda* (#:key inputs #:allow-other-keys) - (let ((bash (assoc-ref inputs "bash"))) - (with-directory-excursion "library/std/src" - (substitute* "process/tests.rs" - (("\"/bin/sh\"") - (string-append "\"" bash "/bin/sh\""))) - ;; The three tests which are known to fail upstream on QEMU - ;; emulation on aarch64 and riscv64 also fail on x86_64 in - ;; Guix's build system. Skip them on all builds. - (substitute* "sys/pal/unix/process/process_common/tests.rs" - ;; We can't use make-ignore-test-list because we will get - ;; build errors due to the double [ignore] block. - (("target_arch = \"arm\"" arm) - (string-append "target_os = \"linux\",\n" - " " arm))))))) - (add-after 'unpack 'disable-interrupt-tests - (lambda _ - ;; This test hangs in the build container; disable it. - (substitute* "src/tools/cargo/tests/testsuite/freshness.rs" - ,@(make-ignore-test-list - '("fn linking_interrupted"))) - ;; Likewise for the ctrl_c_kills_everyone test. - (substitute* "src/tools/cargo/tests/testsuite/death.rs" - ,@(make-ignore-test-list - '("fn ctrl_c_kills_everyone"))))) - (add-after 'unpack 'adjust-rpath-values - ;; This adds %output:out to rpath, allowing us to install utilities in - ;; different outputs while reusing the shared libraries. - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) - (substitute* "src/bootstrap/src/core/builder/cargo.rs" - ((" = rpath.*" all) - (string-append all - " " - "self.rustflags.arg(\"-Clink-args=-Wl,-rpath=" - out "/lib\");\n")))))) - (add-after 'unpack 'unpack-profiler-rt - ;; Copy compiler-rt sources to where libprofiler_builtins looks - ;; for its vendored copy. - (lambda* (#:key inputs #:allow-other-keys) - (mkdir-p "src/llvm-project/compiler-rt") - (copy-recursively - (string-append (assoc-ref inputs "clang-source") - "/compiler-rt") + #~(modify-phases #$phases + (add-after 'unpack 'relax-gdb-auto-load-safe-path + ;; Allow GDB to load binaries from any location, otherwise the + ;; gdbinfo tests fail. This is only useful when testing with a + ;; GDB version newer than 8.2. + (lambda _ + (setenv "HOME" (getcwd)) + (with-output-to-file (string-append (getenv "HOME") "/.gdbinit") + (lambda _ + (format #t "set auto-load safe-path /~%"))) + ;; Do not launch gdb with '-nx' which causes it to not execute + ;; any init file. + (substitute* "src/tools/compiletest/src/runtest.rs" + (("\"-nx\".as_ref\\(\\), ") + "")))) + (add-after 'unpack 'disable-tests-requiring-git + (lambda _ + (substitute* "src/tools/cargo/tests/testsuite/git.rs" + #$@(make-ignore-test-list + '("fn fetch_downloads_with_git2_first_" + "fn corrupted_checkout_with_cli"))) + (substitute* "src/tools/cargo/tests/testsuite/build.rs" + #$@(make-ignore-test-list + '("fn build_with_symlink_to_path_dependency_with_build_script_in_git"))) + (substitute* "src/tools/cargo/tests/testsuite/publish_lockfile.rs" + #$@(make-ignore-test-list + '("fn note_resolve_changes"))))) + (add-after 'unpack 'disable-tests-requiring-mercurial + (lambda _ + (with-directory-excursion "src/tools/cargo/tests/testsuite/cargo_init" + (substitute* '("mercurial_autodetect/mod.rs" + "simple_hg_ignore_exists/mod.rs") + #$@(make-ignore-test-list + '("fn case")))))) + (add-after 'unpack 'disable-tests-using-cargo-publish + (lambda _ + (with-directory-excursion "src/tools/cargo/tests/testsuite" + (substitute* "alt_registry.rs" + #$@(make-ignore-test-list + '("fn warn_for_unused_fields"))) + (substitute* '("cargo_add/locked_unchanged/mod.rs" + "cargo_add/lockfile_updated/mod.rs" + "cargo_remove/update_lock_file/mod.rs") + #$@(make-ignore-test-list + '("fn case"))) + (substitute* "git_shallow.rs" + #$@(make-ignore-test-list + '("fn gitoxide_clones_git_dependency_with_shallow_protocol_and_git2_is_used_for_followup_fetches" + "fn gitoxide_clones_registry_with_shallow_protocol_and_aborts_and_updates_again" + "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_fetch_maintains_shallowness" + "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_with_git2_fetch" + "fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_shallowness" + "fn gitoxide_shallow_clone_followed_by_non_shallow_update" + "fn gitoxide_clones_shallow_two_revs_same_deps" + "fn gitoxide_git_dependencies_switch_from_branch_to_rev" + "fn shallow_deps_work_with_revisions_and_branches_mixed_on_same_dependency"))) + (substitute* "install.rs" + #$@(make-ignore-test-list + '("fn failed_install_retains_temp_directory"))) + (substitute* "offline.rs" + #$@(make-ignore-test-list + '("fn gitoxide_cargo_compile_offline_with_cached_git_dep_shallow_dep"))) + (substitute* "patch.rs" + #$@(make-ignore-test-list + '("fn gitoxide_clones_shallow_old_git_patch")))))) + #$@(if (target-riscv64?) + ;; Keep this phase separate so it can be adjusted without needing + ;; to adjust the skipped tests on other architectures. + `((add-after 'unpack 'disable-tests-broken-on-riscv64 + (lambda _ + (with-directory-excursion "src/tools/cargo/tests/testsuite" + (substitute* "build.rs" + #$@(make-ignore-test-list + '("fn uplift_dwp_of_bin_on_linux"))) + (substitute* "cache_lock.rs" + #$@(make-ignore-test-list + '("fn multiple_shared" + "fn multiple_download" + "fn download_then_mutate" + "fn mutate_err_is_atomic"))) + (substitute* "global_cache_tracker.rs" + #$@(make-ignore-test-list + '("fn package_cache_lock_during_build")))) + (with-directory-excursion "src/tools/clippy/tests" + ;; `"vectorcall"` is not a supported ABI for the current target + (delete-file "ui/missing_const_for_fn/could_be_const.rs") + (substitute* "missing-test-files.rs" + #$@(make-ignore-test-list + '("fn test_missing_tests"))))))) + `()) + #$@(if (target-aarch64?) + ;; Keep this phase separate so it can be adjusted without needing + ;; to adjust the skipped tests on other architectures. + `((add-after 'unpack 'disable-tests-broken-on-aarch64 + (lambda _ + (with-directory-excursion "src/tools/cargo/tests/testsuite" + (substitute* "build_script_extra_link_arg.rs" + #$@(make-ignore-test-list + '("fn build_script_extra_link_arg_bin_single"))) + (substitute* "build_script.rs" + #$@(make-ignore-test-list + '("fn env_test"))) + (substitute* "cache_lock.rs" + #$@(make-ignore-test-list + '("fn download_then_mutate"))) + (substitute* "collisions.rs" + #$@(make-ignore-test-list + '("fn collision_doc_profile_split"))) + (substitute* "concurrent.rs" + #$@(make-ignore-test-list + '("fn no_deadlock_with_git_dependencies"))) + (substitute* "features2.rs" + #$@(make-ignore-test-list + '("fn dep_with_optional_host_deps_activated")))) + (with-directory-excursion "src/tools/clippy/tests" + ;; `"vectorcall"` is not a supported ABI for the current target + (delete-file "ui/missing_const_for_fn/could_be_const.rs") + (substitute* "missing-test-files.rs" + #$@(make-ignore-test-list + '("fn test_missing_tests"))))))) + `()) + (add-after 'unpack 'disable-tests-requiring-crates.io + (lambda _ + (with-directory-excursion "src/tools/cargo/tests/testsuite" + (substitute* "install.rs" + #$@(make-ignore-test-list + '("fn install_global_cargo_config"))) + (substitute* '("cargo_add/normalize_name_path_existing/mod.rs" + "cargo_info/within_ws_with_alternative_registry/mod.rs") + #$@(make-ignore-test-list + '("fn case"))) + (substitute* "package.rs" + #$@(make-ignore-test-list + '("fn workspace_with_local_deps_index_mismatch")))))) + (add-after 'unpack 'disable-miscellaneous-broken-tests + (lambda _ + (substitute* "src/tools/cargo/tests/testsuite/check_cfg.rs" + ;; These apparently get confused by the fact that + ;; we're building in a directory containing the + ;; string "rustc" + #$@(make-ignore-test-list + '("fn config_fingerprint" + "fn features_fingerprint"))) + (substitute* "src/tools/cargo/tests/testsuite/git_auth.rs" + ;; This checks for a specific networking error message + ;; that's different from the one we see in the builder + #$@(make-ignore-test-list + '("fn net_err_suggests_fetch_with_cli"))))) + (add-after 'unpack 'patch-command-exec-tests + ;; This test suite includes some tests that the stdlib's + ;; `Command` execution properly handles in situations where + ;; the environment or PATH variable are empty, but this fails + ;; since we don't have `echo` available at its usual FHS + ;; location. + (lambda _ + (substitute* "tests/ui/command/command-exec.rs" + (("Command::new\\(\"echo\"\\)") + (format #f "Command::new(~s)" (which "echo")))))) + (add-after 'unpack 'patch-command-uid-gid-test + (lambda _ + (substitute* "tests/ui/command/command-uid-gid.rs" + (("/bin/sh") (which "sh")) + (("/bin/ls") (which "ls"))))) + (add-after 'unpack 'skip-shebang-tests + ;; This test make sure that the parser behaves properly when a + ;; source file starts with a shebang. Unfortunately, the + ;; patch-shebangs phase changes the meaning of these edge-cases. + ;; We skip the test since it's drastically unlikely Guix's + ;; packaging will introduce a bug here. + (lambda _ + (delete-file "tests/ui/parser/shebang/sneaky-attrib.rs"))) + (add-after 'unpack 'patch-process-tests + (lambda* (#:key inputs #:allow-other-keys) + (let ((bash (assoc-ref inputs "bash"))) + (with-directory-excursion "library/std/src" + (substitute* "process/tests.rs" + (("\"/bin/sh\"") + (string-append "\"" bash "/bin/sh\""))) + ;; The three tests which are known to fail upstream on QEMU + ;; emulation on aarch64 and riscv64 also fail on x86_64 in + ;; Guix's build system. Skip them on all builds. + (substitute* "sys/pal/unix/process/process_common/tests.rs" + ;; We can't use make-ignore-test-list because we will get + ;; build errors due to the double [ignore] block. + (("target_arch = \"arm\"" arm) + (string-append "target_os = \"linux\",\n" + " " arm))))))) + (add-after 'unpack 'disable-interrupt-tests + (lambda _ + ;; This test hangs in the build container; disable it. + (substitute* "src/tools/cargo/tests/testsuite/freshness.rs" + #$@(make-ignore-test-list + '("fn linking_interrupted"))) + ;; Likewise for the ctrl_c_kills_everyone test. + (substitute* "src/tools/cargo/tests/testsuite/death.rs" + #$@(make-ignore-test-list + '("fn ctrl_c_kills_everyone"))))) + (add-after 'unpack 'adjust-rpath-values + ;; This adds %output:out to rpath, allowing us to install utilities in + ;; different outputs while reusing the shared libraries. + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (substitute* "src/bootstrap/src/core/builder/cargo.rs" + ((" = rpath.*" all) + (string-append all + " " + "self.rustflags.arg(\"-Clink-args=-Wl,-rpath=" + out "/lib\");\n")))))) + (add-after 'unpack 'unpack-profiler-rt + ;; Copy compiler-rt sources to where libprofiler_builtins looks + ;; for its vendored copy. + (lambda* (#:key inputs #:allow-other-keys) + (mkdir-p "src/llvm-project/compiler-rt") + (copy-recursively + ;; clang-source + (search-input-directory inputs "/compiler-rt") "src/llvm-project/compiler-rt"))) - (add-after 'configure 'enable-profiling - (lambda _ - (substitute* "config.toml" - (("^profiler =.*$") "") - (("\\[build\\]") "\n[build]\nprofiler = true\n")))) - (add-after 'configure 'add-gdb-to-config - (lambda* (#:key inputs #:allow-other-keys) - (let ((gdb (assoc-ref inputs "gdb"))) - (substitute* "config.toml" - (("^python =.*" all) - (string-append all - "gdb = \"" gdb "/bin/gdb\"\n")))))) - (replace 'build - ;; Phase overridden to also build more tools. - (lambda* (#:key parallel-build? #:allow-other-keys) - (let ((job-spec (string-append - "-j" (if parallel-build? - (number->string (parallel-job-count)) - "1")))) - (invoke "./x.py" job-spec "build" - "library/std" ;rustc - "src/tools/cargo" - "src/tools/clippy" - "src/tools/rust-analyzer" - "src/tools/rustfmt" - ;; Needed by rust-analyzer and editor plugins - "src/tools/rust-analyzer/crates/proc-macro-srv-cli")))) - (replace 'check - ;; Phase overridden to also test more tools. - (lambda* (#:key tests? parallel-build? #:allow-other-keys) - (when tests? - (let ((job-spec (string-append - "-j" (if parallel-build? - (number->string (parallel-job-count)) - "1")))) - (invoke "./x.py" job-spec "test" "-vv" - "library/std" - "src/tools/cargo" - "src/tools/clippy" - "src/tools/rust-analyzer" - "src/tools/rustfmt"))))) - (replace 'install - ;; Phase overridden to also install more tools. - (lambda* (#:key outputs #:allow-other-keys) - (invoke "./x.py" "install") - ;; This one doesn't have an install target so - ;; we need to install manually. - (install-file (string-append + (add-after 'configure 'enable-profiling + (lambda _ + (substitute* "config.toml" + (("^profiler =.*$") "") + (("\\[build\\]") "\n[build]\nprofiler = true\n")))) + (add-after 'configure 'add-gdb-to-config + (lambda* (#:key inputs #:allow-other-keys) + (let ((gdb (search-input-file inputs "/bin/gdb"))) + (substitute* "config.toml" + (("^python =.*" all) + (string-append all + "gdb = \"" gdb "\"\n")))))) + (replace 'build + ;; Phase overridden to also build more tools. + (lambda* (#:key parallel-build? #:allow-other-keys) + (let ((job-spec (string-append + "-j" (if parallel-build? + (number->string (parallel-job-count)) + "1")))) + (invoke "./x.py" job-spec "build" + "library/std" ;rustc + "src/tools/cargo" + "src/tools/clippy" + "src/tools/rust-analyzer" + "src/tools/rustfmt" + ;; Needed by rust-analyzer and editor plugins + "src/tools/rust-analyzer/crates/proc-macro-srv-cli")))) + (replace 'check + ;; Phase overridden to also test more tools. + (lambda* (#:key tests? parallel-build? #:allow-other-keys) + (when tests? + (let ((job-spec (string-append + "-j" (if parallel-build? + (number->string (parallel-job-count)) + "1")))) + (invoke "./x.py" job-spec "test" "-vv" + "library/std" + "src/tools/cargo" + "src/tools/clippy" + "src/tools/rust-analyzer" + "src/tools/rustfmt"))))) + (replace 'install + ;; Phase overridden to also install more tools. + (lambda* (#:key outputs #:allow-other-keys) + (invoke "./x.py" "install") + ;; This one doesn't have an install target so + ;; we need to install manually. + (install-file (string-append "build/" - ,(platform-rust-target + #$(platform-rust-target (lookup-platform-by-system - (%current-system))) + (%current-system))) "/stage1-tools-bin/rust-analyzer-proc-macro-srv") - (string-append (assoc-ref outputs "out") "/libexec")) - (substitute* "config.toml" - ;; Adjust the prefix to the 'cargo' output. - (("prefix = \"[^\"]*\"") - (format #f "prefix = ~s" (assoc-ref outputs "cargo")))) - (invoke "./x.py" "install" "cargo") - (substitute* "config.toml" - ;; Adjust the prefix to the 'tools' output. - (("prefix = \"[^\"]*\"") - (format #f "prefix = ~s" (assoc-ref outputs "tools")))) - (invoke "./x.py" "install" "clippy") - (invoke "./x.py" "install" "rust-analyzer") - (invoke "./x.py" "install" "rustfmt"))) - (add-before 'patch-cargo-checksums 'save-old-library-manifest - (lambda _ - (copy-file "library/Cargo.lock" ".old-library-manifest"))) - (add-after 'install 'install-rust-src - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "rust-src")) - (dest "/lib/rustlib/src/rust")) - (mkdir-p (string-append out dest)) - (copy-recursively "library" (string-append out dest "/library")) - ;; rust-analyzer needs the original checksums; otherwise - ;; it fails to cargo manifest in the stdlib, and then - ;; analysis/inference involving stdlib structs doesn't work. - ;; - ;; For example, in the following trivial program: - ;; - ;; fn main() { - ;; let x = Vec::::new(); - ;; } - ;; - ;; rust-analyzer since version 1.82 can't infer - ;; the type of x unless the following line is present. - (copy-file ".old-library-manifest" - (string-append out dest "/library/Cargo.lock")) - (copy-recursively "src" (string-append out dest "/src"))))) - (add-before 'install 'remove-uninstall-script - (lambda _ - ;; Don't install the uninstall script. It has no use - ;; on Guix and it retains a reference to the host's bash. - (substitute* "src/tools/rust-installer/install-template.sh" - (("install_uninstaller \"") "# install_uninstaller \"")))) - (add-after 'install-rust-src 'wrap-rust-analyzer - (lambda* (#:key outputs #:allow-other-keys) - (let ((bin (string-append (assoc-ref outputs "tools") "/bin"))) - (rename-file (string-append bin "/rust-analyzer") - (string-append bin "/.rust-analyzer-real")) - (call-with-output-file (string-append bin "/rust-analyzer") - (lambda (port) - (format port "#!~a + (string-append (assoc-ref outputs "out") "/libexec")) + (substitute* "config.toml" + ;; Adjust the prefix to the 'cargo' output. + (("prefix = \"[^\"]*\"") + (format #f "prefix = ~s" (assoc-ref outputs "cargo")))) + (invoke "./x.py" "install" "cargo") + (substitute* "config.toml" + ;; Adjust the prefix to the 'tools' output. + (("prefix = \"[^\"]*\"") + (format #f "prefix = ~s" (assoc-ref outputs "tools")))) + (invoke "./x.py" "install" "clippy") + (invoke "./x.py" "install" "rust-analyzer") + (invoke "./x.py" "install" "rustfmt"))) + (add-before 'patch-cargo-checksums 'save-old-library-manifest + (lambda _ + (copy-file "library/Cargo.lock" ".old-library-manifest"))) + (add-after 'install 'install-rust-src + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "rust-src")) + (dest "/lib/rustlib/src/rust")) + (mkdir-p (string-append out dest)) + (copy-recursively "library" (string-append out dest "/library")) + ;; rust-analyzer needs the original checksums; otherwise + ;; it fails to cargo manifest in the stdlib, and then + ;; analysis/inference involving stdlib structs doesn't work. + ;; + ;; For example, in the following trivial program: + ;; + ;; fn main() { + ;; let x = Vec::::new(); + ;; } + ;; + ;; rust-analyzer since version 1.82 can't infer + ;; the type of x unless the following line is present. + (copy-file ".old-library-manifest" + (string-append out dest "/library/Cargo.lock")) + (copy-recursively "src" (string-append out dest "/src"))))) + (add-before 'install 'remove-uninstall-script + (lambda _ + ;; Don't install the uninstall script. It has no use + ;; on Guix and it retains a reference to the host's bash. + (substitute* "src/tools/rust-installer/install-template.sh" + (("install_uninstaller \"") "# install_uninstaller \"")))) + (add-after 'install-rust-src 'wrap-rust-analyzer + (lambda* (#:key outputs #:allow-other-keys) + (let ((bin (string-append (assoc-ref outputs "tools") "/bin"))) + (rename-file (string-append bin "/rust-analyzer") + (string-append bin "/.rust-analyzer-real")) + (call-with-output-file (string-append bin "/rust-analyzer") + (lambda (port) + (format port "#!~a if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi; exec -a \"$0\" \"~a\" \"$@\"" - (which "bash") - (string-append (assoc-ref outputs "rust-src") - "/lib/rustlib/src/rust/library") - (string-append bin "/.rust-analyzer-real")))) - (chmod (string-append bin "/rust-analyzer") #o755)))))))) + (which "bash") + (string-append (assoc-ref outputs "rust-src") + "/lib/rustlib/src/rust/library") + (string-append bin "/.rust-analyzer-real")))) + (chmod (string-append bin "/rust-analyzer") #o755)))))))) (inputs (modify-inputs (package-inputs base-rust) - (prepend curl libffi `(,nghttp2 "lib") zlib))) - (native-inputs (cons* - ;; Keep in sync with the llvm used to build rust. - `("clang-source" ,(package-source clang-runtime-19)) - ;; Add test inputs. - `("gdb" ,gdb/pinned) - `("procps" ,procps) - (package-native-inputs base-rust))) + (prepend curl libffi `(,nghttp2 "lib") zlib))) + (native-inputs + (modify-inputs (package-native-inputs base-rust) + (prepend + ;; Keep in sync with the llvm used to build rust. + (package-source clang-runtime-19) + ;; Add test inputs. + gdb/pinned + procps))) (native-search-paths (cons - ;; For HTTPS access, Cargo reads from a single-file certificate - ;; specified with $CARGO_HTTP_CAINFO. See - ;; https://doc.rust-lang.org/cargo/reference/environment-variables.html - (search-path-specification - (variable "CARGO_HTTP_CAINFO") - (file-type 'regular) - (separator #f) ;single entry - (files '("etc/ssl/certs/ca-certificates.crt"))) - ;; rustc invokes gcc, so we need to set its search paths accordingly. - %gcc-search-paths))))) + ;; For HTTPS access, Cargo reads from a single-file certificate + ;; specified with $CARGO_HTTP_CAINFO. See + ;; https://doc.rust-lang.org/cargo/reference/environment-variables.html + (search-path-specification + (variable "CARGO_HTTP_CAINFO") + (file-type 'regular) + (separator #f) ;single entry + (files '("etc/ssl/certs/ca-certificates.crt"))) + ;; rustc invokes gcc, so we need to set its search paths accordingly. + %gcc-search-paths))))) (define*-public (make-rust-sysroot target) (make-rust-sysroot/implementation target rust))