86 lines
2.2 KiB
Bash
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+="
|
|
b3d3dc57182fb173ecf367f7884dceb855a096d9b9b32eba994e3359ddc68cd4"
|
|
;;
|
|
i686)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-i686-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
0dcb32f2b17f505b5b74e85ffcc7fa6902d600a4f5767f43303761f7cd27efa9"
|
|
;;
|
|
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
|
|
}
|