16be0c7f58
This reverts commit a2af2eaab0
.
143 lines
3.5 KiB
Bash
143 lines
3.5 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=0.47.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=e0eb4e72a6ba4d39040500ce24a12975379c1ddd39c04f23a0e4739e520965de
|
|
replaces="cargo-tree>=0"
|
|
_cargo_dist_version=0.46.1
|
|
|
|
build_options="static bindist"
|
|
desc_option_bindist="Generate a tarball for bootstrap"
|
|
|
|
if [ -n "$build_option_static" -o -n "$build_option_bindist" ]; then
|
|
_build_static=yes
|
|
fi
|
|
|
|
if [ -z "$_build_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+="
|
|
8931dba1c23405fe630aa4ca2aceaba7de74c21cc03947c757b349d004d6a4d6"
|
|
;;
|
|
x86_64)
|
|
checksum+="
|
|
a27eb5d47b520ef2c554605bf789f80652af63531b4f6a1195d61b3dfd0f6e9c"
|
|
;;
|
|
x86_64-musl)
|
|
checksum+="
|
|
895a3b6928a5bf7b1ac28c339a85ddd078dd719f54245b8d845370baf8255368"
|
|
;;
|
|
ppc64le)
|
|
checksum+="
|
|
93354ae5cedaa75d44928d5e232cd9a57a9164cadf47d4a30493c05e60b59b7f"
|
|
;;
|
|
ppc64le-musl)
|
|
checksum+="
|
|
12da677338f860362e00089fe5b67ecd619c0ae4a4ca2bd14e500df32f598f49"
|
|
;;
|
|
ppc64)
|
|
checksum+="
|
|
eab0c2d96f863e3c87afc46d43c54df6614af333b98ee881278acf56d9bf3fe8"
|
|
;;
|
|
ppc64-musl)
|
|
checksum+="
|
|
48770d0f7941005c87c0ddf303a7eca2fcff4c56cfdaaf60b5d862dfeee2a59d"
|
|
;;
|
|
ppc)
|
|
checksum+="
|
|
034af894e980f642e31d35978d8cbb8839fe9c8f1119083a720a58f7ad7fb881"
|
|
;;
|
|
ppc-musl)
|
|
checksum+="
|
|
aac08878b9ce3bf7dff4247e988fdaddeaa410cccc8559f8e7e0fd45d8f2ece5"
|
|
;;
|
|
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() {
|
|
local cargo cargs
|
|
|
|
if [ -n "$_build_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
|
|
|
|
if [ -n "$_build_static" ]; then
|
|
cargs+=" --features=all-static"
|
|
fi
|
|
|
|
$cargo build --release ${cargs}
|
|
}
|
|
|
|
do_install() {
|
|
local cbin="target/release/cargo"
|
|
if [ "$CROSS_BUILD" ]; then
|
|
cbin="target/${RUST_TARGET}/release/cargo"
|
|
fi
|
|
|
|
if [ "$build_option_bindist" ]; then
|
|
local dest="cargo-${version}-${RUST_TARGET}"
|
|
mkdir -p ${XBPS_SRCDISTDIR}/distfiles ${dest}/cargo/bin
|
|
install -m 0755 ${cbin} ${dest}/cargo/bin
|
|
install -m 0644 LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY ${dest}
|
|
bsdtar cvJf ${dest}.tar.xz ${dest}
|
|
install -m 0644 ${dest}.tar.xz ${XBPS_SRCDISTDIR}/distfiles
|
|
exit 1
|
|
fi
|
|
|
|
vbin ${cbin}
|
|
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
|
|
}
|