121 lines
3.9 KiB
Bash
121 lines
3.9 KiB
Bash
# Template file for 'rust'
|
|
pkgname=rust
|
|
version=1.12.1
|
|
revision=1
|
|
wrksrc="rustc-${version}"
|
|
lib32disabled=yes
|
|
patch_args="-Np1"
|
|
build_style=configure
|
|
make_build_args="dist VERBOSE=1"
|
|
only_for_archs="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="Juan RP <xtraeme@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=97913ae4cb255618aaacd1a534b11f343634b040b32656250d09d8d9ec02d3dc
|
|
|
|
case "$XBPS_MACHINE" in
|
|
x86_64-musl)
|
|
distfiles+="
|
|
https://repo.voidlinux.eu/distfiles/rustc-1.11.0-x86_64-unknown-linux-musl.tar.gz
|
|
https://repo.voidlinux.eu/distfiles/rust-std-1.11.0-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+="
|
|
6f1cfcab1760573f949265726951e9032f9f3ce8a202d727c1f84026341b8c33
|
|
fbb6398b8537f9435d9c362f5e79be000df9df090d5d2bc6113c69bc050aa1fa
|
|
587172026c0565e839d96b0c1d4c68c000927817398241f96682dca47fa8c3b9"
|
|
;;
|
|
x86_64)
|
|
distfiles+="
|
|
https://static.rust-lang.org/dist/2016-08-16/rustc-1.11.0-x86_64-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/dist/2016-08-16/rust-std-1.11.0-x86_64-unknown-linux-gnu.tar.gz
|
|
https://static.rust-lang.org/cargo-dist/2016-07-05/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz"
|
|
checksum+="
|
|
e9d27a72900da33c1bbd0e59dd42fd6414c6bcdfa33593fb7c7360068406394a
|
|
893a53b5f78ec9eb7ac4ad3b3bd375d2ddad8ca1687ed5867621ec157eddbea5
|
|
cf47787fd50bf6c7f68db290eab054e493e4619d42a8faf66565431449055f1c"
|
|
;;
|
|
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 LD_LIBRARY_PATH="$wrksrc/stage0/lib"
|
|
}
|
|
|
|
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-docs
|
|
--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
|
|
|
|
vlicense COPYRIGHT
|
|
vlicense LICENSE-APACHE
|
|
vlicense LICENSE-MIT
|
|
|
|
cd ${DESTDIR}/usr/lib
|
|
ln -sf rustlib/*/lib/*.so . # symlinks instead of copies
|
|
|
|
rm -rf ${DESTDIR}/usr/share/doc/rust
|
|
}
|