148 lines
3.9 KiB
Bash
148 lines
3.9 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=0.54.0
|
|
revision=1
|
|
wrksrc="cargo-${version}"
|
|
build_helper=rust
|
|
hostmakedepends="rust python3 curl cmake pkg-config zlib-devel"
|
|
makedepends="rust 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
|
|
https://github.com/crossbeam-rs/crossbeam/archive/refs/tags/crossbeam-utils-0.8.5.tar.gz"
|
|
checksum="4627e7eb0be3150d878ed695a1ef874885ff84325019499af61f5e3ade410d4b
|
|
57db07eb38b0aaf7951c79b4639819cb84bc4269507091afea7267e10a54e079"
|
|
replaces="cargo-tree>=0"
|
|
|
|
build_options="static bindist"
|
|
desc_option_bindist="Generate a tarball for bootstrap"
|
|
|
|
# rust upstream no longer ships cargo-versioned tarballs
|
|
# need to use the corresponding rust version instead
|
|
_bootstrap_url="https://static.rust-lang.org/dist"
|
|
_cargo_dist_version="1.53.0"
|
|
|
|
case "$XBPS_MACHINE" in
|
|
x86_64*|i686|ppc64le) ;;
|
|
ppc*)
|
|
# custom bootstrap tarballs still use cargo versioning, so override
|
|
_bootstrap_url="https://alpha.de.repo.voidlinux.org/distfiles"
|
|
_cargo_dist_version="0.54.0"
|
|
;;
|
|
esac
|
|
|
|
if [ -n "$build_option_static" -o -n "$build_option_bindist" ]; then
|
|
_build_static=yes
|
|
fi
|
|
|
|
if [ -z "$_build_static" ]; then
|
|
makedepends+=" libgit2-devel"
|
|
fi
|
|
|
|
distfiles+=" ${_bootstrap_url}/cargo-${_cargo_dist_version}-${RUST_BUILD}.tar.xz"
|
|
|
|
case "$XBPS_MACHINE" in
|
|
i686)
|
|
checksum+="
|
|
deebb4a4de22a60f0dec5d5b84e8dfe6ce039835935dae96477a79468aefd927"
|
|
;;
|
|
x86_64)
|
|
checksum+="
|
|
e4437f6c83574fc60e183f4df439190f7610e4a669476802795645da66fbb83b"
|
|
;;
|
|
x86_64-musl)
|
|
checksum+="
|
|
ca236408cb2c35b8c3f7c2b4e9f1e69422ed24153f445192eafb6462351e5c2b"
|
|
;;
|
|
ppc64le)
|
|
checksum+="
|
|
ca1d94161c3a4021bca170ba4ca059b5606fcd70934aca89d8cea43746880ba7"
|
|
;;
|
|
ppc64le-musl)
|
|
checksum+="
|
|
1181b721addeb2aa471bf71549a7fb09f27167c382b480cefba272f770b9f039"
|
|
;;
|
|
ppc64)
|
|
checksum+="
|
|
7d9b0428d4cd8cdd76582b3113476228013ec0b674802f18b4b5e8bbefcd3ab2"
|
|
;;
|
|
ppc64-musl)
|
|
checksum+="
|
|
695d687c19a729504ac8b57a42e395258a8b801753baf1b0b17755d7f38f7eaa"
|
|
;;
|
|
ppc)
|
|
checksum+="
|
|
176f178b9e55f399311edb4888d931e5f696766f655cc9648ae4b6ef1bdc8369"
|
|
;;
|
|
ppc-musl)
|
|
checksum+="
|
|
234cf0792407065f4c5c4276886846cee2ecfb37eea1171c2c6e4a0fba7d324c"
|
|
;;
|
|
*) broken="bootstrap binary unavailable for ${XBPS_MACHINE}";;
|
|
esac
|
|
|
|
post_extract() {
|
|
mkdir -p target/snapshot
|
|
cp ../cargo-${_cargo_dist_version}-${RUST_BUILD}/cargo/bin/cargo cargo
|
|
mv ../crossbeam-* crossbeam-utils
|
|
}
|
|
|
|
post_patch() {
|
|
rm crossbeam-utils/crossbeam-utils/no_atomic.rs
|
|
cp crossbeam-utils/no_atomic.rs crossbeam-utils/crossbeam-utils
|
|
|
|
cat >> Cargo.toml <<- EOF
|
|
[patch.crates-io]
|
|
crossbeam-utils = { path = './crossbeam-utils/crossbeam-utils' }
|
|
EOF
|
|
}
|
|
|
|
do_build() {
|
|
local 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 [ -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
|
|
}
|