summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2024-06-15 13:59:15 +0000
committerJames Le Cuirot <chewi@gentoo.org>2024-06-17 10:27:23 +0100
commit73aef61ba818739034dd5cc939a315213bc77741 (patch)
treef8a7d31f6a4662f684059b61e84608ba99efc70f /eclass
parentnet-print/kyocera-1x2x-mfp-driver: last-rite (diff)
downloadgentoo-73aef61ba818739034dd5cc939a315213bc77741.tar.gz
gentoo-73aef61ba818739034dd5cc939a315213bc77741.tar.bz2
gentoo-73aef61ba818739034dd5cc939a315213bc77741.zip
cargo.eclass: Add cargo_target_dir helper function
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 <chewi@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/cargo.eclass10
1 files changed, 10 insertions, 0 deletions
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 548aaef3ed69..7db34efb4e17 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.