summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorDoug Goldstein <cardoe@gentoo.org>2016-07-11 08:43:23 -0500
committerDoug Goldstein <cardoe@gentoo.org>2016-11-30 11:17:51 -0600
commite07fc451a52c104d1e7dfae2207e7cd908b77ccc (patch)
tree9d7375b20880ff3a1f2db35f31a89bc5c26c9f02 /eclass
parentsys-kernel/vanilla-sources: Linux patch 3.18.45 (diff)
downloadgentoo-e07fc451a52c104d1e7dfae2207e7cd908b77ccc.tar.gz
gentoo-e07fc451a52c104d1e7dfae2207e7cd908b77ccc.tar.bz2
gentoo-e07fc451a52c104d1e7dfae2207e7cd908b77ccc.zip
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>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/cargo.eclass28
1 files changed, 26 insertions, 2 deletions
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index a86bb9e037a..19c66c8d4aa 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -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