#!/bin/sh -e # 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/2021-06-17}" for tarball in *.tar.xz\?no-extract; do mv -f "$tarball" "$cache_dir/${tarball%%\?no-extract}" done } # Set shared linking as the default. for f in \ compiler/rustc_target/src/spec/linux_musl_base.rs \ vendor/rustc-ap-rustc_target/src/spec/linux_musl_base.rs do sed 's/\(crt_static_default = \)true/\1false/' "$f" > _ mv -f _ "$f" done # Ignore checksums of files modified above. sed 's/\("files":{\)[^}]*/\1/' \ vendor/rustc-ap-rustc_target/.cargo-checksum.json > _ mv -f _ vendor/rustc-ap-rustc_target/.cargo-checksum.json cat > config.toml <> config.toml # libgcc_s.so is needed for Rust's bootstrap binaries, on llvm-only systems # this library does not exist. This hack creates it as alias to libunwind. { mkdir -p libgcc printf 'INPUT(-lunwind)\n' > \ libgcc/libgcc_s.so ln -sf "$KISS_ROOT/usr/lib/libunwind.so.1" \ libgcc/libgcc_s.so.1 export \ LD_LIBRARY_PATH="$PWD/libgcc:$LD_LIBRARY_PATH" \ LIBRARY_PATH="$PWD/libgcc:$LIBRARY_PATH" } esac python3 ./x.py build -j "$(nproc)" python3 ./x.py install rm -rf \ "$1/usr/lib/rustlib/src/" \ "$1/usr/share/doc" \ "$1/usr/share/zsh" \ "$1/usr/lib/rustlib/uninstall.sh"