c418f3830b
without this patch, some packages fail to build on i686 [ci skip]
253 lines
9.3 KiB
Bash
253 lines
9.3 KiB
Bash
# Template file for 'rust'
|
|
pkgname=rust
|
|
version=1.35.0
|
|
revision=2
|
|
_rust_dist_version=1.35.0
|
|
_cargo_dist_version=0.36.0
|
|
# Always make sure custom distfiles used for bootstrap are
|
|
# uploaded to https://alpha.de.repo.voidlinux.org/distfiles/
|
|
wrksrc="rustc-${version}-src"
|
|
build_style=configure
|
|
make_build_args="dist VERBOSE=1"
|
|
hostmakedepends="cmake curl pkg-config python"
|
|
makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm"
|
|
depends="rust-std"
|
|
short_desc="Safe, concurrent, practical systems language"
|
|
maintainer="Enno Boland <gottox@voidlinux.org>"
|
|
license="MIT, Apache-2.0"
|
|
homepage="https://www.rust-lang.org/"
|
|
distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"
|
|
checksum=5a4d637a716bac18d085f44dd87ef48b32195f71b967d872d80280b38cff712d
|
|
lib32disabled=yes
|
|
patch_args="-Np1"
|
|
|
|
build_options="static_llvm"
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
hostmakedepends+=" cargo llvm"
|
|
# These are required for building the buildhost's stage0/1
|
|
hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
|
|
else
|
|
case "$XBPS_MACHINE" in
|
|
x86_64-musl)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/rustc-${_rust_dist_version}-x86_64-unknown-linux-musl.tar.xz
|
|
https://static.rust-lang.org/dist/rust-std-${_rust_dist_version}-x86_64-unknown-linux-musl.tar.xz
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-x86_64-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
961df84a116c7b1b11eb912d33c8edb233b76980f97983f9ed3989621f9f90c3
|
|
3574e0d43b2746ea0cb9f8084670699f5cb920cee646026cec1da152818c51ba
|
|
0466ed241c44d137ee65aa7dbba8fc1cc94e56b252c323c387523b5cb430210e"
|
|
;;
|
|
x86_64)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/rustc-${_rust_dist_version}-x86_64-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/dist/rust-std-${_rust_dist_version}-x86_64-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-x86_64-unknown-linux-gnu.tar.xz"
|
|
checksum+="
|
|
bb3a07a1f2fdc3eeeee25fc40131d3f05494e3838dfd4e9275475ffc500d7a9e
|
|
5dfa92661ff1a22680785bd6999b6117ae66841e2bd9e5318eb97002956131e4
|
|
ab5a6ff1947463dbd2477ca5dac2012494dae821112098ae0c54add652adfdc3"
|
|
;;
|
|
i686)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/rustc-${_rust_dist_version}-i686-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/dist/rust-std-${_rust_dist_version}-i686-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-i686-unknown-linux-gnu.tar.xz"
|
|
checksum+="
|
|
b05ca05cfb6f106f92283bb06158845f29abb3c1145a8dc306d2aa210f42d106
|
|
ab41c886af02a16a9a38780043d7f3da24c637629afa222b38f616fe6de86402
|
|
4c1521691a22e24e40aac18e75ea95957477284adda9ad79df64d56861aec610"
|
|
;;
|
|
ppc64le)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/rustc-${_rust_dist_version}-powerpc64le-unknown-linux-gnu.tar.xz
|
|
https://static.rust-lang.org/dist/rust-std-${_rust_dist_version}-powerpc64le-unknown-linux-gnu.tar.xz
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-powerpc64le-unknown-linux-gnu.tar.xz"
|
|
checksum+="
|
|
fd7709e00ff49d8e388f52c92a386cef075897b4363e76bec1c850d8d5d67145
|
|
b09fe43521f1e50d4b40eb8b4803a5d49dc9c5447eb0ef4da1ab723c093877ba
|
|
46419ba92849bcf8f4970ae042c333c1d82c1e18fda0531a745f88baee0e7f22"
|
|
;;
|
|
ppc64le-musl)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rustc-${_rust_dist_version}-powerpc64le-unknown-linux-musl.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rust-std-${_rust_dist_version}-powerpc64le-unknown-linux-musl.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64le-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
1e2831db0a45c3e3bd44f375678a1738407cf8f7d44af9fd3444248bc1b5d574
|
|
0bf05a5d0521dec481d67ea3a74626e884fd18f8215b774ba89d818bbdb3d8c0
|
|
9347f6c8b391e0142cda60988690f7bc9a877f8012ea2e71c35343a4cb9b7ee4"
|
|
;;
|
|
ppc64)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rustc-${_rust_dist_version}-powerpc64-unknown-linux-gnu.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rust-std-${_rust_dist_version}-powerpc64-unknown-linux-gnu.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64-unknown-linux-gnu.tar.xz"
|
|
checksum+="
|
|
7ba9b81bdc3bda8e0945d37424c5a47364961f90c4765d5223afe8c7ae865d78
|
|
abb807fbb6c3ca86f9f05014581b84a8105e2fc4ecdac33817093ba6fdb5c613
|
|
512c69762fe2a18b6d9781186e77f76333f7ac179e76135cb85ba19e703afaca"
|
|
;;
|
|
ppc64-musl)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rustc-${_rust_dist_version}-powerpc64-unknown-linux-musl.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rust-std-${_rust_dist_version}-powerpc64-unknown-linux-musl.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc64-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
fa843921197f51a9c5042528789531daef0e89b7b861cf94116d079bbfc2a523
|
|
01145b57d2e11ca7bd06dd57a8582ac5d34c683a9cd827920f2489dbdbc51539
|
|
9b8cdacbb4859addfe63cf8ea1df9eb32343e25a18bef2a6422f990728d0e78a"
|
|
;;
|
|
ppc)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/rustc-${_rust_dist_version}-powerpc-unknown-linux-gnu.tar.xz
|
|
https://static.rust-lang.org/dist/rust-std-${_rust_dist_version}-powerpc-unknown-linux-gnu.tar.xz
|
|
https://static.rust-lang.org/dist/cargo-${_cargo_dist_version}-powerpc-unknown-linux-gnu.tar.xz"
|
|
checksum+="
|
|
194ae7493942b5b291870c5857a1e3126b95b6f3b028d5cbfe997f10875a78c4
|
|
901b169e011b6d2f675939c014165330756acd5bf2233c4c770229712cd9f19e
|
|
42b997dc8b562241d563993b11c070394cf48ced55c6cf86c387d0a15ff0847e"
|
|
;;
|
|
ppc-musl)
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rustc-${_rust_dist_version}-powerpc-unknown-linux-musl.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rust-std-${_rust_dist_version}-powerpc-unknown-linux-musl.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-powerpc-unknown-linux-musl.tar.xz"
|
|
checksum+="
|
|
163dfdeaeda1237a37c59b436d0288529da3277098286d7d92aa577a3e658433
|
|
e47a378ddd4d54520c2ae1a8aba74ec2933ce33a5ce30687ef14ef0303085207
|
|
eee6637b48d9bbf6375a2de75e36b8670fae26d8da9c53a9890380b9a29d0bcf"
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
post_extract() {
|
|
if [ -z "$CROSS_BUILD" ]; then
|
|
mkdir -p stage0
|
|
rm ../rustc-*/rustc/manifest.in
|
|
cp -bflr ../rustc-*/rustc/* stage0
|
|
rm ../rust-std-*/rust-std-*/manifest.in
|
|
cp -bflr ../rust-std-*/rust-std-*/* stage0
|
|
cp -bflr ../cargo-${_cargo_dist_version}-${RUST_TARGET}/cargo/bin/cargo stage0/bin
|
|
fi
|
|
}
|
|
|
|
# we need this because cargo verifies checksums of all files in vendor
|
|
# crates when it builds and gives us no way to override or update the
|
|
# file sanely... so just clear out the file list
|
|
_clear_vendor_checksums() {
|
|
sed -i 's/\("files":{\)[^}]*/\1/' vendor/$1/.cargo-checksum.json
|
|
}
|
|
|
|
post_patch() {
|
|
rm -rf src/llvm-project
|
|
if [ "$build_option_static_llvm" ]; then
|
|
for x in ${FILESDIR}/patches/static-llvm/*.patch; do
|
|
msg_normal "Applying patch $x\n"
|
|
patch -sNp1 -i ${x}
|
|
done
|
|
fi
|
|
|
|
sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py
|
|
|
|
# clear out all the checksum nonsense of patched vendor crates
|
|
_clear_vendor_checksums libc
|
|
_clear_vendor_checksums lzma-sys
|
|
}
|
|
|
|
do_configure() {
|
|
export LD_LIBRARY_PATH="$wrksrc/stage0/lib"
|
|
|
|
configure_args="
|
|
--prefix=/usr
|
|
--host=${RUST_TARGET}
|
|
--target=${RUST_TARGET}
|
|
--build=${RUST_BUILD}
|
|
--disable-full-bootstrap
|
|
--release-channel=stable
|
|
--disable-rpath
|
|
--disable-docs
|
|
--disable-codegen-tests
|
|
--enable-vendor
|
|
--llvm-root=/usr
|
|
--set=target.${RUST_BUILD}.llvm-config=/usr/bin/llvm-config
|
|
--set=target.${RUST_TARGET}.llvm-config=/usr/bin/llvm-config
|
|
--set=target.${RUST_TARGET}.crt-static=false
|
|
"
|
|
|
|
if [ ! "$build_option_static_llvm" ]; then
|
|
configure_args+="
|
|
--enable-llvm-link-shared
|
|
"
|
|
fi
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
configure_args+="
|
|
--local-rust-root=/usr
|
|
--enable-local-rebuild
|
|
"
|
|
|
|
# Set the appropriate values for the native compilation tools
|
|
configure_args+="
|
|
--set=target.${RUST_BUILD}.cc=${CC_host}
|
|
--set=target.${RUST_BUILD}.cxx=${CXX_host}
|
|
--set=target.${RUST_BUILD}.ar=${AR_host}
|
|
--set=target.${RUST_BUILD}.linker=${CC_host}
|
|
"
|
|
else
|
|
configure_args+=" --local-rust-root=$wrksrc/stage0"
|
|
fi
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl)
|
|
configure_args+=" --set=target.${RUST_TARGET}.musl-root=/usr"
|
|
;;
|
|
esac
|
|
|
|
./configure $configure_args
|
|
}
|
|
|
|
pre_build() {
|
|
export CARGO_HOME="$wrksrc/.cargo"
|
|
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
|
|
export LD_LIBRARY_PATH="$wrksrc/stage0/lib"
|
|
export PATH="$wrksrc/stage0/bin:$PATH"
|
|
export MUSL_ROOT=/usr
|
|
export RUST_BACKTRACE=1
|
|
export RUSTFLAGS="-C linker=${CC}"
|
|
}
|
|
|
|
# Set the correct CFLAGS for the build host, we have to compile libbacktrace
|
|
# for it during stage1. Otherwise it attemps to use CFLAGS, which are the CFLAGS
|
|
# of the cross host.
|
|
do_build() {
|
|
env CFLAGS_${RUST_BUILD}="${CFLAGS_host}" make ${makejobs} ${make_build_args}
|
|
}
|
|
|
|
do_install() {
|
|
vmkdir usr
|
|
tar xf build/dist/rustc-${version}-${RUST_TARGET}.tar.gz -C "$DESTDIR/usr" --strip-components=2 --exclude=manifest.in
|
|
tar xf build/dist/rust-std-${version}-${RUST_TARGET}.tar.gz -C "$DESTDIR/usr/lib" --strip-components=3 --exclude=manifest.in
|
|
|
|
vlicense COPYRIGHT
|
|
vlicense LICENSE-APACHE
|
|
vlicense LICENSE-MIT
|
|
|
|
cd ${DESTDIR}/usr/lib
|
|
ln -sf rustlib/*/lib/*.so . # symlinks instead of copies
|
|
}
|
|
|
|
rust-doc_package() {
|
|
short_desc+=" - documentation"
|
|
archs=noarch
|
|
pkg_install() {
|
|
vmove usr/share/doc
|
|
}
|
|
}
|
|
|
|
rust-std_package() {
|
|
short_desc+=" - standard library"
|
|
pkg_install() {
|
|
vmove usr/lib/rustlib
|
|
}
|
|
}
|