143 lines
3.5 KiB
Bash
143 lines
3.5 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=0.45.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=304b2abb13ca0219a3485466625f2a38e6011f898199272ee76ad03d4c8c68b0
|
|
replaces="cargo-tree>=0"
|
|
_cargo_dist_version=0.44.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
|
|
|
|
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+="
|
|
c7b4045b2001be2e97b0b08dfaee02097aea0e8a9983b42585d733cfa1e69683"
|
|
;;
|
|
x86_64)
|
|
checksum+="
|
|
84ba23058542691dae8157beec6a7679a420643eb6a708134bb1dfb01cbdebea"
|
|
;;
|
|
x86_64-musl)
|
|
checksum+="
|
|
653cb60214d6f1000c9a7775111dccd093c0118e7f7bf5f2f1f53a7e5e2420b3"
|
|
;;
|
|
ppc64le)
|
|
checksum+="
|
|
4f90cd6cbcf9e9d6ba11830e093092e4e6c3d156ffde2e729933869b7a039ff9"
|
|
;;
|
|
ppc64le-musl)
|
|
checksum+="
|
|
a85e8c9714a8bb7c17cd23993c677f51d9e0d6f5e85ab10f53ec1639b19bbbd4"
|
|
;;
|
|
ppc64)
|
|
checksum+="
|
|
983e2fbec9c4bfe66bab37ad64cdd5b47918378e421d9bf639e938f120650199"
|
|
;;
|
|
ppc64-musl)
|
|
checksum+="
|
|
f974893d1cac6c799345bece08c7f796eb50e1a77c4b9bc2a6451d161a57c660"
|
|
;;
|
|
ppc)
|
|
checksum+="
|
|
48f4419300fe758ebe024e6449a5ca1dff07803047a815b3d3909170baa7adcc"
|
|
;;
|
|
ppc-musl)
|
|
checksum+="
|
|
bbb93a757e75d09cb5f6d6dd837e32212acd8888426406352eccf52f329386f1"
|
|
;;
|
|
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
|
|
}
|