1 |
commit: e07fc451a52c104d1e7dfae2207e7cd908b77ccc |
2 |
Author: Doug Goldstein <cardoe <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 11 13:43:23 2016 +0000 |
4 |
Commit: Doug Goldstein <cardoe <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 30 17:17:51 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e07fc451 |
7 |
|
8 |
eclass/cargo: extend to support building packages |
9 |
|
10 |
Originally this eclass only had the bits to build cargo and not other |
11 |
packages built with cargo. Cargo is a special case and needs to override |
12 |
some parts. This adds the generic case for normal cargo packages, |
13 |
allowing for debug and release builds of packages as well. |
14 |
|
15 |
Signed-off-by: Doug Goldstein <cardoe <AT> gentoo.org> |
16 |
|
17 |
eclass/cargo.eclass | 28 ++++++++++++++++++++++++++-- |
18 |
1 file changed, 26 insertions(+), 2 deletions(-) |
19 |
|
20 |
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass |
21 |
index a86bb9e..19c66c8 100644 |
22 |
--- a/eclass/cargo.eclass |
23 |
+++ b/eclass/cargo.eclass |
24 |
@@ -17,10 +17,13 @@ case ${EAPI} in |
25 |
*) die "EAPI=${EAPI:-0} is not supported" ;; |
26 |
esac |
27 |
|
28 |
-EXPORT_FUNCTIONS src_unpack |
29 |
+EXPORT_FUNCTIONS src_unpack src_compile src_install |
30 |
+ |
31 |
+IUSE="${IUSE} debug" |
32 |
|
33 |
ECARGO_HOME="${WORKDIR}/cargo_home" |
34 |
-ECARGO_REPO="github.com-88ac128001ac3a9a" |
35 |
+#ECARGO_REPO="github.com-88ac128001ac3a9a" |
36 |
+ECARGO_REPO="github.com-1ecc6299db9ec823" |
37 |
ECARGO_INDEX="${ECARGO_HOME}/registry/index/${ECARGO_REPO}" |
38 |
ECARGO_SRC="${ECARGO_HOME}/registry/src/${ECARGO_REPO}" |
39 |
ECARGO_CACHE="${ECARGO_HOME}/registry/cache/${ECARGO_REPO}" |
40 |
@@ -81,5 +84,26 @@ cargo_src_unpack() { |
41 |
done |
42 |
} |
43 |
|
44 |
+# @FUNCTION: cargo_src_compile |
45 |
+# @DESCRIPTION: |
46 |
+# Build the package using cargo build |
47 |
+cargo_src_compile() { |
48 |
+ debug-print-function ${FUNCNAME} "$@" |
49 |
+ |
50 |
+ export CARGO_HOME="${ECARGO_HOME}" |
51 |
+ |
52 |
+ cargo build -v $(usex debug "" --release) |
53 |
+} |
54 |
+ |
55 |
+# @FUNCTION: cargo_src_install |
56 |
+# @DESCRIPTION: |
57 |
+# Installs the binaries generated by cargo |
58 |
+cargo_src_install() { |
59 |
+ debug-print-function ${FUNCNAME} "$@" |
60 |
+ |
61 |
+ cargo install --root="${D}/usr" $(usex debug --debug "") \ |
62 |
+ || die "cargo install failed" |
63 |
+ rm -f "${D}/usr/.crates.toml" |
64 |
+} |
65 |
|
66 |
fi |