146 lines
4.8 KiB
Bash
146 lines
4.8 KiB
Bash
# Template file for 'rust'
|
|
pkgname=rust
|
|
version=1.16.0
|
|
revision=1
|
|
# 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 lld-devel llvm ncurses-devel zlib-devel"
|
|
short_desc="Safe, concurrent, practical systems language"
|
|
maintainer="Leah Neukirchen <leah@vuxu.org>"
|
|
homepage="http://www.rust-lang.org/"
|
|
license="MIT, Apache-2.0"
|
|
distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"
|
|
checksum=f966b31eb1cd9bd2df817c391a338eeb5b9253ae0a19bf8a11960c560f96e8b4
|
|
|
|
case "$XBPS_MACHINE" in
|
|
x86_64-musl)
|
|
distfiles+="
|
|
https://repo.voidlinux.eu/distfiles/rustc-1.15.1-x86_64-unknown-linux-musl.tar.gz
|
|
https://repo.voidlinux.eu/distfiles/rust-std-1.15.1-x86_64-unknown-linux-musl.tar.gz
|
|
https://alpine.geeknet.cz/distfiles/cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz"
|
|
checksum+="
|
|
e7518b083cfa871ff84b589db754ebf9cbf727e3be37e6df4169056c9b34b45e
|
|
ac65873446807038df761ba94e00ba5aaa51efd379a69b938102773cbad7f2dc
|
|
587172026c0565e839d96b0c1d4c68c000927817398241f96682dca47fa8c3b9"
|
|
;;
|
|
x86_64)
|
|
# extract from src/stage0.txt
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/2017-02-09/rustc-1.15.1-x86_64-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/dist/2017-02-09/rust-std-1.15.1-x86_64-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/cargo-dist/2016-11-26/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
33ff44672b731fc71145974ce84194a1a9bafe6da3a74fd1e7543f12467f8894
|
|
69b251b478e284dfcaefc1153183f26f41d504ae213a81224f2101d8dbd52bb0
|
|
4a76ae206dba572e3de3f2fd7b906b42866ca4fd5f929a6f52d38579d2794e61"
|
|
;;
|
|
i686)
|
|
# extract from src/stage0.txt
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/2017-02-09/rustc-1.15.1-i686-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/dist/2017-02-09/rust-std-1.15.1-i686-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/cargo-dist/2016-11-28/cargo-nightly-i686-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
a833304f99071600c72ecd868c1c7bd5ce49d1102332637a8eb7adb942f349ab
|
|
eff452a54b208a83b35432f226cb7de046d27b5e43edfc31d71ff340af686db0
|
|
8fb0cacdd2ab32b8dbdf74ae63914e1f97baf8bac0e8c1db1414a57677b93f88"
|
|
;;
|
|
esac
|
|
|
|
post_extract() {
|
|
rm -rf src/llvm
|
|
|
|
mkdir -p stage0
|
|
cp -flr ../rustc-*/rustc/* stage0
|
|
cp -flr ../rust-std-*/rust-std-*/* stage0
|
|
cp -flr ../cargo-*/cargo/* stage0
|
|
|
|
# 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
|
|
--enable-ccache
|
|
--enable-rustbuild
|
|
--llvm-root=/usr
|
|
"
|
|
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
|
|
tar xf build/dist/rust-docs-*-*-*.tar.gz -C "$DESTDIR/usr" --strip-components=2 --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
|
|
}
|
|
}
|