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.4 KiB

#!/bin/sh
set -eu
version_mrustc=0.10.1
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"
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' \
-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
cp "$dir_download/rustc-$version_mrustc_rust-src.tar.xz" .
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'
make
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 \$@
EOF