void-packages/srcpkgs/cargo/template
2018-10-30 04:27:45 -03:00

86 lines
2.2 KiB
Bash

# Template file for 'cargo'
pkgname=cargo
version=0.31.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=96c4ce9a3db4748680e613e4f3bce7de84329e50b6074a1fa7adb43359ff270e
_cargo_dist_version=0.30.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.gz"
checksum+="
e9344cbf3db669383cb3492d12bcd42d9130665f577be9ad4d2028011c7b1fae"
;;
x86_64)
distfiles+="
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-x86_64-unknown-linux-gnu.tar.gz"
checksum+="
32f210fd3142fda7825a06e95d1aa4b54035c2da435d8cf0dd03fad410c8002f"
;;
i686)
distfiles+="
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-i686-unknown-linux-gnu.tar.gz"
checksum+="
bc0f79a757601e0386e98bbbf870bf2a9f999d0085a9a2982d954833f8c519d5"
;;
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
}