78 lines
2.0 KiB
Bash
78 lines
2.0 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=1.79.0
|
|
revision=1
|
|
_cargo_revision=0.80.0
|
|
build_helper=rust
|
|
hostmakedepends="cargo-bootstrap rust python3 curl 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=542efc5daa159e2942d454eb2815247a96589363977429bd473f8cac8a55636e
|
|
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
|
|
|
|
# breaks requested building sqlite in bundled mode
|
|
unset LIBSQLITE3_SYS_USE_PKG_CONFIG
|
|
|
|
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
|
|
}
|