91 lines
2.4 KiB
Bash
91 lines
2.4 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=1.61.0
|
|
revision=1
|
|
wrksrc="cargo-rust-${version}"
|
|
build_helper=rust
|
|
hostmakedepends="cargo-bootstrap rust python3 curl cmake pkg-config zlib-devel"
|
|
makedepends="rust libcurl-devel openssl-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/rust-${version}.tar.gz
|
|
https://github.com/crossbeam-rs/crossbeam/archive/refs/tags/crossbeam-utils-0.8.8.tar.gz"
|
|
checksum="6261b51441f50abe08a2992a349b22a2385846bfc9cb288ae9a3a609b904099e
|
|
52c451910203cd9002cc4b85cff95f45c6ba245392801e80d7898ca5c3c3ab29"
|
|
replaces="cargo-tree>=0"
|
|
|
|
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
|
|
|
|
pre_patch() {
|
|
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
|
|
}
|