From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C178C15817D for ; Sat, 15 Jun 2024 14:00:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D8246E2AE5; Sat, 15 Jun 2024 14:00:21 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 96DE0E2AE0 for ; Sat, 15 Jun 2024 14:00:21 +0000 (UTC) From: James Le Cuirot To: gentoo-dev Cc: James Le Cuirot Subject: [gentoo-dev] [PATCH v2] cargo.eclass: Add cargo_target_dir helper function Date: Sat, 15 Jun 2024 14:59:15 +0100 Message-ID: <20240615135954.22505-1-chewi@gentoo.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613150530.24679-1-chewi@gentoo.org> References: <20240613150530.24679-1-chewi@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: e464eb70-3447-45d0-ab41-0a4b6b232967 X-Archives-Hash: 7bd421683d0bdbefe913d200536b0f57 Several Cargo-based ebuilds cannot use cargo_src_install for various reasons and manually install binaries from within the target directory instead. It is common to see `target/$(usex debug debug release)`, but this lacks the target ABI when cross-compiling, so provide a helper function. There are some multilib Cargo-based ebuilds that always set the target ABI, even when not cross-compiling. It would be simpler to do this in general, so once ebuilds have been updated to use this new helper, I might change the eclass again accordingly. Signed-off-by: James Le Cuirot --- eclass/cargo.eclass | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index 40d98211ce7f9..7463e1a0a600a 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -319,6 +319,16 @@ _cargo_gen_git_config() { fi } +# @FUNCTION: cargo_target_dir +# @DESCRIPTION: +# Return the directory within target that contains the build, e.g. +# target/aarch64-unknown-linux-gnu/release. +cargo_target_dir() { + local abi + tc-is-cross-compiler && abi=/$(rust_abi) + echo "${CARGO_TARGET_DIR:-target}${abi}/$(usex debug debug release)" +} + # @FUNCTION: cargo_src_unpack # @DESCRIPTION: # Unpacks the package and the cargo registry. -- 2.45.1