void-packages/srcpkgs/cargo/template
2019-07-09 21:32:04 +02:00

117 lines
2.9 KiB
Bash

# Template file for 'cargo'
pkgname=cargo
version=0.37.0
revision=1
build_helper=rust
hostmakedepends="rust python curl cmake pkg-config"
makedepends="libcurl-devel libgit2-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=377e1090e9ce21206270576193746499a26e8ffbd8b89ccd5f8eb1085ca00e3b
_cargo_dist_version=0.37.0
build_options="static"
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) ;;
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+="
6835a73e2ce17e11eda5393133dd7c78bc41bae5a09784e5327648f14340fd48"
;;
x86_64)
checksum+="
d20fa121951339d5492cf8862f8a7af59efc99d18f3c27b95ab6d4658b6a7d67"
;;
x86_64-musl)
checksum+="
53975d91e11569f2255d8e30176f05f6976cd810725197a527b0e7ad547ca70c"
;;
ppc64le)
checksum+="
4cda7686160f6981e936229703e8e2e756c74f390245f2ad9e356bbbed28a2c9"
;;
ppc64le-musl)
checksum+="
d2690135522db9fdc6efa2f432e5719b8b70abc94e91db278b84be834a75bf72"
;;
ppc64)
checksum+="
8b2f7d5da611a21dd7e0b4238b9aca6ee32f1e49d8fe831435301f11a29b12de"
;;
ppc64-musl)
checksum+="
131db0127366665b2ae55327155c171e99c2eddfb4bcdd7e5cd2663ada109bd5"
;;
ppc)
checksum+="
856fcb63f6ebeab67038fe3fc96ee0911353b1ee19cabcb0496c7d419de0d531"
;;
ppc-musl)
checksum+="
119dba3538f6c1d1164b720b238acac598e1924d943ebbdf3c7113ec3cbd8a2a"
;;
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 LIBGIT2_SYS_USE_PKG_CONFIG
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 update
$cargo update --package libc --precise 0.2.55
$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
}