From patchwork Mon Apr 7 20:07:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morgan Smith X-Patchwork-Id: 41420 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 4E05027BC4A; Mon, 7 Apr 2025 21:10:00 +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=unavailable 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 65B9F27BC49 for ; Mon, 7 Apr 2025 21:09:57 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u1smI-0006IZ-3E; Mon, 07 Apr 2025 16:09:06 -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 1u1smG-0006Hx-U4 for guix-patches@gnu.org; Mon, 07 Apr 2025 16:09:04 -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 1u1smG-0007uW-KD for guix-patches@gnu.org; Mon, 07 Apr 2025 16:09:04 -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:References:In-Reply-To:Date:From:To:Subject; bh=5LgOlzt4Idrhlf8yuamcD+d0iSbXRMEyGQXaKPwTKKE=; b=BbUxj12QcWX3ko9TuU2tmRyI7rcgq0VX3Wnju2UFJStrZCGkDDZAMKeod/EeQJ8z0FLRQ8HW8eOAZ+PL6B8WwjkR6SQ2BQEdGeCnqN3zzIIVfKfFwTcPQjKVM9xi5I6tt8X92X1cwK4WwIhGFHut3rSczzi1qjFqlyNPEhmcfAtNk8tQlAh1R+Jl7OXXrgE4DGgD7eGUSyTgKO8Yd927ZIPmD8M0VqV9DUT4Ry7WyMZRQh1GAwKc80xz7sLLJvXxr3232DzLqg7cCRUF4/lEMN9WHffFkCeZH89CwNfQEO7BIuEcSmO3er9KzU9fo7ZUa2Y5ISwRiuOeCLf7o29Itw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u1smG-000448-F1; Mon, 07 Apr 2025 16:09:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77616] [PATCH 6/6] gnu: rust: Use gexps. Resent-From: Morgan Smith Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 07 Apr 2025 20:09:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77616@debbugs.gnu.org Cc: Morgan Smith , Divya Ranjan Pattanaik , Efraim Flashner , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Steve George Received: via spool by 77616-submit@debbugs.gnu.org id=B77616.174405652615522 (code B ref 77616); Mon, 07 Apr 2025 20:09:04 +0000 Received: (at 77616) by debbugs.gnu.org; 7 Apr 2025 20:08:46 +0000 Received: from localhost ([127.0.0.1]:57049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1slu-000420-IW for submit@debbugs.gnu.org; Mon, 07 Apr 2025 16:08:46 -0400 Received: from mail-dm6nam12olkn20818.outbound.protection.outlook.com ([2a01:111:f403:2c17::818]:26465 helo=NAM12-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 1u1slj-00040H-7h for 77616@debbugs.gnu.org; Mon, 07 Apr 2025 16:08:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tCE5Y5kcA5b+grgrNpHfWMFudyg1UzE1mrEh3lqBHmR/q2yc5niLZ2/fO8OaJTys5WmfI58vS/ceJVB3/HdJh2CALAuJC5Vzh5vEKS+BgmMBFsgBZhJwfAq+JBGoEYrjQb7GKJ9Q82UvyCplzuwguuLFwVvQsJPbe/pnYeZGPGYhHGUKOVIZ8Et/flxJPHfEJuX4+pong5oeBaGXOW2faQk/GMwlKl0IZz7A9W98aoTGd00ljLeLvJieYkWpfBJ1Bw+X9sZO6/ARzBG8e1INiXlJcDx7v1AQQ67hbORhjOzHbysu3MgXHW37Yvt28qZzToDQAv+wFAcGxvc37naoZQ== 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=5LgOlzt4Idrhlf8yuamcD+d0iSbXRMEyGQXaKPwTKKE=; b=K7/OohbpTVHKo5L5NYTaUK/F7gJG8tjQooA2ALoH2NIiJHtqUTP5HsirCCjahvpKRTEP75x9aWr2HZHKefhwgyFg46UVp4qEnaWlHJSQRCi5snnDL2calyZF4Hc3f63TE9V+xsitL+6sMxgav0lmC2eQpg/iWlYU75tmeBIN0GmEGKeUHF2S2hqpePERtksztZmZlkrUW7Tm3ffvuZYGUo6Z2gKpgQ0BJ8rA4bl09F0wFPbOtlm4r2PvEUfR/+E87FE/nDtjMzBPNXCS5g93/ItBTEjFeBSA0qsAfZ25ZlkEgn62Kkri9ob37MXpg4KLnYH6SS+9q4wy1ei5sUzJfg== 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=5LgOlzt4Idrhlf8yuamcD+d0iSbXRMEyGQXaKPwTKKE=; b=HInwz3aNzSPXlq2/jtBynsmEqobHr+4Eu9koSVkQX7xOQiJGrRHmIIYNjZoOpkVWpUN4QOm0CM4ms9hxPOkgiE5gxAazoWtf0GsrCRAMpH8gt0NLbB5j/djSYW4B4BYeKZVSBidpGMCWbR1kJSEK2g89aP1irH/T7dJd+lGfQoAguIyjk2yogUZgaCn5SV0mBNCy7LXF2QxfwCBMTLteeL28SZILvAzs7ZmZlrRTHKzBHYhx00kVPUXap/ZnsQ2VoQsXlBtqrPjqdSZfvRFJmbMcdjT8RJ7G4WlQ4GH9X5tOe6Sd6nxl8q6lLvIDjFnL9QGzcBqf+zCeaO6SdXHSsw== Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) by DS0PR84MB3589.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:8:1b8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.31; Mon, 7 Apr 2025 20:08:24 +0000 Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5c77:7a58:48ed:9aef]) by CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5c77:7a58:48ed:9aef%5]) with mapi id 15.20.8606.033; Mon, 7 Apr 2025 20:08:24 +0000 From: Morgan Smith Date: Mon, 7 Apr 2025 16:07:50 -0400 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: <2141283854b61187d507f0dfaf768e3416e09845.1744056453.git.Morgan.J.Smith@outlook.com> References: <2141283854b61187d507f0dfaf768e3416e09845.1744056453.git.Morgan.J.Smith@outlook.com> X-ClientProxiedBy: YT4PR01CA0026.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:fe::11) To CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) X-Microsoft-Original-Message-ID: <31f87e1cdcd51500c16e37ab5aca27a797db6029.1744056453.git.Morgan.J.Smith@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR84MB3424:EE_|DS0PR84MB3589:EE_ X-MS-Office365-Filtering-Correlation-Id: 55bf99cc-ef02-44df-334e-08dd760ff37a X-Microsoft-Antispam: BCL:0; ARA:14566002|461199028|8060799006|15080799006|7092599003|19110799003|5072599009|41001999003|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: DHlOvqKiVsR62ucrb6+KZfzTkeEehQuXs27s/iX7YNFUSPM3JkIbL0NrgryUx4iwpdb7guqGSarVHnG+r45rnrd7twNwrJo8DnQwNaXu05p6XXAciG4eaLbd9djkr4RcvtjsUs5YA7VTVmY+yRRoIMWzteG7X7tqF7SIhwFSqsQnPGW+OZKk6V3YmZqPHQ4mESM0BXTWl4YM7mDjWjiAE3i05AbiyU4E5oURolJc0Mhct/BbtMsDLwezOdbPCcAOheZTr0jAwM2mocvL3mU1PruvC4hK7XdlFICyTB9O47i3Y1ihvPUFsH0ZgW0RNmBXW9eBmvvYjb6j7AWvFo8J+uOL4av0cFuATXUIBf2T7jzRTn3acjiVsFZsOUZZHlsQr0LBIDOjsJPFNbWu44KR5jLSigfJ2ga4dkCnP/9o+JPTUDSU0L0Bj1nuWHdP7renkhgu+X8KjcFw4Cob3eU1Kxk+AUw00OVAAsikrmkbFKMQdoJvfg9VfRZcdcFsYd3tsYV9D8VIDb+MHHf8C3+/uI8GPpbcqp9lWgPNFvqD02BUDTizo9GSgyz9fevKppW6MFdeIJbt6Dhau19Hol+4R9YqbRuOiEBp3BmLJ8k4u4vFsd5J2GfegQdkot6nmN3HJ3PzHgQaIOk4SbXAMSf4qdmuFZVUP458nXyfiaHC8YuobUvU7ADCmkpcKTmg7zlCNnAZjDAevu0QNDTT4J5wpGB9a9LJBiV+5+g7npuyodAK4TrRrWls8mfdHQLsrso7J8qlSGSL6QvbOdJvetXZGjbHhSF3YSt/x/rQ+0v6Tnu9CobBmRvq8RQrDWSosmhtQWwpWSPBZM5mk40J+Nm23/5H0zJq5Xp3xXLVCPl6RhsAQO4XnzSU6VyVt3MAn96ugQL6WFaM5diSlx/TP946K4MGGEVzxsH0vxljsekuh+vmwswxwcNrZsy7sZhehybto2QUHILTE6bmW9yggBotQmddZCV2IZH/01gxc5qVmuz66Pp6fhLQTWFPD+qzhDbvgcLrU9bFvZXMWTTfqWFfG/XhfTRDZXNeNlD6lG77Bj2FoQp6BwjnxdUMI+P/8qgJQErf6s3z20QBariD14yLl29OcXCg9DsqPMADlc4Hh0eF+gCdm8krWSU4S2Dji6A2/uo7R1zXQsfrHr07jAK5tIpuZ7G1tpiPD+CuvqWa3gc= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5VhsJ636OhNBJUS6b41DE3s00KgFCsyz4RiYYCT/0bAA6x0oOB/OecFG+lcuNRSniz9+eS7laECOaxoIGJwD0iQtuGlDtBZNEM9VJz03f1CgUcznDcj/q3cBJV7POkwp8L4jXyDihFEmRWRzjc4O6gsUKB1lKRVTmxdzKaPXnKEq01NWsJpfwFKe8anFWCI8601L8an8D3BzuWsVzZa7QvZYxETCS2CZPXILEWuXwCBFfyPp6PVPmJ06PIVBfy8wa/2lSZOJUvh8LAQokVrUlE7yEUfrXm4qWsaom/UY3Qc6uBOTSM4gZR5AHC2gGrGJ8RvpZLkfJqTxuH87pzTZR4+mXqLblpE9SxQFNURd8gJEhhuqHfVy6ncZVNPAmETMnUeAcbvWfnAzQ07tE0hCQ+Ca7KFCURczN5QP/l0sXJW7HwYKFocpGfW0U3wYK1A9RTAqNyzsEsfdceNqn+mb8sBouwp+WtplIsKYg8r+sWRFltpujPYuc4+hz8qFZqIhJunmcRRL8NrjRIHFlWmE+AgZqX2lnpyEArvZxe9H4K5i3OId4AoGCE4W7zunn8FqAFglHRSd9JZO4t6suZDYc93gxJOt9OZ8JguZ/5+IiU5kN0BXntP0ONhoWxJp2jIpmw5j+ds/+HjcE6NfIOjhLD+zpwddvKNN665yIyT9eoNuPMtlyrh39+As8JQpniBuo6ygfIIcPCg+LJLmiXvbbeGqYuRPn51HZimifMfy6E0MsrArLgYQzDArMOHqx/CwdCVtDKDKEIDAXX9/HxN0Y76PWBB+fwKCcn+IotAcPN7FZj6oD//vIrMKsu7B5JaoJfP+Gd8GdmViUcOKOiqR174OfRkG85cwcTqJs9lRlIVM8WeF8FcNQDom6XSj12JPP4WtBp4SSUPDHr95TYG5h3N68pJZIJ2nNMDWacdRRz06NezFkR9SPRfnaVSFBvIQTB6L1sF2BVIiPemg6M4UzT6CadB/wiTVCKoku19gJtGvolUDyPr1XIbCpxlzmkK/kbMBaajbCiBhhAeSGjGNY5QhIWhYCQGqfJ0QQk/07kH0uim+0Du36Zmis18JKsyV1LGVHKY5bWZEFLhaatb9zV16i0C/EK/LdPBZ3PZl2ItjOLufEJHhqoWe7Im1vGgbcZBuyKmJReO3TKQpVjXaxRGt7Nlmn9BoIUoAIr6BiHTCKD+ZpE64nEc3w+MZZc1CAsoF09Blv0qf3XqBjE5hxIA2B8EKKBUZTjepY634RkG5W7u+iijN6iNVdRZB7PSP X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55bf99cc-ef02-44df-334e-08dd760ff37a X-MS-Exchange-CrossTenant-AuthSource: CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2025 20:08:24.0978 (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: DS0PR84MB3589 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-1.77, rust-1.82, rust-1.83, rust-1.85): Use gexps. Change-Id: I87d7cd80cb1d294b6f4d8fc56bfcef141fe01120 --- gnu/packages/rust.scm | 697 +++++++++++++++++++++--------------------- 1 file changed, 349 insertions(+), 348 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 4b0e9a3666..563923a677 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -520,21 +520,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" @@ -623,22 +623,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" @@ -671,12 +671,12 @@ (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)))))) @@ -792,327 +792,328 @@ (define-public 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-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")) - (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-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")) + (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))) + (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