87 lines
2.2 KiB
Bash
87 lines
2.2 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=0.31.1
|
|
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=d14462641610a56fd444200b02bb2547b663de3e63548990fba2e05435f4c096
|
|
_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-0.31.0-x86_64-unknown-linux-musl-libressl-2.8.tar.gz"
|
|
checksum+="
|
|
61d72ac378f3ee592cd3c82b02518f717bfcf328946ad4a51d24a2dac546c1cb"
|
|
;;
|
|
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
|
|
}
|