153 lines
5 KiB
Bash
153 lines
5 KiB
Bash
# Template file for 'rust'
|
|
pkgname=rust
|
|
version=1.25.0
|
|
revision=1
|
|
_rust_dist_version=1.25.0
|
|
_cargo_dist_version=0.25.0
|
|
# NB. if you push any(!) new version, don't forget to put a build
|
|
# output of musl to https://repo.voidlinux.eu/distfiles/
|
|
wrksrc="rustc-${version}-src"
|
|
lib32disabled=yes
|
|
patch_args="-Np1"
|
|
build_style=configure
|
|
make_build_args="dist VERBOSE=1"
|
|
only_for_archs="i686 x86_64 x86_64-musl"
|
|
hostmakedepends="cmake curl pkg-config python"
|
|
makedepends="libffi-devel llvm ncurses-devel zlib-devel"
|
|
short_desc="Safe, concurrent, practical systems language"
|
|
maintainer="Enno Boland <gottox@voidlinux.eu>"
|
|
homepage="http://www.rust-lang.org/"
|
|
license="MIT, Apache-2.0"
|
|
distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"
|
|
checksum=eef63a0aeea5147930a366aee78cbde248bb6e5c6868801bdf34849152965d2d
|
|
|
|
case "$XBPS_MACHINE" in
|
|
x86_64-musl)
|
|
hostmakedepends+=" libcurl libgit2"
|
|
distfiles+="
|
|
https://repo.voidlinux.eu/distfiles/rustc-${_rust_dist_version}-x86_64-unknown-linux-musl.tar.gz
|
|
https://repo.voidlinux.eu/distfiles/rust-std-${_rust_dist_version}-x86_64-unknown-linux-musl.tar.gz
|
|
https://repo.voidlinux.eu/distfiles/cargo-${_cargo_dist_version}-x86_64-unknown-linux-musl.tar.gz"
|
|
checksum+="
|
|
f70810658e111e22a48562f3a0e658c6a89427e2dc9f0d01079df7d81c1a5d84
|
|
3dcb3ce1a0972ab637062f9556f269a00cb2e9f537a1ca02314d5090373795b3
|
|
b909608608b36cd75f63f7aab1efb31f3eb50a1f0744151474ebc9559f721bdd"
|
|
;;
|
|
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+="
|
|
f8f4ae2f4b76416bfa90758267df4280dd078235dfba92dac0431595493443be
|
|
a3258308e3a9fe364d63b5d782efb285ab410bdfc01d168c119122ddbc9a02e2
|
|
9cad9675f7e48d7792b931d662031c6b9f6b834b048108be3615eac38ef5303a"
|
|
;;
|
|
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+="
|
|
12d056e4e2aecb67f1aed3e045c9c07e9ba7449bc9f39f3d66b5c256fb8c397f
|
|
407318bad891e2e2ca8e35f1be97a4cf70b76e4c7ce8b4e838048bfabea26acb
|
|
7f06f92a3013d2f54be69ccaa148979bf5d6e95b57d3c48981b28b0b3feb78d3"
|
|
;;
|
|
esac
|
|
|
|
post_extract() {
|
|
rm -rf src/llvm
|
|
|
|
mkdir -p stage0
|
|
cp -flr ../rustc-*/rustc/* stage0
|
|
cp -flr ../rust-std-*/rust-std-*/* stage0
|
|
case "$XBPS_MACHINE" in
|
|
*-musl) cp -flr ../cargo stage0/bin;;
|
|
*) cp -flr ../cargo-*/cargo/* stage0;;
|
|
esac
|
|
|
|
# XXX: Cheat Rust build system so we can build rustc using different
|
|
# version of (prebuilt) stable rustc than preconfigured. It's hack-ish,
|
|
# but since we're basically rebuilding rustc with the same version,
|
|
# it's actually safe.
|
|
# Note: --enable-local-rebuild from #33787 didn't work, don't know why.
|
|
export LD_LIBRARY_PATH="$wrksrc/stage0/lib"
|
|
rustc_ver="$($wrksrc/stage0/bin/rustc --version | cut -f2 -d ' ')"
|
|
rustc_key="$(printf "$rustc_ver" | md5sum | cut -c1-8)"
|
|
sed -Ei \
|
|
-e "s/^(rustc):.*/\1: $rustc_ver-1970-01-01/" \
|
|
-e "s/^(rustc_key):.*/\1: $rustc_key/" \
|
|
src/stage0.txt
|
|
|
|
# Generate config for bootstrap.py to use our prebuilt rustc and cargo
|
|
# for bootstrapping instead of downloading snapshot from internet.
|
|
cat > config.toml <<EOF
|
|
[build]
|
|
cargo = "$wrksrc/stage0/bin/cargo"
|
|
rustc = "$wrksrc/stage0/bin/rustc"
|
|
EOF
|
|
|
|
sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
do_configure() {
|
|
local _triplet
|
|
case $XBPS_TARGET_MACHINE in
|
|
i686) _triplet=i686-unknown-linux-gnu;;
|
|
x86_64) _triplet=x86_64-unknown-linux-gnu;;
|
|
x86_64-musl) _triplet=x86_64-unknown-linux-musl;;
|
|
*) _triplet=$XBPS_TARGET_MACHINE;;
|
|
esac
|
|
export LD_LIBRARY_PATH="$wrksrc/stage0/lib"
|
|
configure_args="
|
|
--prefix=/usr
|
|
--host=${_triplet}
|
|
--build=${_triplet}
|
|
--release-channel=stable
|
|
--disable-rpath
|
|
--disable-docs
|
|
--disable-codegen-tests
|
|
--enable-ccache
|
|
--llvm-root=/usr
|
|
--enable-local-rust
|
|
--local-rust-root=$wrksrc/stage0
|
|
"
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
*-musl)
|
|
configure_args+="--musl-root=/usr --disable-jemalloc"
|
|
;;
|
|
esac
|
|
./configure $configure_args
|
|
|
|
}
|
|
do_install() {
|
|
vmkdir usr
|
|
tar xf build/dist/rustc-*-*-*.tar.gz -C "$DESTDIR/usr" --strip-components=2 --exclude=manifest.in
|
|
tar xf build/dist/rust-std-*-*-*.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
|
|
}
|
|
}
|