1 |
Signed-off-by: Georgy Yakovlev <gyakovlev@g.o> |
2 |
--- |
3 |
eclass/cargo.eclass | 28 ++++++++++++++++++++++++---- |
4 |
1 file changed, 24 insertions(+), 4 deletions(-) |
5 |
|
6 |
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass |
7 |
index e6fec844d274..03dfbfebd1d7 100644 |
8 |
--- a/eclass/cargo.eclass |
9 |
+++ b/eclass/cargo.eclass |
10 |
@@ -15,20 +15,40 @@ _CARGO_ECLASS=1 |
11 |
# we need this for 'cargo vendor' subcommand and net.offline config knob |
12 |
RUST_DEPEND=">=virtual/rust-1.37.0" |
13 |
|
14 |
-case ${EAPI} in |
15 |
- 7) BDEPEND="${RUST_DEPEND}";; |
16 |
- *) die "EAPI=${EAPI:-0} is not supported" ;; |
17 |
+case "${EAPI:-0}" in |
18 |
+ 0|1|2|3|4|5|6) |
19 |
+ die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" |
20 |
+ 7) |
21 |
+ ;; |
22 |
+ *) |
23 |
+ die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" |
24 |
+ ;; |
25 |
esac |
26 |
|
27 |
inherit multiprocessing toolchain-funcs |
28 |
|
29 |
-EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install src_test |
30 |
+if [[ ! ${CARGO_OPTIONAL} ]]; then |
31 |
+ BDEPEND="${RUST_DEPEND}" |
32 |
+ EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install src_test |
33 |
+fi |
34 |
|
35 |
IUSE="${IUSE} debug" |
36 |
|
37 |
ECARGO_HOME="${WORKDIR}/cargo_home" |
38 |
ECARGO_VENDOR="${ECARGO_HOME}/gentoo" |
39 |
|
40 |
+# @ECLASS-VARIABLE: CARGO_OPTIONAL |
41 |
+# @DEFAULT_UNSET |
42 |
+# @PRE_INHERIT |
43 |
+# @DESCRIPTION: |
44 |
+# If set to a non-null value, before inherit cargo part of the ebuild will |
45 |
+# be considered optional. No dependencies will be added and no phase |
46 |
+# functions will be exported. |
47 |
+# |
48 |
+# If you enable CARGO_OPTIONAL, you have to set BDEPEND on virtual/rust |
49 |
+# for your package and call at least cargo_gen_config manually before using |
50 |
+# other src_ functions of this eclass. |
51 |
+ |
52 |
# @VARIABLE: myfeatures |
53 |
# @DEFAULT_UNSET |
54 |
# @DESCRIPTION: |
55 |
-- |
56 |
2.29.2 |