2018-12-26 19:59:18 +11:00
|
|
|
# Description: The Rust language with Cargo included.
|
|
|
|
# URL: http://www.rust-lang.org/
|
|
|
|
# Maintainer: Danny Rawlins, crux at romster dot me
|
2019-12-29 01:07:59 +11:00
|
|
|
# Depends on: llvm
|
2019-05-18 21:19:04 +10:00
|
|
|
# Optional: sccache llvm-32
|
2018-12-26 19:59:18 +11:00
|
|
|
|
|
|
|
name=rust
|
2020-03-14 14:53:13 +11:00
|
|
|
version=1.42.0
|
2018-12-26 19:59:18 +11:00
|
|
|
##cat src/stage0.txt
|
2020-03-14 14:53:13 +11:00
|
|
|
_date=2020-02-27
|
|
|
|
_rustc=1.41.1
|
|
|
|
_cargo=0.42.0
|
2018-12-26 19:59:18 +11:00
|
|
|
##
|
|
|
|
|
2020-03-27 18:12:27 +11:00
|
|
|
release=2
|
2018-12-26 19:59:18 +11:00
|
|
|
source=(
|
|
|
|
https://static.rust-lang.org/dist/${name}c-$version-src.tar.gz
|
|
|
|
https://static.rust-lang.org/dist/$_date/rust-std-$_rustc-x86_64-unknown-linux-gnu.tar.gz
|
|
|
|
https://static.rust-lang.org/dist/$_date/rustc-$_rustc-x86_64-unknown-linux-gnu.tar.gz
|
|
|
|
https://static.rust-lang.org/dist/$_date/cargo-$_cargo-x86_64-unknown-linux-gnu.tar.gz
|
|
|
|
)
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cd "${name}c-$version-src"
|
|
|
|
|
2019-10-11 20:37:45 +11:00
|
|
|
local ERROR
|
|
|
|
local DATE="$(awk '/^date: / { print $2 }' src/stage0.txt)"
|
|
|
|
local RUSTC="$(awk '/^rustc: / { print $2 }' src/stage0.txt)"
|
|
|
|
local CARGO="$(awk '/^cargo: / { print $2 }' src/stage0.txt)"
|
|
|
|
if [ "$DATE" != "$_date" ]; then
|
|
|
|
printf "\e[031mError: _date $_date != $DATE\033[0m\n"
|
|
|
|
ERROR=1
|
|
|
|
fi
|
|
|
|
if [ "$RUSTC" != "$_rustc" ]; then
|
|
|
|
printf "\e[031mError: _rustc $_rustc != $RUSTC\033[0m\n"
|
|
|
|
ERROR=1
|
|
|
|
fi
|
|
|
|
if [ "$CARGO" != "$_cargo" ]; then
|
|
|
|
printf "\e[031mError: _cargo $_cargo != $CARGO\033[0m\n"
|
|
|
|
ERROR=1
|
|
|
|
fi
|
|
|
|
[ $ERROR ] && exit 1
|
|
|
|
unset DATE RUSTC CARGO ERROR
|
|
|
|
|
2018-12-26 19:59:18 +11:00
|
|
|
mkdir -p build/cache/$_date
|
|
|
|
cp $PKGMK_SOURCE_DIR/rust-std-$_rustc-x86_64-unknown-linux-gnu.tar.gz build/cache/$_date/
|
|
|
|
cp $PKGMK_SOURCE_DIR/rustc-$_rustc-x86_64-unknown-linux-gnu.tar.gz build/cache/$_date/
|
|
|
|
cp $PKGMK_SOURCE_DIR/cargo-$_cargo-x86_64-unknown-linux-gnu.tar.gz build/cache/$_date/
|
|
|
|
|
2019-06-04 00:20:39 +10:00
|
|
|
prt-get isinst sccache && export RUSTC_WRAPPER=/usr/bin/sccache
|
2018-12-26 19:59:18 +11:00
|
|
|
|
|
|
|
cat <<- EOF > $SRC/config.toml
|
|
|
|
[llvm]
|
2019-02-15 21:00:35 +11:00
|
|
|
ninja = true
|
2018-12-26 19:59:18 +11:00
|
|
|
targets = "X86"
|
2019-02-15 21:00:35 +11:00
|
|
|
experimental-targets = ""
|
2019-04-17 01:24:08 +10:00
|
|
|
link-shared = true
|
2018-12-26 19:59:18 +11:00
|
|
|
|
|
|
|
[install]
|
|
|
|
prefix = "/usr"
|
|
|
|
|
|
|
|
[rust]
|
|
|
|
channel = "stable"
|
|
|
|
rpath = false
|
|
|
|
codegen-tests = false
|
2019-02-15 21:00:35 +11:00
|
|
|
backtrace-on-ice = true
|
2018-12-26 19:59:18 +11:00
|
|
|
|
|
|
|
[build]
|
2019-02-15 21:00:35 +11:00
|
|
|
docs = false
|
2018-12-26 19:59:18 +11:00
|
|
|
extended = true
|
|
|
|
python = "python3"
|
|
|
|
EOF
|
2019-05-18 21:19:04 +10:00
|
|
|
# part of [build] options
|
|
|
|
if [ -e '/usr/bin/rustc' ]; then
|
2020-03-27 18:12:27 +11:00
|
|
|
if [ -z "$(/usr/bin/ldd /usr/bin/rustc | egrep '.*libLLVM-.*.so => not found')" ]; then
|
2019-05-18 21:19:04 +10:00
|
|
|
cat <<- EOF >> $SRC/config.toml
|
2019-06-04 00:20:39 +10:00
|
|
|
cargo = "/usr/bin/cargo"
|
|
|
|
rustc = "/usr/bin/rustc"
|
2019-05-18 21:19:04 +10:00
|
|
|
EOF
|
2019-06-04 00:20:39 +10:00
|
|
|
else
|
2019-10-11 20:37:45 +11:00
|
|
|
printf "\e[031mllvm broken symlink detected, not using system rust to bootstrap\033[0m\n"
|
2019-06-04 00:20:39 +10:00
|
|
|
fi
|
2019-05-18 21:19:04 +10:00
|
|
|
fi
|
|
|
|
|
|
|
|
cat <<- EOF >> $SRC/config.toml
|
|
|
|
[target.x86_64-unknown-linux-gnu]
|
|
|
|
llvm-config = "/usr/bin/llvm-config"
|
|
|
|
EOF
|
2018-12-26 19:59:18 +11:00
|
|
|
|
2019-05-18 21:19:04 +10:00
|
|
|
if [ -e '/usr/bin/llvm-config-32' ]; then
|
2018-12-26 19:59:18 +11:00
|
|
|
cat <<- EOF >> $SRC/config.toml
|
2019-05-18 21:19:04 +10:00
|
|
|
[target.i686-unknown-linux-gnu]
|
|
|
|
llvm-config = "/usr/bin/llvm-config-32"
|
2018-12-26 19:59:18 +11:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat $SRC/config.toml
|
|
|
|
|
2019-05-18 21:19:04 +10:00
|
|
|
mkdir "$PKGMK_SOURCE_DIR/rust" || true
|
|
|
|
export CARGO_HOME="$PKGMK_SOURCE_DIR/rust"
|
2018-12-26 19:59:18 +11:00
|
|
|
|
|
|
|
export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"
|
2019-02-15 21:00:35 +11:00
|
|
|
/usr/bin/python3 ./x.py build --config="${SRC}"/config.toml --exclude src/tools/miri -j ${JOBS-1}
|
|
|
|
|
|
|
|
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
2018-12-26 19:59:18 +11:00
|
|
|
DESTDIR=$PKG /usr/bin/python3 ./x.py --config="${SRC}"/config.toml install
|
2019-02-15 21:00:35 +11:00
|
|
|
unset LIBSSH2_SYS_USE_PKG_CONFIG
|
2018-12-26 19:59:18 +11:00
|
|
|
|
|
|
|
#cleanup
|
|
|
|
rm -r $PKG/usr/share/doc
|
|
|
|
rm -r $PKG/usr/share/zsh
|
|
|
|
rm -r $PKG/etc
|
|
|
|
rm $PKG/usr/lib/rustlib/{components,manifest-rustc,rust-installer-version,uninstall.sh}
|
|
|
|
}
|