191 lines
6 KiB
Bash
191 lines
6 KiB
Bash
# Template file for 'rust'
|
|
pkgname=rust
|
|
version=1.30.0
|
|
revision=1
|
|
_rust_dist_version=1.29.2
|
|
_cargo_dist_version=0.31.0
|
|
# NB. if you push any(!) new version, don't forget to put a build
|
|
# output of musl to https://alpha.de.repo.voidlinux.org/distfiles/
|
|
wrksrc="rustc-${version}-src"
|
|
lib32disabled=yes
|
|
patch_args="-Np1"
|
|
build_style=configure
|
|
make_build_args="dist VERBOSE=1"
|
|
hostmakedepends="cmake curl pkg-config python"
|
|
makedepends="libffi-devel llvm ncurses-devel libxml2-devel zlib-devel"
|
|
depends="rust-std"
|
|
short_desc="Safe, concurrent, practical systems language"
|
|
maintainer="Enno Boland <gottox@voidlinux.eu>"
|
|
homepage="https://www.rust-lang.org/"
|
|
license="MIT, Apache-2.0"
|
|
distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"
|
|
checksum=cd0ba83fcca55b64c0c9f23130fe731dfc1882b73ae21bef96be8f2362c108ee
|
|
|
|
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)
|
|
hostmakedepends+=" libcurl libgit2"
|
|
distfiles+="
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rustc-${_rust_dist_version}-x86_64-unknown-linux-musl.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/rust-std-${_rust_dist_version}-x86_64-unknown-linux-musl.tar.xz
|
|
https://alpha.de.repo.voidlinux.org/distfiles/cargo-${_cargo_dist_version}-x86_64-unknown-linux-musl.tar.gz"
|
|
checksum+="
|
|
9550baae3d2848a881b9e42b4dd8d798615271843bc56ae1f34cdf5f946daae2
|
|
ded98b3ba0938715c1fe02812628bc0239c07109248f8d73889af9e8866fd776
|
|
0275dfc26dc8a47a7675a4bc13ceba38707197a6a3e5f0f313c7acdb574cdc57"
|
|
;;
|
|
x86_64)
|
|
# extract from src/stage0.txt
|
|
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+="
|
|
b04146b09edc4bad0de7c8fa1a5a2aa4416d365c03c5962b8a5b26c7047b7cc9
|
|
1fe9a0f354256483a354ee1b51c60bf9f3f48868581f7cb36d0cc51a82400605
|
|
391518dab2831a90851158cbace4362fb85ad909483ed08dad0c8a11bbe6bee8"
|
|
;;
|
|
i686)
|
|
# extract from src/stage0.txt
|
|
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+="
|
|
9309858b2f6f194c5a440ca163782b45b7f9f11351c2e0e1745dfdf2416aba40
|
|
d2958af5d99f1d0bd2751afe7eebce7dab24da6794be3096e1c45e98c7be7f40
|
|
800a5d9f8784231541e1a31612568951e9b3607f07fa11c728fb288aeafba000"
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# In rust terminology 'build' is the build host ($CBUILD) and `target`
|
|
# and `host` are the triplets that are supposed to run the built binaries
|
|
# ($CTARGET)
|
|
case $XBPS_MACHINE in
|
|
*-musl) _build_triplet=${XBPS_MACHINE%-musl}-unknown-linux-musl;;
|
|
*) _build_triplet=${XBPS_MACHINE}-unknown-linux-gnu;;
|
|
esac
|
|
|
|
post_extract() {
|
|
rm -rf src/llvm
|
|
|
|
if [ -z "$CROSS_BUILD" ]; then
|
|
mkdir -p stage0
|
|
cp -bflr ../rustc-*/rustc/* stage0
|
|
cp -bflr ../rust-std-*/rust-std-*/* stage0
|
|
case "$XBPS_MACHINE" in
|
|
*-musl) cp -bflr ../cargo stage0/bin;;
|
|
*)
|
|
rm ../cargo-*/cargo/manifest.in
|
|
cp -flr ../cargo-*/cargo/* stage0
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py
|
|
}
|
|
|
|
do_configure() {
|
|
export LD_LIBRARY_PATH="$wrksrc/stage0/lib"
|
|
|
|
configure_args="
|
|
--prefix=/usr
|
|
--host=${RUST_TARGET}
|
|
--target=${RUST_TARGET}
|
|
--build=${_build_triplet}
|
|
--disable-full-bootstrap
|
|
--release-channel=stable
|
|
--disable-rpath
|
|
--disable-docs
|
|
--disable-codegen-tests
|
|
--llvm-root=/usr
|
|
--set=target.${_build_triplet}.llvm-config=/usr/bin/llvm-config
|
|
"
|
|
|
|
# Disable jemalloc for now. It increases the size of small programs
|
|
# significantly (hello world without jemalloc 130KB vs with jemalloc
|
|
# 300KB) and provides worse performance in some cases.
|
|
configure_args+=" --disable-jemalloc"
|
|
|
|
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.${_build_triplet}.cc=${CC_host}
|
|
--set=target.${_build_triplet}.cxx=${CXX_host}
|
|
--set=target.${_build_triplet}.ar=${AR_host}
|
|
--set=target.${_build_triplet}.linker=${CC_host}
|
|
"
|
|
|
|
# Set 'llvm-config' for the cross target (host) so that we don't build
|
|
# LLVM for it again.
|
|
configure_args+="
|
|
--set=target.${RUST_TARGET}.llvm-config="/usr/bin/llvm-config"
|
|
"
|
|
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_${_build_triplet}="${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"
|
|
noarch=yes
|
|
pkg_install() {
|
|
vmove usr/share/doc
|
|
}
|
|
}
|
|
|
|
rust-std_package() {
|
|
short_desc+=" - standard library"
|
|
pkg_install() {
|
|
vmove usr/lib/rustlib
|
|
}
|
|
}
|