mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-06 00:48:18 -07:00
eclass/cargo: extend to support building packages
Originally this eclass only had the bits to build cargo and not other packages built with cargo. Cargo is a special case and needs to override some parts. This adds the generic case for normal cargo packages, allowing for debug and release builds of packages as well. Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
This commit is contained in:
@@ -17,10 +17,13 @@ case ${EAPI} in
|
||||
*) die "EAPI=${EAPI:-0} is not supported" ;;
|
||||
esac
|
||||
|
||||
EXPORT_FUNCTIONS src_unpack
|
||||
EXPORT_FUNCTIONS src_unpack src_compile src_install
|
||||
|
||||
IUSE="${IUSE} debug"
|
||||
|
||||
ECARGO_HOME="${WORKDIR}/cargo_home"
|
||||
ECARGO_REPO="github.com-88ac128001ac3a9a"
|
||||
#ECARGO_REPO="github.com-88ac128001ac3a9a"
|
||||
ECARGO_REPO="github.com-1ecc6299db9ec823"
|
||||
ECARGO_INDEX="${ECARGO_HOME}/registry/index/${ECARGO_REPO}"
|
||||
ECARGO_SRC="${ECARGO_HOME}/registry/src/${ECARGO_REPO}"
|
||||
ECARGO_CACHE="${ECARGO_HOME}/registry/cache/${ECARGO_REPO}"
|
||||
@@ -81,5 +84,26 @@ cargo_src_unpack() {
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: cargo_src_compile
|
||||
# @DESCRIPTION:
|
||||
# Build the package using cargo build
|
||||
cargo_src_compile() {
|
||||
debug-print-function ${FUNCNAME} "$@"
|
||||
|
||||
export CARGO_HOME="${ECARGO_HOME}"
|
||||
|
||||
cargo build -v $(usex debug "" --release)
|
||||
}
|
||||
|
||||
# @FUNCTION: cargo_src_install
|
||||
# @DESCRIPTION:
|
||||
# Installs the binaries generated by cargo
|
||||
cargo_src_install() {
|
||||
debug-print-function ${FUNCNAME} "$@"
|
||||
|
||||
cargo install --root="${D}/usr" $(usex debug --debug "") \
|
||||
|| die "cargo install failed"
|
||||
rm -f "${D}/usr/.crates.toml"
|
||||
}
|
||||
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user