119 lines
2.9 KiB
Bash
119 lines
2.9 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=0.44.0
|
|
revision=1
|
|
wrksrc="cargo-${version}"
|
|
build_helper=rust
|
|
hostmakedepends="rust python curl cmake pkg-config"
|
|
makedepends="libcurl-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="c6da7d1d21eacf112c55dc8cc2647f2ccf7b41f9865dfa542e08ab41d1c20170"
|
|
_cargo_dist_version=0.44.0
|
|
build_options="static"
|
|
|
|
if [ -z "$build_option_static" ]; then
|
|
makedepends+=" libgit2-devel"
|
|
fi
|
|
|
|
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*) _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+="
|
|
b60abb4d89f645ec80f83f1514758c6f374e0d86ba44d9d36966aa4262eae5e5"
|
|
;;
|
|
x86_64)
|
|
checksum+="
|
|
b0b97b21aae588dd7c73508dcd14ae094f45d5c5b33299859adde1b2e241271c"
|
|
;;
|
|
x86_64-musl)
|
|
checksum+="
|
|
ba6da59754bc113eb61bcfdb384ef3b458a16fe212124252830d83968480a07b"
|
|
;;
|
|
ppc64le)
|
|
checksum+="
|
|
4f90cd6cbcf9e9d6ba11830e093092e4e6c3d156ffde2e729933869b7a039ff9"
|
|
;;
|
|
ppc64le-musl)
|
|
checksum+="
|
|
a85e8c9714a8bb7c17cd23993c677f51d9e0d6f5e85ab10f53ec1639b19bbbd4"
|
|
;;
|
|
ppc64)
|
|
checksum+="
|
|
983e2fbec9c4bfe66bab37ad64cdd5b47918378e421d9bf639e938f120650199"
|
|
;;
|
|
ppc64-musl)
|
|
checksum+="
|
|
f974893d1cac6c799345bece08c7f796eb50e1a77c4b9bc2a6451d161a57c660"
|
|
;;
|
|
ppc)
|
|
checksum+="
|
|
48f4419300fe758ebe024e6449a5ca1dff07803047a815b3d3909170baa7adcc"
|
|
;;
|
|
ppc-musl)
|
|
checksum+="
|
|
bbb93a757e75d09cb5f6d6dd837e32212acd8888426406352eccf52f329386f1"
|
|
;;
|
|
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 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 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
|
|
}
|