Skip to content

Commit

Permalink
eclass/cargo.eclass: add CARGO_OPTIONAL condition
Browse files Browse the repository at this point in the history
Signed-off-by: Georgy Yakovlev <[email protected]>
  • Loading branch information
gyakovlev committed Nov 11, 2020
1 parent 98b8e7b commit eb149fd
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions eclass/cargo.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,41 @@ _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.

# @VARIABLE: myfeatures
# @DEFAULT_UNSET
# @DESCRIPTION:
Expand Down

0 comments on commit eb149fd

Please sign in to comment.