void-packages/srcpkgs/cargo/template
2020-05-24 23:16:48 +02:00

119 lines
2.9 KiB
Bash

# Template file for 'cargo'
pkgname=cargo
version=0.44.0
revision=1
wrksrc="cargo-${version}"
build_helper=rust
hostmakedepends="rust python curl cmake pkg-config"
makedepends="libcurl-devel"
depends="rust"
short_desc="Rust package manager"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="MIT, Apache-2.0"
homepage="https://crates.io/"
distfiles="https://github.com/rust-lang/cargo/archive/${version}.tar.gz"
checksum="c6da7d1d21eacf112c55dc8cc2647f2ccf7b41f9865dfa542e08ab41d1c20170"
_cargo_dist_version=0.44.0
build_options="static"
if [ -z "$build_option_static" ]; then
makedepends+=" libgit2-devel"
fi
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" cargo"
makedepends+=" rust"
else
_bootstrap_url="https://static.rust-lang.org/dist"
case "$XBPS_MACHINE" in
x86_64*|i686|ppc64le) ;;
ppc*) _bootstrap_url="https://alpha.de.repo.voidlinux.org/distfiles" ;;
*) broken="unsupported host: ${XBPS_MACHINE}" ;;
esac
distfiles+="
${_bootstrap_url}/cargo-${_cargo_dist_version}-${RUST_BUILD}.tar.xz"
case "$XBPS_MACHINE" in
i686)
checksum+="
c7b4045b2001be2e97b0b08dfaee02097aea0e8a9983b42585d733cfa1e69683"
;;
x86_64)
checksum+="
84ba23058542691dae8157beec6a7679a420643eb6a708134bb1dfb01cbdebea"
;;
x86_64-musl)
checksum+="
653cb60214d6f1000c9a7775111dccd093c0118e7f7bf5f2f1f53a7e5e2420b3"
;;
ppc64le)
checksum+="
4f90cd6cbcf9e9d6ba11830e093092e4e6c3d156ffde2e729933869b7a039ff9"
;;
ppc64le-musl)
checksum+="
a85e8c9714a8bb7c17cd23993c677f51d9e0d6f5e85ab10f53ec1639b19bbbd4"
;;
ppc64)
checksum+="
983e2fbec9c4bfe66bab37ad64cdd5b47918378e421d9bf639e938f120650199"
;;
ppc64-musl)
checksum+="
f974893d1cac6c799345bece08c7f796eb50e1a77c4b9bc2a6451d161a57c660"
;;
ppc)
checksum+="
48f4419300fe758ebe024e6449a5ca1dff07803047a815b3d3909170baa7adcc"
;;
ppc-musl)
checksum+="
bbb93a757e75d09cb5f6d6dd837e32212acd8888426406352eccf52f329386f1"
;;
esac
fi
post_extract() {
if [ -z "$CROSS_BUILD" ]; then
mkdir -p target/snapshot
cp ../cargo-${_cargo_dist_version}-${RUST_TARGET}/cargo/bin/cargo cargo
fi
}
do_build() {
if [ "$build_option_static" ]; then
unset LIBSSH2_SYS_USE_PKG_CONFIG
export OPENSSL_STATIC=1
# rust-openssl can not be linked static if pkg-config is used
export OPENSSL_NO_PKG_CONFIG
export OPENSSL_DIR="${XBPS_CROSS_BASE}/usr"
fi
if [ "$CROSS_BUILD" ]; then
cargo="cargo"
else
cargo="./cargo"
fi
$cargo build --release $(vopt_if static --features="all-static")
}
do_install() {
if [ "$CROSS_BUILD" ]; then
vbin target/${RUST_TARGET}/release/cargo
else
vbin target/release/cargo
fi
for f in src/etc/man/*.?; do
vman $f
done
vinstall src/etc/cargo.bashcomp.sh 0644 \
usr/share/bash-completion/completions cargo
vinstall src/etc/_cargo 0644 usr/share/zsh/site-functions
vlicense LICENSE-APACHE
vlicense LICENSE-MIT
vlicense LICENSE-THIRD-PARTY
}