void-packages/srcpkgs/cargo/template
Rasmus Thomsen 6d5087bc58 cargo: update to 0.32.0.
[ci skip]
2018-12-11 23:16:49 +01:00

86 lines
2.2 KiB
Bash

# Template file for 'cargo'
pkgname=cargo
version=0.32.0
revision=1
hostmakedepends="rust python curl cmake pkg-config"
makedepends="libcurl-devel libgit2-devel"
depends="rust"
short_desc="Rust package manager"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="MIT, Apache-2.0"
homepage="https://crates.io/"
distfiles="https://github.com/rust-lang/cargo/archive/${version}.tar.gz"
checksum=c62e41489179a9b8e1ae0dbed379c278f9de805abba41608a05c069478a739fd
_cargo_dist_version=0.32.0
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" cargo"
makedepends+=" rust"
else
case "$XBPS_MACHINE" in
x86_64-musl)
distfiles+="
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-x86_64-unknown-linux-musl.tar.xz"
checksum+="
4dfb1cca7730b38920c04731be0e9d47ec520b3365059b4ccd9c0948346787ea"
;;
x86_64)
distfiles+="
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-x86_64-unknown-linux-gnu.tar.gz"
checksum+="
c69aa6a7c5b6822e40c60852fee8656c4c335d3268234538adb8295fc4ff8ba6"
;;
i686)
distfiles+="
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-i686-unknown-linux-gnu.tar.gz"
checksum+="
95f44961d57da328de67f996dc3fac8661812283eb9e57740cfdfec83cef50e8"
;;
esac
fi
post_extract() {
if [ -z "$CROSS_BUILD" ]; then
mkdir -p target/snapshot
case "$XBPS_MACHINE" in
x86_64-musl) cp ../cargo cargo;;
*) cp ../cargo-${_cargo_dist_version}-${RUST_TARGET}/cargo/bin/cargo cargo;;
esac
fi
}
do_configure() {
mkdir -p .cargo
cat >> .cargo/config <<EOF
[build]
jobs = ${makejobs#*j}
target = "${RUST_TARGET}"
[target.${RUST_TARGET}]
linker = "${CC}"
EOF
}
do_build() {
export LIBGIT2_SYS_USE_PKG_CONFIG=yes
export RUST_BACKTRACE=1
export PKG_CONFIG_ALLOW_CROSS=1
export RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
if [ "$CROSS_BUILD" ]; then
cargo build --release
else
./cargo build --release
fi
}
do_install() {
vbin target/${RUST_TARGET}/release/cargo
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
}