summaryrefslogtreecommitdiff
path: root/eclass/cargo.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-11-25 22:39:15 +0000
committerV3n3RiX <venerix@redcorelinux.org>2020-11-25 22:39:15 +0000
commitd934827bf44b7cfcf6711964418148fa60877668 (patch)
tree0625f358789b5e015e49db139cc1dbc9be00428f /eclass/cargo.eclass
parent2e34d110f164bf74d55fced27fe0000201b3eec5 (diff)
gentoo resync : 25.11.2020
Diffstat (limited to 'eclass/cargo.eclass')
-rw-r--r--eclass/cargo.eclass30
1 files changed, 26 insertions, 4 deletions
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index e6fec844d274..1042f31e7e65 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -15,20 +15,42 @@ _CARGO_ECLASS=1
# we need this for 'cargo vendor' subcommand and net.offline config knob
RUST_DEPEND=">=virtual/rust-1.37.0"
-case ${EAPI} in
- 7) BDEPEND="${RUST_DEPEND}";;
- *) die "EAPI=${EAPI:-0} is not supported" ;;
+case "${EAPI:-0}" in
+ 0|1|2|3|4|5|6)
+ die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
+ ;;
+ 7)
+ ;;
+ *)
+ die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+ ;;
esac
inherit multiprocessing toolchain-funcs
-EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install src_test
+if [[ ! ${CARGO_OPTIONAL} ]]; then
+ BDEPEND="${RUST_DEPEND}"
+ EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install src_test
+fi
IUSE="${IUSE} debug"
ECARGO_HOME="${WORKDIR}/cargo_home"
ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
+# @ECLASS-VARIABLE: CARGO_OPTIONAL
+# @DEFAULT_UNSET
+# @PRE_INHERIT
+# @DESCRIPTION:
+# If set to a non-null value, before inherit cargo part of the ebuild will
+# be considered optional. No dependencies will be added and no phase
+# functions will be exported.
+#
+# If you enable CARGO_OPTIONAL, you have to set BDEPEND on virtual/rust
+# for your package and call at least cargo_gen_config manually before using
+# other src_ functions of this eclass.
+# note that cargo_gen_config is automatically called by cargo_src_unpack.
+
# @VARIABLE: myfeatures
# @DEFAULT_UNSET
# @DESCRIPTION: