From patchwork Mon Apr 7 20:07:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morgan Smith X-Patchwork-Id: 41415 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 E7BEA27BC4F; Mon, 7 Apr 2025 21:09:32 +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 4C38B27BC49 for ; Mon, 7 Apr 2025 21:09:30 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u1smH-0006I5-Hg; Mon, 07 Apr 2025 16:09:05 -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-0006Hf-0w 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 1u1smF-0007uA-Mv for guix-patches@gnu.org; Mon, 07 Apr 2025 16:09:03 -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=hcAFnS5AVFstcHI+mjlFGbEwl754NCH7UkOPB7XeSfs=; b=PPGD2DKgjDHxCN9HCLLLk9lBwP2p6MXY5od3bSIfMtbKoCF+nrW5ID4SMC7Jo6gjMwctsvZAFRPyeyklA7zVYrtN+jJTJa5zT+Q03tiQhbg67f4FXoZzgvbSpv8xmfKttWZ7Cu/9uM74leM7TA/wyEgVpCEfQLo8EWvRvfv6NcBrRmPR64zFsin6wu6qSEE2jEWZ/OwiIeqPeQQxIWuSehLo1FKZ7+kHWPjHnffdNje+X+EkmZroCiiR0HzmCt0nhcwi+S8ES/E/Nums9x+j4NCnTY6peB/mY+F4WVmNT6VUoOxk3wsULSqkglZHGOrmJaAz3gRn264eOmrSRBV32g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u1smE-00043N-Et; Mon, 07 Apr 2025 16:09:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77616] [PATCH 2/6] gnu: rust-bootstrap: Update to 1.74.0. 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:02 +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.174405650115387 (code B ref 77616); Mon, 07 Apr 2025 20:09:02 +0000 Received: (at 77616) by debbugs.gnu.org; 7 Apr 2025 20:08:21 +0000 Received: from localhost ([127.0.0.1]:57035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1slY-0003zs-7M for submit@debbugs.gnu.org; Mon, 07 Apr 2025 16:08:21 -0400 Received: from mail-dm6nam12olkn20817.outbound.protection.outlook.com ([2a01:111:f403:2c17::817]:25953 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 1u1slT-0003z0-5G for 77616@debbugs.gnu.org; Mon, 07 Apr 2025 16:08:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hMymr5cLoehsx6J0uM1+d+ZeQF8NBx4YkYBPVWFk+/kowpdwI8HITi66RkEs8PTTZm02j10+riI4tl7cz3HkIfy21t329YzfGVtBSP6CHa4gDsp29/Lvzk2cZMZ0ZuxuB9DAQvaaCZ4HicTDncoX9nL6R/ZY9X4Ckk2fP10JxIh3MjlQxe1JtUp+WwoB+Jp3gDFkk8alpk4EEbtxxm/fWH+U7DPY9AT2MGYchJDTRqLtyG2md2Y34mBpA7MprxABvXV7KWlcARJXmUvkYdvRH/EmcNagKkZpbJyrlyf9SsQdoTm2ZR+OvvaoTWaSS2PC6KSwcVvN9siai3wj7fo/UA== 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=hcAFnS5AVFstcHI+mjlFGbEwl754NCH7UkOPB7XeSfs=; b=isPkMLE+WnYDNszVxA9kjhi5keFLDJ8yYu15HFiTAtRTthVCDBrv6awEEkyddKd6QejPd5b8VDVNXErPSLaZ/LxP04FKAhMonUGCFyqTW3nsSTLh9er4y14XH+H7zRhA9nsrLt7PON/ezzUmrKkE9ZxFI+HZCcC7YMuhW3zIrz1N4RquMLuE7pvbJ8aMjLisds5C/ssr82+qij1kkbPRt1VwpcyVz97gcH+ZcJ/bWAHM7teAjT9sKx8dQuh73aCLdS1ksnDza6x4uEycHjjJG9mfJeAbWusQQqUyR5I+t+iAOP0mK7WzIhBNGxqn/sFIQ+TdE88wxs+rlqCGy12+Mw== 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=hcAFnS5AVFstcHI+mjlFGbEwl754NCH7UkOPB7XeSfs=; b=GoAARhG3AXW9F5cggIDuaydDk9GRFYTKQBA5k1B6foh9X4rMVG/YDn1IbquvcEtMA7eK+sc3DhyJObkppyI31TtRyJF7Y8AtEzNNRKD+YaovT7EXj1huLNXfZWWK9na7OkbULLjjeN5YCCVmwn5ki38l8+EVkmOqCrCu8/RuRggW9F2DPUZP2/chzZ5jtNJboG4Prt1NosSSL9u1NO9OxRReyHQAvntvAxZrHCCnLLOks9R0kZcWgHOtqikwCGxt/KosfF2NhSuxbzDz0VmxD4IX2mwR9OUjAQlC4veC0VyxmxRohbi+GrfH1RznEqFnh42sHgojEeapJHmD9VbX0w== 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:10 +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:10 +0000 From: Morgan Smith Date: Mon, 7 Apr 2025 16:07:46 -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: YQZPR01CA0108.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:83::14) To CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17) X-Microsoft-Original-Message-ID: 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: 19e10efc-f1fe-41db-443c-08dd760feb19 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199028|8060799006|15080799006|7092599003|19110799003|5072599009|21061999003|12071999003|41001999003|10035399004|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: QxYgrDjjWCQ2HrayaHvfCQYXHiKiw5S6sMOPMDchDZ6mp9//ScvXaYcHrsqRvBFkD1uvj8kNsxe1DfrlvVAJs3VYlLmYW+hLOgbaCw/ihCxt+sNFXIZhJnjd93PEaJwYG48lQtshRESdfXWeutzE4OljyoBs3BhYP1bs+SyaWmQLOUtBTWUrT3C0yn/h3zqDICRtS2s1p7AksRLMh0JSd4GCe6eYzjlaVltuXHgB8zp14RDs2tMfOOkQwnnZ1/N5srgrPxA7kPExKI5LRg0PGZ76tXadDc1tTT1LOrV46MM+o/u4cwGcxK1g0j1+OU3kBqLjQp34cNc1S+OmNwMoW7BQ1LeLhTsj0ywR3lo2ZoM7U/QHPj1ydd0aIbAW3o090XnMaS4rHKyX78En2x+WaktaiKaCDuT8RF7WoEXgs+c3thSodRy9sYpUEbcYeJgHhv6r6iw2ev8rHXwBCWXqpL2ffRjX//C5TcCY/rhz93L++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6HfuMshFovtKFWzylbfnZ9jictV+13wJ X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19e10efc-f1fe-41db-443c-08dd760feb19 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:09.9391 (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-bootstrap): Update to 1.74.0. Use gexps. Change-Id: Id88e200015ed6ab246407e37eeb4159cb4df195d --- gnu/packages/rust.scm | 261 +++++++++++++++++++++--------------------- 1 file changed, 132 insertions(+), 129 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 3200f59abd..66703abc35 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -154,17 +154,17 @@ (define %mrustc-source (substitute* "minicargo.mk" (("--features vendored-openssl") ""))))))) -;;; Rust 1.54 is special in that it is built with mrustc, which shortens the +;;; Rust 1.74 is special in that it is built with mrustc, which shortens the ;;; bootstrap path. (define-public rust-bootstrap (package (name "rust") - (version "1.54.0") + (version "1.74.0") (source (origin (method url-fetch) (uri (rust-uri version)) - (sha256 (base32 "0xk9dhfff16caambmwij67zgshd8v9djw6ha0fnnanlv7rii31dc")) + (sha256 (base32 "0j8hrwjjjjf7spy0hy7gami96swhfzr6kandfzzdri91qd5mhaw8")) (modules '((guix build utils))) (snippet '(begin @@ -174,17 +174,19 @@ (define-public rust-bootstrap "vendor/tikv-jemalloc-sys/jemalloc")) ;; Remove vendored dynamically linked libraries. ;; find . -not -type d -executable -exec file {} \+ | grep ELF - (delete-file "vendor/vte/vim10m_match") - (delete-file "vendor/vte/vim10m_table") ;; Also remove the bundled (mostly Windows) libraries. - ;; find vendor -not -type d -exec file {} \+ | grep PE32 (for-each delete-file (find-files "vendor" "\\.(a|dll|exe|lib)$")) - ;; Adjust some sources for llvm-13, see llvm commit - ;; acce401068e78a8c5dc9e06802111ffad3da763f - (substitute* (find-files "." "powerpc64le_unknown_linux_gnu.rs") - (("e-m:e-i64:64-n32:64-v256:256:256-v512:512:512") - "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512")))))) + ;; Adjust vendored dependency to explicitly use rustix with libc backend. + (substitute* "vendor/tempfile/Cargo.toml" + (("features = \\[\"fs\"" all) + (string-append all ", \"use-libc\""))))) + ;; Rust 1.70 adds the rustix library which depends on the vendored + ;; fd-lock crate. The fd-lock crate uses Outline assembly which expects + ;; a precompiled static library. Enabling the "cc" feature tells the + ;; build.rs script to compile the assembly files instead of searching + ;; for a precompiled library. + (patches (search-patches "rust-1.70-fix-rustix-build.patch")))) (outputs '("out" "cargo")) (properties '((hidden? . #t) (timeout . 129600) ;36 hours @@ -192,136 +194,137 @@ (define-public rust-bootstrap (build-system gnu-build-system) (inputs (list bash-minimal - llvm-13 - openssl-1.1 + llvm-15 + openssl 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.")