From c4d71708007bd6797321c919e6928ef781561b92 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Tue, 22 Apr 2025 16:11:03 +0200 Subject: [PATCH 1/2] rustc: Add version 1.86.0-0 with cbindgen 0.28.0 --- rustc-1.86.0-0.build.sh | 140 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 rustc-1.86.0-0.build.sh diff --git a/rustc-1.86.0-0.build.sh b/rustc-1.86.0-0.build.sh new file mode 100755 index 0000000..39c83d9 --- /dev/null +++ b/rustc-1.86.0-0.build.sh @@ -0,0 +1,140 @@ +#! /bin/bash + +PKG=rustc +VERSION=1.86.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 $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=false + +# 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 + +# Instead of downloading the src/stage0 version of the compiler +# specified, use this rustc binary instead as the stage0 snapshot compiler. +# If you set this, you likely want to set cargo as well. +rustc = "/usr/local/package/bin/rustc" + +# Instead of downloading the src/stage0 version of Cargo specified, use +# this Cargo binary instead to build all Rust code +# If you set this, you likely want to set rustc as well. +cargo = "/usr/local/package/bin/cargo" + +# Instead of downloading the src/stage0 version of rustfmt specified, +# use this rustfmt binary instead as the stage0 snapshot rustfmt. +rustfmt = "/usr/local/package/bin/rustfmt" + +# Instead of downloading the src/stage0 version of cargo-clippy specified, +# use this cargo-clippy binary instead as the stage0 snapshot cargo-clippy. +# +# Note that this option should be used with the same toolchain as the rustc option above. +# Otherwise, clippy is likely to fail due to a toolchain conflict. +cargo-clippy = "/usr/local/package/bin/cargo-clippy" + +# 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 From 99549359ce837601d6dc3f1a742ddcdf8646a59d Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Tue, 22 Apr 2025 16:39:03 +0200 Subject: [PATCH 2/2] rustc: Add version 1.85.1-0 with cbindgen 0.28.0 Needed to build Rust 1.86.0. With 1.84.1 it fails with: Compiling clap_complete v4.5.37 Compiling build_helper v0.1.0 (/pkg/rustc-1.86.0-0/build/rustc-1.86.0-src/src/build_helper) error[E0658]: use of unstable library feature `io_error_more` --> src/bootstrap/src/utils/helpers.rs:150:31 | 150 | Err(e) if e.kind() == io::ErrorKind::CrossesDevices => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #86442 for more information = help: add `#![feature(io_error_more)]` to the crate attributes to enable = note: this compiler was built on 2025-01-27; consider upgrading it if it is out of date For more information about this error, try `rustc --explain E0658`. error: could not compile `bootstrap` (lib) due to 1 previous error failed to run: /usr/local/package/bin/cargo build --manifest-path /pkg/rustc-1.86.0-0/build/rustc-1.86.0-src/src/bootstrap/Cargo.toml -Zroot-dir=/pkg/rustc-1.86.0-0/build/rustc-1.86.0-src --frozen Build completed unsuccessfully in 0:00:27 --- rustc-1.85.1-0.build.sh | 140 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 rustc-1.85.1-0.build.sh diff --git a/rustc-1.85.1-0.build.sh b/rustc-1.85.1-0.build.sh new file mode 100755 index 0000000..50bac5e --- /dev/null +++ b/rustc-1.85.1-0.build.sh @@ -0,0 +1,140 @@ +#! /bin/bash + +PKG=rustc +VERSION=1.85.1 +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 $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=false + +# 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 + +# Instead of downloading the src/stage0 version of the compiler +# specified, use this rustc binary instead as the stage0 snapshot compiler. +# If you set this, you likely want to set cargo as well. +rustc = "/usr/local/package/bin/rustc" + +# Instead of downloading the src/stage0 version of Cargo specified, use +# this Cargo binary instead to build all Rust code +# If you set this, you likely want to set rustc as well. +cargo = "/usr/local/package/bin/cargo" + +# Instead of downloading the src/stage0 version of rustfmt specified, +# use this rustfmt binary instead as the stage0 snapshot rustfmt. +rustfmt = "/usr/local/package/bin/rustfmt" + +# Instead of downloading the src/stage0 version of cargo-clippy specified, +# use this cargo-clippy binary instead as the stage0 snapshot cargo-clippy. +# +# Note that this option should be used with the same toolchain as the rustc option above. +# Otherwise, clippy is likely to fail due to a toolchain conflict. +cargo-clippy = "/usr/local/package/bin/cargo-clippy" + +# 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