#!/bin/sh -e export DESTDIR="$1" for p in *.patch; do patch -p1 < "$p" done # 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. for p in \ curl-sys \ getrandom-0.2.8 \ libc \ libc-0.2.138 \ libc-0.2.139 \ libc-0.2.140 \ libc-0.2.143 do sed 's/\("files":{\)[^}]*/\1/' vendor/"$p"/.cargo-checksum.json > _ mv -f _ vendor/"$p"/.cargo-checksum.json done cat > config.toml </dev/null) || rust_version=null cargo --version 2>/dev/null || rust_version=null rustfmt --version 2>/dev/null || rust_version=null rust_version="${rust_version#rustc }" case "$rust_version" in "$maj.$min".*|"$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 python x.py build -j "$(grep -scF 'core id' /proc/cpuinfo)" python x.py install rm -rf \ "$1/usr/lib/rustlib/src/" \ "$1/usr/share/doc" \ "$1/usr/share/zsh" \ "$1/usr/lib/rustlib/uninstall.sh"