From 1733e3e14b3d02bb8339a659e5880f50c4158032 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sat, 18 Jan 2025 15:14:27 +0100 Subject: [PATCH] Update rust bootstrap --- rust/build.sh | 2 +- rust/build_mrustc.sh | 31 +++++++++++++++++++++++++------ rust/build_rust.sh | 12 +++++++++++- rust/download.sh | 8 +++----- rust/download.sha256 | 6 +++++- rust/install_gentoo.txt | 6 +++--- 6 files changed, 48 insertions(+), 17 deletions(-) diff --git a/rust/build.sh b/rust/build.sh index 2c8a618..42cd8c1 100755 --- a/rust/build.sh +++ b/rust/build.sh @@ -9,7 +9,7 @@ version_openssl=1.1.1w version_mrustc=0.10.1 version_mrustc_rust=1.29.0 versions_llvm='7.1.0 10.0.1 13.0.1 16.0.6 18.1.8' -versions_rustc='1.30.1 1.31.1 1.32.0 1.33.0 1.34.2 1.35.0 1.36.0 1.37.0 1.38.0 1.39.0 1.40.0 1.41.1 1.42.0 1.43.1 1.44.1 1.45.2 1.46.0 1.47.0 1.48.0 1.49.0 1.50.0 1.51.0 1.52.1 1.53.0 1.54.0 1.55.0 1.56.1 1.57.0 1.58.1 1.59.0 1.60.0 1.61.0 1.62.1 1.63.0 1.64.0 1.65.0 1.66.1 1.67.1 1.68.2 1.69.0 1.70.0 1.71.1 1.72.1 1.73.0 1.74.1 1.75.0 1.76.0 1.77.2 1.78.0 1.79.0 1.80.0' +versions_rustc='1.30.1 1.31.1 1.32.0 1.33.0 1.34.2 1.35.0 1.36.0 1.37.0 1.38.0 1.39.0 1.40.0 1.41.1 1.42.0 1.43.1 1.44.1 1.45.2 1.46.0 1.47.0 1.48.0 1.49.0 1.50.0 1.51.0 1.52.1 1.53.0 1.54.0 1.55.0 1.56.1 1.57.0 1.58.1 1.59.0 1.60.0 1.61.0 1.62.1 1.63.0 1.64.0 1.65.0 1.66.1 1.67.1 1.68.2 1.69.0 1.70.0 1.71.1 1.72.1 1.73.0 1.74.1 1.75.0 1.76.0 1.77.2 1.78.0 1.79.0 1.80.1 1.81.0 1.82.0 1.83.0 1.84.0' # https://github.com/rust-lang/rust/blob/master/RELEASES.md test -d build/install-openssl || ./build_openssl.sh rm -rf build/openssl-$version_openssl diff --git a/rust/build_mrustc.sh b/rust/build_mrustc.sh index 753fb18..7c24af9 100755 --- a/rust/build_mrustc.sh +++ b/rust/build_mrustc.sh @@ -1,9 +1,23 @@ #!/bin/sh set -eu +# From: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/multiprocessing.eclass +makeopts_jobs() { + # This assumes the first .* will be more greedy than the second .* + # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). + local jobs=$(echo " $MAKEFLAGS " | sed -r -n \ + -e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ + -e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p') + echo ${jobs:-1} +} + version_mrustc=0.10.1 version_mrustc_rust=1.29.0 +VERSION_GIT_FULLHASH="2a9ab55bbaa706544858ab0968180e665fe7ff4a" +VERSION_GIT_SHORTHASH="2a9ab55" +VERSION_GIT_BRANCH="v$version_mrustc" + dir_download="$PWD/download" dir_patches="$PWD/patches" mkdir -p build; cd build @@ -13,29 +27,34 @@ dir_install="$PWD/install-rustc-$version_mrustc_rust" tar xf "$dir_download/mrustc-$version_mrustc.tar.gz" cd "mrustc-$version_mrustc" -sed -i -e 's/$(shell git show --pretty=%H -s --no-show-signature)/b6754f574f8846eb842feba4ccbeeecb10bdfacc/g' \ - -e 's/$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/v0.10.1/g' \ - -e 's/$(shell git show -s --pretty=%h --no-show-signature)/b6754f5/g' \ +sed -i -e 's/$(shell git show --pretty=%H -s --no-show-signature)/'"$VERSION_GIT_FULLHASH"'/g' \ + -e 's/$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/'"$VERSION_GIT_BRANCH"'/g' \ + -e 's/$(shell git show -s --pretty=%h --no-show-signature)/'"$VERSION_GIT_SHORTHASH"'/g' \ -e 's/$(shell git diff-index --quiet HEAD; echo $$?)/0/g' \ Makefile sed -i -e 's/ -g\>//' Makefile tools/common/Makefile tools/minicargo/Makefile sed -i -e '/args.push_back("-g");/d' tools/minicargo/build.cpp +export RUSTC_VERSION="$version_mrustc_rust" +export MRUSTC_TARGET_VER="${version_mrustc_rust%.*}" + cp "$dir_download/rustc-$version_mrustc_rust-src.tar.xz" . +touch "rustc-$version_mrustc_rust-src.tar.gz" make RUSTC_SRC_TARBALL="rustc-$version_mrustc_rust-src.tar.xz" RUSTCSRC # Build and install export PKG_CONFIG_PATH="$PWD/../install-openssl/lib/pkgconfig:${PKG_CONFIG_PATH:-}" export CMAKE_GENERATOR='Unix Makefiles' +export PARLEVEL="$(makeopts_jobs)" make -make -f minicargo.mk rustc-$version_mrustc_rust-src/build/bin/llvm-config +make -f minicargo.mk "rustc-$version_mrustc_rust-src/build/bin/llvm-config" make -f minicargo.mk make -C run_rustc cp -a run_rustc/output/prefix "$dir_install" cat > "$dir_install/bin/rustc" << EOF #!/bin/sh -d=\$(dirname \$0) -LD_LIBRARY_PATH="$dir_install/lib:$dir_install/lib/rustlib/$(uname -m)-unknown-linux-gnu/lib" \$d/rustc_binary \$@ +d="\$(dirname "\$0")" +LD_LIBRARY_PATH="$dir_install/lib:$dir_install/lib/rustlib/$(uname -m)-unknown-linux-gnu/lib" "\$d/rustc_binary" "\$@" EOF diff --git a/rust/build_rust.sh b/rust/build_rust.sh index aacdde3..5b8f4b3 100755 --- a/rust/build_rust.sh +++ b/rust/build_rust.sh @@ -26,6 +26,14 @@ case "$version_rustc" in targets='library/std compiler/rustc cargo' ;; esac +extra_conf='' +case "$version_rustc" in + 1.[3-7][0-9].*|1.8[0-1].*) + ;; + *) + extra_conf='--disable-lld' ;; +esac + dir_download="$PWD/download" mkdir -p build; cd build dir_install="$PWD/install-rustc-$version_rustc" @@ -35,6 +43,7 @@ tar xf "$dir_download/rustc-$version_rustc-src.tar.xz" cd "rustc-$version_rustc-src" # Configure source +rm -f config.toml export PKG_CONFIG_PATH="$PWD/../install-openssl/lib/pkgconfig" export OPENSSL_STATIC=1 ./configure \ @@ -43,8 +52,9 @@ export OPENSSL_STATIC=1 --sysconfdir="$dir_install/etc" \ --local-rust-root="$PWD/../install-rustc-$version_rustc_bootstrap" \ --llvm-root="$PWD/../install-llvm-$version_llvm" \ + --release-channel=release \ --enable-vendor \ - --release-channel=release + $extra_conf # Build and install mkdir -p "$dir_install" diff --git a/rust/download.sh b/rust/download.sh index 5692923..baeef70 100755 --- a/rust/download.sh +++ b/rust/download.sh @@ -1,18 +1,16 @@ #!/bin/sh set -eu -version_openssl=1.1.1w # https://www.openssl.org/source/old/1.1.1/index.html +version_openssl=1.1.1w # https://openssl-library.org/source/old/1.1.1/index.html version_mrustc=0.10.1 # https://github.com/thepowersgang/mrustc/tags -version_mrustc_rust=1.29.0 # Depends on mrustc -versions_llvm='7.1.0 10.0.1 13.0.1 16.0.6 18.1.8' # https://releases.llvm.org -versions_rustc='1.30.1 1.31.1 1.32.0 1.33.0 1.34.2 1.35.0 1.36.0 1.37.0 1.38.0 1.39.0 1.40.0 1.41.1 1.42.0 1.43.1 1.44.1 1.45.2 1.46.0 1.47.0 1.48.0 1.49.0 1.50.0 1.51.0 1.52.1 1.53.0 1.54.0 1.55.0 1.56.1 1.57.0 1.58.1 1.59.0 1.60.0 1.61.0 1.62.1 1.63.0 1.64.0 1.65.0 1.66.1 1.67.1 1.68.2 1.69.0 1.70.0 1.71.1 1.72.1 1.73.0 1.74.1 1.75.0 1.76.0 1.77.2 1.78.0 1.79.0 1.80.0' # https://github.com/rust-lang/rust/blob/master/RELEASES.md +versions_llvm='7.1.0 10.0.1 13.0.1 16.0.6 18.1.8' # https://github.com/llvm/llvm-project/releases +versions_rustc='1.29.0 1.30.1 1.31.1 1.32.0 1.33.0 1.34.2 1.35.0 1.36.0 1.37.0 1.38.0 1.39.0 1.40.0 1.41.1 1.42.0 1.43.1 1.44.1 1.45.2 1.46.0 1.47.0 1.48.0 1.49.0 1.50.0 1.51.0 1.52.1 1.53.0 1.54.0 1.55.0 1.56.1 1.57.0 1.58.1 1.59.0 1.60.0 1.61.0 1.62.1 1.63.0 1.64.0 1.65.0 1.66.1 1.67.1 1.68.2 1.69.0 1.70.0 1.71.1 1.72.1 1.73.0 1.74.1 1.75.0 1.76.0 1.77.2 1.78.0 1.79.0 1.80.1 1.81.0 1.82.0 1.83.0 1.84.0' # https://github.com/rust-lang/rust/blob/master/RELEASES.md mkdir -p download cd download wget -c "https://www.openssl.org/source/old/1.1.1/openssl-$version_openssl.tar.gz" wget -c "https://github.com/thepowersgang/mrustc/archive/v$version_mrustc/mrustc-$version_mrustc.tar.gz" -wget -c "https://static.rust-lang.org/dist/rustc-$version_mrustc_rust-src.tar.xz" for version in $versions_llvm; do case "$version" in diff --git a/rust/download.sha256 b/rust/download.sha256 index 32fb5a5..30e5f54 100644 --- a/rust/download.sha256 +++ b/rust/download.sha256 @@ -56,4 +56,8 @@ b98c09d968529212fb29eec7d6d3e9bdaa869810679b7fb86a1ca69469d75f5e rustc-1.74.1-s 4d214c4189e4dd934d47e869fa5721b2c33dbbbdea21f2fc7fa6df3f38c1dea2 rustc-1.77.2-src.tar.xz 8065824f0255faa3901db8206e6f9423f6f8c07cec28bc6f2797c6c948310ece rustc-1.78.0-src.tar.xz ab826e84b8d48ec6eda3370065034dea8c006f6a946d78a9ba12bcb50e6d3c7a rustc-1.79.0-src.tar.xz -0b9ca1e2e45b8a5f0b58db140af0dc92f8311faeb0ad883c5b71a72c02dc6e80 rustc-1.80.0-src.tar.xz +6ab79b70dc57737a1de378f212fcf8852d67fe6cf272d122a15b3ea13be77947 rustc-1.80.1-src.tar.xz +36217ef7e32f40a180e3d79bd666b4dfdaed49dd381023a5fb765fd12d0092ce rustc-1.81.0-src.tar.xz +1276a0bb8fa12288ba6fa96597d28b40e74c44257c051d3bc02c2b049bb38210 rustc-1.82.0-src.tar.xz +7b11d4242dab0921a7d54758ad3fe805153c979c144625fecde11735760f97df rustc-1.83.0-src.tar.xz +bc2c1639f26814c7b17a323992f1e08c3b01fe88cdff9a27d951987d886e00b3 rustc-1.84.0-src.tar.xz diff --git a/rust/install_gentoo.txt b/rust/install_gentoo.txt index c428e17..7330904 100644 --- a/rust/install_gentoo.txt +++ b/rust/install_gentoo.txt @@ -7,11 +7,11 @@ sudo ln -s /opt/rust-bin-$ver/bin/rustc-bin-$ver /usr/bin/rustc-bin-$ver sudo mkdir -p /etc/env.d/rust sudo touch /etc/env.d/rust/provider-rust-bin-$ver sudo eselect rust set rust-bin-$ver -sudo mkdir -p /var/db/pkg/dev-lang/rust-bin-$ver -echo 0 | sudo tee /var/db/pkg/dev-lang/rust-bin-$ver/SLOT > /dev/null +sudo mkdir -p /var/db/pkg/dev-lang/rust-bin-$ver-r100 +echo $ver | sudo tee /var/db/pkg/dev-lang/rust-bin-$ver-r100/SLOT > /dev/null sudo emerge dev-lang/rust sudo rm -rf /opt/rust-bin-$ver /usr/bin/rustc-bin-$ver sudo rm -rf /etc/env.d/rust/provider-rust-bin-$ver -sudo rm -rf /var/db/pkg/dev-lang/rust-bin-$ver +sudo rm -rf /var/db/pkg/dev-lang/rust-bin-$ver-r100