#!/bin/sh -e patch -p1 < fix-curl.patch # Instruct the compiler to trim absolute paths in resulting binaries and instead # change them to relative paths ($PWD/... ./...). export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix=$PWD=." # Set shared linking as the default. sed 's/\(crt_static_default = \)true/\1false/' \ compiler/rustc_target/src/spec/linux_musl_base.rs > _ mv -f _ compiler/rustc_target/src/spec/linux_musl_base.rs # Ignore checksums of files modified above. sed 's/\("files":{\)[^}]*/\1/' \ vendor/curl-sys/.cargo-checksum.json > _ mv -f _ vendor/curl-sys/.cargo-checksum.json cat > config.toml </dev/null) || rust_version=null rust_version="${rust_version#rustc }" # If possible, use system rust to bootstrap. case "$rust_version" in $2|$maj.$(($min - 1)).*) cat >> config.toml <> config.toml <> config.toml mkdir -p libgcc printf 'INPUT(-lunwind)\n' > \ libgcc/libgcc_s.so ln -sf "$libunwind_path" \ libgcc/libgcc_s.so.1 export \ LD_LIBRARY_PATH="$PWD/libgcc:$LD_LIBRARY_PATH" \ LIBRARY_PATH="$PWD/libgcc:$LIBRARY_PATH" esac ./x.py build -j "$(grep -scF 'core id' /proc/cpuinfo)" ./x.py install rm -rf \ "$1/usr/lib/rustlib/src/" \ "$1/usr/share/doc" \ "$1/usr/share/zsh" \ "$1/usr/lib/rustlib/uninstall.sh"