75 lines
1.9 KiB
Bash
75 lines
1.9 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=1.69.0
|
|
revision=1
|
|
_cargo_revision=0.70.0
|
|
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/refs/tags/${_cargo_revision}.tar.gz"
|
|
checksum=35d9a86e8d6d942e6c7c8e3333760de33a886063a918a86083724df02a43da7f
|
|
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
|
|
|
|
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
|
|
}
|