Scripts for bootstrapping various programming languages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
1.5 KiB

#!/bin/sh
set -eu
version_mrustc=0.9
version_mrustc_rust=1.29.0
dir_download="$PWD/download"
dir_patches="$PWD/patches"
mkdir -p build; cd build
dir_install="$PWD/install-rustc-$version_mrustc_rust"
# Prepare source
tar xf "$dir_download/mrustc-$version_mrustc.tar.gz"
cd "mrustc-$version_mrustc"
patch -p1 -i "$dir_patches/mrustc-0.9-gcc9.patch"
sed -i -e 's/$(shell git show --pretty=%H -s)/15773561e40ca5c8cffe0a618c544b6cfdc5ad7e/g' \
-e 's/$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/v0.9/g' \
-e 's/$(shell git show -s --pretty=%h)/15773561/g' \
-e 's/$(shell git diff-index --quiet HEAD; echo $$?)/0/g' \
Makefile
sed -i -e 's/$Vtime /$V/' \
-e "s/^\techo '#\!/\techo -e '#\!/" \
run_rustc/Makefile
sed -i -e 's/CMAKE_BUILD_TYPE=RelWithDebInfo/CMAKE_BUILD_TYPE=Release/' \
minicargo.mk
sed -i -e 's/ -g\>//' Makefile tools/common/Makefile tools/minicargo/Makefile
sed -i -e '/args.push_back("-g");/d' tools/minicargo/build.cpp
cp "$dir_download/rustc-$version_mrustc_rust-src.tar.xz" .
make RUSTC_VERSION=$version_mrustc_rust RUSTC_SRC_TARBALL="rustc-$version_mrustc_rust-src.tar.xz" RUSTCSRC
# Build and install
export RUSTC_VERSION=$version_mrustc_rust
export MRUSTC_TARGET_VER=$(echo $version_mrustc_rust | rev | cut -d . -f 2- | rev)
make -C tools/common
make -C tools/minicargo
make
make -f minicargo.mk rustc-$version_mrustc_rust-src/build/bin/llvm-config
make -j1 -f minicargo.mk output/rustc output/cargo
make -j1 PREFIX="$dir_install/" -C run_rustc