#!/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=." # This package mimics the download process of rust's 'x.py' # bootstrap library to allow for the removal of the internet # connection requirement per build. { mkdir -p "${cache_dir:=build/cache/2022-02-24}" for tarball in *.tar.xz\?no-extract; do mv -f "$tarball" "$cache_dir/${tarball%%\?no-extract}" done } # 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 <> 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"