#!/bin/sh set -eu version_rustc_bootstrap="$1" version_rustc="$2" case "$version_rustc" in 1.3[0-9].*|1.4[0-3].*) version_llvm=7.1.0 ;; 1.4[4-9].*|1.5[0-7].*) version_llvm=10.0.1 ;; 1.5[8-9].*|1.6[0-8].*) version_llvm=13.0.1 ;; 1.69.*|1.7[0-8].*) version_llvm=16.0.6 ;; *) version_llvm=18.1.8 ;; esac case "$version_rustc" in 1.3[0-9].*|1.4[0-6].*) targets='src/libstd src/librustc cargo' ;; 1.4[7-9].*|1.5[0-9].*|1.6[0-1].*) targets='library/std src/librustc cargo' ;; *) targets='library/std compiler/rustc cargo' ;; esac dir_download="$PWD/download" mkdir -p build; cd build dir_install="$PWD/install-rustc-$version_rustc" # Prepare source tar xf "$dir_download/rustc-$version_rustc-src.tar.xz" cd "rustc-$version_rustc-src" # Configure source export PKG_CONFIG_PATH="$PWD/../install-openssl/lib/pkgconfig" export OPENSSL_STATIC=1 ./configure \ --build="$("$PWD/../install-llvm-$version_llvm/bin/llvm-config" --host-target)" \ --prefix="$dir_install" \ --sysconfdir="$dir_install/etc" \ --local-rust-root="$PWD/../install-rustc-$version_rustc_bootstrap" \ --llvm-root="$PWD/../install-llvm-$version_llvm" \ --enable-vendor \ --release-channel=release # Build and install mkdir -p "$dir_install" ./x.py install --stage 2 $targets $MAKEFLAGS