Skip to content

Rustc: Update to version 1.84.0 #315

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
119 changes: 119 additions & 0 deletions rustc-1.84.0-0.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#! /bin/bash

PKG=rustc
VERSION=1.84.0
BUILD=0

PREFIX=/pkg/$PKG-$VERSION-$BUILD

set -xe
umask 022

TEMPFILES=/scratch/local2
if $(env | grep MXQ_SERVERID >/dev/null); then TEMPFILES=$TMPDIR ; fi

if [ -n "$TESTING" ]; then PREFIX=${TEMPFILES}/$PKG-$VERSION-$BUILD ; fi

BUILD_TMPDIR=${TEMPFILES}/$PKG-$VERSION-$BUILD.build.tmp
test -d $BUILD_TMPDIR && rm -rf $BUILD_TMPDIR
mkdir -p $BUILD_TMPDIR/home
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home

exec </dev/null

mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$PATH
LD_LIBRARY_PATH=$PREFIX/lib:\$LD_LIBRARY_PATH
export PATH LD_LIBRARY_PATH
if [ -d /pkg/${PKG}-${VERSION}-${BUILD}/.compatlibs ]; then LD_LIBRARY_PATH=${PREFIX}/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi
EOF
. $PREFIX/profile
. /pkg/llvm-17.0.6-0/profile

export MAKEFLAGS="-j $(nproc)"

BUILDDIR=$PREFIX/build

mkdir -p $BUILDDIR
cd $BUILDDIR

test -e $PKG-$VERSION-src.tar.gz || wget https://static.rust-lang.org/dist/$PKG-$VERSION-src.tar.gz
test -d $PKG-$VERSION-src || tar xvf $PKG-$VERSION-src.tar.gz
cd $PKG-$VERSION-src

cat << EOF > config.toml
# see config.toml.example for more possible options
# https://github.com/rust-lang/rust/issues/135358
profile = "dist"

change-id = 133207

[llvm]
link-shared=true

# Do not download pre-built LLVM, instead either use the system
# LLVM or build LLVM from the shipped source.
download-ci-llvm = false

# use ninja
ninja = true

targets = "X86"
# When compiling LLVM, the experimental targets (WebAssembly
# and RISCV) are built by default - omit them
experimental-targets = ""

[build]
# omit HTML docs to save time and space (comment this to build them)
docs = false

# install cargo as well as rust
extended = true

# Use the source code shipped in the tarball for the dependencies.
# The combination of this and the "locked-deps" entry avoids downloading
# many crates from Internet, and makes the Rustc build more stable.
vendor = true

[install]
# Adjust the prefix for the desired destination
prefix = "$PREFIX"
sysconfdir = "etc"

# docdir is used even if the full awesome docs are not installed
docdir = "share/doc/rustc-${VERSION}"

[rust]
channel = "stable"
rpath = false

# Enable the same optimizations as the official upstream build.
codegen-units = 1
EOF

sed '/MirOpt/d' -i src/bootstrap/src/core/builder/mod.rs

export RUST_BACKTRACE=full
export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &&
python3 ./x.py build

python3 ./x.py install

cd ${BUILDDIR}

BINDGENVERS=0.28.0

test -e ${BUILDDIR}/cbindgen-${BINDGENVERS}.tar.gz || wget https://github.com/eqrion/cbindgen/archive/v${BINDGENVERS}/cbindgen-${BINDGENVERS}.tar.gz -O ${BUILDDIR}/cbindgen-${BINDGENVERS}.tar.gz
test -d cbindgen-${BINDGENVERS} || tar xvf ${BUILDDIR}/cbindgen-${BINDGENVERS}.tar.gz

cd cbindgen-${BINDGENVERS}

source ${PREFIX}/profile

cargo build --release
install -Dm755 target/release/cbindgen $PREFIX/bin


exit