106 lines
3 KiB
Bash
106 lines
3 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=0.33.0
|
|
revision=3
|
|
build_helper=rust
|
|
hostmakedepends="rust python curl cmake pkg-config"
|
|
makedepends="libcurl-devel libgit2-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=914d715ff1a4ac4280b63d05c0f848d38889900a5559888d4a20c9600f87e6a4
|
|
_cargo_dist_version=0.33.0
|
|
build_options="static"
|
|
|
|
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+="
|
|
7d3e669dc5ddde7529ab0df2d0397648a679426fc56dd4c93d94f84fd68366d5"
|
|
;;
|
|
x86_64)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-x86_64-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
9dd7f79a0ab882ed7c892731514a4aed6435f7bc8a20381a8346b471c8a14209"
|
|
;;
|
|
i686)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-i686-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
163f46bd84ba6348dfe1ac3c10bc4730059f321791d2a7d4d4704fe8ddf8a755"
|
|
;;
|
|
ppc64le)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64le-unknown-linux-gnu.tar.xz"
|
|
checksum+="
|
|
03ece4d677ad59f08a514eb90dd3bd6cad4399fbbaf3d0e916323fbce38e25d1"
|
|
;;
|
|
ppc64le-musl)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64le-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
801490f04eac96e883f56434747042c375aa3d210b224c2735e02a3a1eab95a0"
|
|
;;
|
|
ppc64-musl)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
ae90844974681c3ee85a855ae0ed27f06d22215e40f825f3b7ca705d8a7cfe7b"
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
post_extract() {
|
|
if [ -z "$CROSS_BUILD" ]; then
|
|
mkdir -p target/snapshot
|
|
case "$XBPS_MACHINE" in
|
|
x86_64-musl|ppc64*) cp ../cargo cargo;;
|
|
*) cp ../cargo-${_cargo_dist_version}-${RUST_TARGET}/cargo/bin/cargo cargo;;
|
|
esac
|
|
fi
|
|
}
|
|
|
|
do_build() {
|
|
if [ "$build_option_static" ]; then
|
|
unset LIBGIT2_SYS_USE_PKG_CONFIG
|
|
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
|
|
}
|