b68db8e7f6
build fails on musl with more recent versions of the libc crate
123 lines
3.6 KiB
Bash
123 lines
3.6 KiB
Bash
# Template file for 'cargo'
|
|
pkgname=cargo
|
|
version=0.36.0
|
|
revision=2
|
|
build_helper=rust
|
|
hostmakedepends="rust python curl cmake pkg-config"
|
|
makedepends="libcurl-devel libgit2-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=532a39ce9acc1436c5d33ce0643d050bc29183c46abe69934622c4f24f4c6831
|
|
_cargo_dist_version=0.36.0
|
|
build_options="static"
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
hostmakedepends+=" cargo"
|
|
makedepends+=" rust"
|
|
else
|
|
case "$XBPS_MACHINE" in
|
|
x86_64-musl)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-x86_64-unknown-linux-musl.tar.gz"
|
|
checksum+="
|
|
7a84d006688ffe9e292db59690e7fc99616d6d1a6d981affb93d121fca9e8bb5"
|
|
;;
|
|
x86_64)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-x86_64-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
77586f2fb5b6f6caef0cb6d3cc32a18559d4fcd6a6db4e75f4b3fb7adb050437"
|
|
;;
|
|
i686)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-i686-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
6ef32560bfa7c85dee6ef932a5e35994457f3e05e2cf8979c19971b8a5b805e4"
|
|
;;
|
|
ppc64le)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-powerpc64le-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
d196e4e506c89653c533e34c77fb5be7928a1667bca64a3fd866dd0d1aecfc6d"
|
|
;;
|
|
ppc64le-musl)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64le-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
9347f6c8b391e0142cda60988690f7bc9a877f8012ea2e71c35343a4cb9b7ee4"
|
|
;;
|
|
ppc64)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64-unknown-linux-gnu.tar.xz"
|
|
checksum+="
|
|
512c69762fe2a18b6d9781186e77f76333f7ac179e76135cb85ba19e703afaca"
|
|
;;
|
|
ppc64-musl)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
9b8cdacbb4859addfe63cf8ea1df9eb32343e25a18bef2a6422f990728d0e78a"
|
|
;;
|
|
ppc)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-powerpc-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
821b4acd67c438b533436e1a57d11e9e267f6641493c9d49650ace657f59e106"
|
|
;;
|
|
ppc-musl)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
eee6637b48d9bbf6375a2de75e36b8670fae26d8da9c53a9890380b9a29d0bcf"
|
|
;;
|
|
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() {
|
|
if [ "$build_option_static" ]; then
|
|
unset LIBGIT2_SYS_USE_PKG_CONFIG
|
|
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
|
|
|
|
$cargo update
|
|
$cargo update --package libc --precise 0.2.55
|
|
$cargo build --release $(vopt_if static --features="all-static")
|
|
}
|
|
|
|
do_install() {
|
|
if [ "$CROSS_BUILD" ]; then
|
|
vbin target/${RUST_TARGET}/release/cargo
|
|
else
|
|
vbin target/release/cargo
|
|
fi
|
|
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
|
|
}
|