2018-09-16 21:39:23 +02:00
|
|
|
#
|
|
|
|
# This helper is for building rust projects which use cargo for building
|
|
|
|
#
|
|
|
|
|
|
|
|
do_configure() {
|
2018-11-02 10:20:12 +01:00
|
|
|
mkdir -p ${HOME}/.cargo
|
2018-09-16 21:39:23 +02:00
|
|
|
# respect makejobs, do cross stuff
|
2018-11-02 10:20:12 +01:00
|
|
|
cat > ${HOME}/.cargo/config <<EOF
|
2018-09-16 21:39:23 +02:00
|
|
|
[build]
|
|
|
|
jobs = ${makejobs#*j}
|
|
|
|
|
|
|
|
[target.${RUST_TARGET}]
|
|
|
|
linker = "${CC}"
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
do_build() {
|
|
|
|
: ${make_cmd:=cargo}
|
|
|
|
|
2018-11-02 10:20:12 +01:00
|
|
|
${make_cmd} build --release --target ${RUST_TARGET} ${configure_args}
|
2018-09-16 21:39:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
do_check() {
|
|
|
|
: ${make_cmd:=cargo}
|
|
|
|
|
|
|
|
${make_cmd} test --release ${make_check_args}
|
|
|
|
}
|
|
|
|
|
|
|
|
do_install() {
|
|
|
|
: ${make_cmd:=cargo}
|
|
|
|
|
2018-11-02 10:20:12 +01:00
|
|
|
${make_cmd} install --path . --target ${RUST_TARGET} --root="${DESTDIR}/usr" \
|
|
|
|
${make_install_args}
|
2018-09-16 21:39:23 +02:00
|
|
|
rm "${DESTDIR}"/usr/.crates.toml
|
|
|
|
}
|