summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass')
-rw-r--r--eclass/cargox.eclass68
1 files changed, 34 insertions, 34 deletions
diff --git a/eclass/cargox.eclass b/eclass/cargox.eclass
index 460679b..7eaa5de 100644
--- a/eclass/cargox.eclass
+++ b/eclass/cargox.eclass
@@ -1,7 +1,7 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-# @ECLASS: cargo.eclass
+# @ECLASS: cargox.eclass
# @MAINTAINER:
# rust@gentoo.org
# @AUTHOR:
@@ -62,7 +62,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# @PRE_INHERIT
# @DESCRIPTION:
# bash string containing all crates package wants to download
-# used by cargo_crate_uris()
+# used by cargox_crate_uris()
# Example:
# @CODE
# CRATES="
@@ -72,7 +72,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# "
# inherit cargo
# ...
-# SRC_URI="$(cargo_crate_uris)"
+# SRC_URI="$(cargox_crate_uris)"
# @CODE
# @ECLASS_VARIABLE: CARGO_OPTIONAL
@@ -84,15 +84,15 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# 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
+# for your package and call at least cargox_gen_config manually before using
# other src_ functions of this eclass.
-# note that cargo_gen_config is automatically called by cargo_src_unpack.
+# note that cargox_gen_config is automatically called by cargox_src_unpack.
# @ECLASS_VARIABLE: myfeatures
# @DEFAULT_UNSET
# @DESCRIPTION:
# Optional cargo features defined as bash array.
-# Should be defined before calling cargo_src_configure().
+# Should be defined before calling cargox_src_configure().
#
# Example package that has x11 and wayland as features, and disables default.
# @CODE
@@ -101,7 +101,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# $(usex X x11 '')
# $(usev wayland)
# )
-# cargo_src_configure --no-default-features
+# cargox_src_configure --no-default-features
# }
# @CODE
@@ -110,7 +110,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# @DEFAULT_UNSET
# @DESCRIPTION:
# Storage directory for cargo registry.
-# Used by cargo_live_src_unpack to cache downloads.
+# Used by cargox_live_src_unpack to cache downloads.
# This is intended to be set by users.
# Ebuilds must not set it.
#
@@ -121,7 +121,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty, this variable prevents online operations in
-# cargo_live_src_unpack.
+# cargox_live_src_unpack.
# Inherits value of EVCS_OFFLINE if not set explicitly.
# @ECLASS_VARIABLE: EVCS_UMASK
@@ -134,12 +134,12 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# group, and then switch over to building with FEATURES=userpriv.
# Or vice-versa.
-# @FUNCTION: cargo_crate_uris
+# @FUNCTION: cargox_crate_uris
# @DESCRIPTION:
# Generates the URIs to put in SRC_URI to help fetch dependencies.
# Uses first argument as crate list.
# If no argument provided, uses CRATES variable.
-cargo_crate_uris() {
+cargox_crate_uris() {
local -r regex='^([a-zA-Z0-9_\-]+)-([0-9]+\.[0-9]+\.[0-9]+.*)$'
local crate crates
@@ -162,7 +162,7 @@ cargo_crate_uris() {
done
}
-# @FUNCTION: cargo_gen_config
+# @FUNCTION: cargox_gen_config
# @DESCRIPTION:
# Generate the $CARGO_HOME/config necessary to use our local registry and settings.
# Cargo can also be configured through environment variables in addition to the TOML syntax below.
@@ -172,7 +172,7 @@ cargo_crate_uris() {
# and currently only integer, boolean, and string keys are supported.
# For example the build.jobs key can also be defined by CARGO_BUILD_JOBS.
# Or setting CARGO_TERM_VERBOSE=false in make.conf will make build quieter.
-cargo_gen_config() {
+cargox_gen_config() {
debug-print-function ${FUNCNAME} "$@"
mkdir -p "${ECARGO_HOME}" || die
@@ -201,10 +201,10 @@ cargo_gen_config() {
_CARGO_GEN_CONFIG_HAS_RUN=1
}
-# @FUNCTION: cargo_src_unpack
+# @FUNCTION: cargox_src_unpack
# @DESCRIPTION:
# Unpacks the package and the cargo registry
-cargo_src_unpack() {
+cargox_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
mkdir -p "${ECARGO_VENDOR}" || die
@@ -238,13 +238,13 @@ cargo_src_unpack() {
esac
done
- cargo_gen_config
+ cargox_gen_config
}
-# @FUNCTION: cargo_live_src_unpack
+# @FUNCTION: cargox_live_src_unpack
# @DESCRIPTION:
# Runs 'cargo fetch' and vendors downloaded crates for offline use, used in live ebuilds
-cargo_live_src_unpack() {
+cargox_live_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
[[ "${PV}" == *9999* ]] || [[ "${SLOT}" == "live" ]] || die "${FUNCNAME} only allowed in live/9999 ebuilds"
@@ -284,7 +284,7 @@ cargo_live_src_unpack() {
pushd "${S}" > /dev/null || die
- # Respect user settings befire cargo_gen_config is called.
+ # Respect user settings befire cargox_gen_config is called.
if [[ ! ${CARGO_TERM_COLOR} ]]; then
[[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && export CARGO_TERM_COLOR=never
local unset_color=true
@@ -327,10 +327,10 @@ cargo_live_src_unpack() {
# It will be forced into offline mode to prevent network access.
# But since we already vendored crates and symlinked git, it has all it needs to build.
unset CARGO_HOME
- cargo_gen_config
+ cargox_gen_config
}
-# @FUNCTION: cargo_src_configure
+# @FUNCTION: cargox_src_configure
# @DESCRIPTION:
# Configure cargo package features and arguments.
# Extra positional arguments supplied to this function
@@ -348,14 +348,14 @@ cargo_live_src_unpack() {
# barfeature
# $(usev foo)
# )
-# cargo_src_configure --bin baz
+# cargox_src_configure --bin baz
# }
# @CODE
#
# In some cases crates may need '--no-default-features' option,
# as there is no way to disable single feature, except disabling all.
-# It can be passed directly to cargo_src_configure().
-cargo_src_configure() {
+# It can be passed directly to cargox_src_configure().
+cargox_src_configure() {
debug-print-function ${FUNCNAME} "$@"
[[ -z ${myfeatures} ]] && declare -a myfeatures=()
@@ -377,14 +377,14 @@ cargo_src_configure() {
[[ ${ECARGO_ARGS[@]} ]] && einfo "Configured with: ${ECARGO_ARGS[@]}"
}
-# @FUNCTION: cargo_src_compile
+# @FUNCTION: cargox_src_compile
# @DESCRIPTION:
# Build the package using cargo build
-cargo_src_compile() {
+cargox_src_compile() {
debug-print-function ${FUNCNAME} "$@"
[[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
- die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
+ die "FATAL: please call cargox_gen_config before using ${FUNCNAME}"
tc-export AR CC CXX PKG_CONFIG
@@ -393,17 +393,17 @@ cargo_src_compile() {
"${@}" || die "cargo build failed"
}
-# @FUNCTION: cargo_src_install
+# @FUNCTION: cargox_src_install
# @DESCRIPTION:
# Installs the binaries generated by cargo
# In come case workspaces need alternative --path parameter
# default is '--path ./' if nothing specified.
-# '--path ./somedir' can be passed directly to cargo_src_install()
-cargo_src_install() {
+# '--path ./somedir' can be passed directly to cargox_src_install()
+cargox_src_install() {
debug-print-function ${FUNCNAME} "$@"
[[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
- die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
+ die "FATAL: please call cargox_gen_config before using ${FUNCNAME}"
set -- cargo install $(has --path ${@} || echo --path ./) \
--root "${ED}/usr" \
@@ -427,14 +427,14 @@ cargo_src_install() {
esac
}
-# @FUNCTION: cargo_src_test
+# @FUNCTION: cargox_src_test
# @DESCRIPTION:
# Test the package using cargo test
-cargo_src_test() {
+cargox_src_test() {
debug-print-function ${FUNCNAME} "$@"
[[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
- die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
+ die "FATAL: please call cargox_gen_config before using ${FUNCNAME}"
set -- cargo test $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
einfo "${@}"