From patchwork Tue Mar 18 07:24:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 40308 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 D867727BBEC; Tue, 18 Mar 2025 07:26:47 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,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 42DA127BBE2 for ; Tue, 18 Mar 2025 07:26:47 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuRL5-0007Cx-2p; Tue, 18 Mar 2025 03:26:15 -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 1tuRL3-0007C2-5Q for guix-patches@gnu.org; Tue, 18 Mar 2025 03:26:13 -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 1tuRL2-0000eB-Qu; Tue, 18 Mar 2025 03:26:12 -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=nu5Fq3O3l7S/8mex7Vy7MAjGDCPLGyv+RkJelUXlR28=; b=oHdQvN1Dr/yKxGXKa0P9v6OWzVTqNQRSyy96Yu/uPxB9LnD/+YQmr/j1hTnp+hMGZaesH0scYuJtARzPY7p2kyyM21owEgmtJhZNmHUJ8ylJMpyM1+yxZfg+ieGV44SaAJ5VDztX4veZ97QyjGhTn4+WWLg3Ob6PE9TDAvh+khuNe5ElXFz0/nU9hpfBi7qp7u4tUE6RBHQdzOPbW7m+Ak55fq/+1Qc3kNh+xSvDDkAS0uF+JM0L7W4iaslzcDxnhXkBziRRaT7faCR+Mp7++sZNBvZDpUP5vesUR15bbr1IRKLhvAMWQM80LVq5B65jFGNRZLfVllUQnb1GOahR6Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tuRKz-0004f3-6A; Tue, 18 Mar 2025 03:26:09 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH rust-team 04/18] build-system: cargo: Support installing Cargo workspace. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, divya@subvertising.org, efraim@flashner.co.il, ludo@gnu.org, maxim.cournoyer@gmail.com, steve@futurile.net, guix-patches@gnu.org Resent-Date: Tue, 18 Mar 2025 07:26:09 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Steve George X-Debbugs-Original-Xcc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174228275917781 (code B ref 77093); Tue, 18 Mar 2025 07:26:09 +0000 Received: (at 77093) by debbugs.gnu.org; 18 Mar 2025 07:25:59 +0000 Received: from localhost ([127.0.0.1]:35868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tuRKm-0004c9-IV for submit@debbugs.gnu.org; Tue, 18 Mar 2025 03:25:58 -0400 Received: from mx.boiledscript.com ([88.99.243.112]:33298) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tuRKc-0004ae-C9 for 77093@debbugs.gnu.org; Tue, 18 Mar 2025 03:25:48 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1742282744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nu5Fq3O3l7S/8mex7Vy7MAjGDCPLGyv+RkJelUXlR28=; b=F4sxlH9nBKwNh5qRHD0evHgeExCInSZohlxOWf6VUnMSmTkTi9El+0PQ/NkfNeqps082CE lP2omh2VBxSOcOtJPAxD1sHdma4weeCyQ+cGF5M8q9Bml6q7L5b5BLdGYVmqqrwNHZvOJF nYe/aNoRbpDRDLfuF05j3GexF2bOh5x7rCB57MfIBnuNwBCRTQUVNiqkj0XmXvNr8tqPSJ 8MibegZNbzqKZ7isXtz539dQ2yp8Dbf9/8lvqhLBF1VcQf0JJuixt40BMhpyHDrU4/yZMo bUNFgEiU0q2X25tE8ZgdO2JQzYi1OyKdClRjWYqP/a8czRv9kyThb83AmNfI8w== Date: Tue, 18 Mar 2025 15:24:17 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 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 *guix/build-system/cargo.scm (cargo-build,cargo-cross-build) [#:cargo-install-paths]: New argument. * guix/build/cargo-build-system.scm (install): Use it. * doc/guix.texi (Build Systems)[cargo-build-system]: Document it. Change-Id: I74ed1972a5716da05afeac8edb2b0e4b6834bf40 --- doc/guix.texi | 5 ++++- guix/build-system/cargo.scm | 4 ++++ guix/build/cargo-build-system.scm | 17 +++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 322512fd36..c20e1d7f9c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9369,7 +9369,10 @@ Build Systems names of library crates to package in @code{package} phase. Specified crates are packaged from left to right, in case there's dependency among them. For example, specifying @code{''("pcre2-sys" "pcre2")} will -package @code{"pcre2-sys"} first and then @code{"pcre2"}. +package @code{"pcre2-sys"} first and then @code{"pcre2"}. Parameter +@code{#:cargo-install-paths} (default: @code{''()}) allows specifying +paths of binary crates to install in @code{install} phase, +@code{''("crates/atuin")}, for example. @end defvar @defvar chicken-build-system diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 4f6d46e70c..4486c706a1 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -96,6 +96,7 @@ (define* (cargo-build name inputs (cargo-test-flags ''()) (cargo-package-crates ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) + (cargo-install-paths ''()) (features ''()) (skip-build? #f) (parallel-build? #t) @@ -125,6 +126,7 @@ (define* (cargo-build name inputs #:cargo-test-flags #$(sexp->gexp cargo-test-flags) #:cargo-package-crates #$(sexp->gexp cargo-package-crates) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) + #:cargo-install-paths #$(sexp->gexp cargo-install-paths) #:cargo-target #$(cargo-triplet system) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? @@ -158,6 +160,7 @@ (define* (cargo-cross-build name (cargo-test-flags ''()) (cargo-package-crates ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) + (cargo-install-paths ''()) (cargo-target (cargo-triplet (or target system))) (features ''()) (skip-build? #f) @@ -190,6 +193,7 @@ (define* (cargo-cross-build name #:cargo-test-flags #$(sexp->gexp cargo-test-flags) #:cargo-package-crates #$(sexp->gexp cargo-package-crates) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) + #:cargo-install-paths #$(sexp->gexp cargo-install-paths) #:cargo-target #$(cargo-triplet (or target system)) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 001e9c7adc..bcee10837e 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -384,6 +384,7 @@ (define* (install #:key skip-build? install-source? features + (cargo-install-paths '()) #:allow-other-keys) "Install a given Cargo package." (let* ((out (assoc-ref outputs "out")) @@ -398,10 +399,18 @@ (define* (install #:key ;; Only install crates which include binary targets, ;; otherwise cargo will raise an error. (or skip-build? - (not (has-executable-target?)) - (invoke "cargo" "install" "--offline" "--no-track" - "--path" "." "--root" out - "--features" (string-join features))) + ;; NOTE: Cargo workspace installation support: + ;; #:skip-build? #f + #:cargo-install-paths. + (and (null? cargo-install-paths) + (not (has-executable-target?))) + (for-each + (lambda (path) + (invoke "cargo" "install" "--offline" "--no-track" + "--path" path "--root" out + "--features" (string-join features))) + (if (null? cargo-install-paths) + '(".") + cargo-install-paths))) (when install-source? ;; Install crate tarballs and unpacked sources for later use.