2019-07-21 03:11:03 -06:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2021-09-02 03:17:51 -06:00
|
|
|
# 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=."
|
|
|
|
|
2019-10-15 02:16:27 -06:00
|
|
|
# This package mimics the download process of rust's 'x.py'
|
|
|
|
# bootstrap library to allow for the removal of the internet
|
2020-02-11 05:55:58 -07:00
|
|
|
# connection requirement per build.
|
2019-10-15 02:16:27 -06:00
|
|
|
{
|
2021-09-10 01:15:58 -06:00
|
|
|
mkdir -p "${cache_dir:=build/cache/2021-07-29}"
|
2019-10-15 02:16:27 -06:00
|
|
|
|
2020-01-31 02:30:15 -07:00
|
|
|
for tarball in *.tar.xz\?no-extract; do
|
2019-11-26 03:55:52 -07:00
|
|
|
mv -f "$tarball" "$cache_dir/${tarball%%\?no-extract}"
|
2019-10-15 02:16:27 -06:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-06-30 17:46:09 -06:00
|
|
|
# Set shared linking as the default.
|
2021-07-03 15:24:51 -06:00
|
|
|
for f in \
|
2021-06-30 17:46:09 -06:00
|
|
|
compiler/rustc_target/src/spec/linux_musl_base.rs \
|
|
|
|
vendor/rustc-ap-rustc_target/src/spec/linux_musl_base.rs
|
2021-07-03 15:24:51 -06:00
|
|
|
do
|
|
|
|
sed 's/\(crt_static_default = \)true/\1false/' "$f" > _
|
|
|
|
mv -f _ "$f"
|
|
|
|
done
|
2021-06-30 17:46:09 -06:00
|
|
|
|
|
|
|
# Ignore checksums of files modified above.
|
2021-07-07 15:02:10 -06:00
|
|
|
sed 's/\("files":{\)[^}]*/\1/' \
|
|
|
|
vendor/rustc-ap-rustc_target/.cargo-checksum.json > _
|
|
|
|
mv -f _ vendor/rustc-ap-rustc_target/.cargo-checksum.json
|
2019-07-21 03:11:03 -06:00
|
|
|
|
2019-08-24 14:34:01 -06:00
|
|
|
cat > config.toml <<EOF
|
|
|
|
[llvm]
|
|
|
|
link-shared = true
|
2021-09-03 00:55:25 -06:00
|
|
|
skip-rebuild = true
|
2019-08-24 14:34:01 -06:00
|
|
|
|
|
|
|
[build]
|
2020-10-09 02:55:38 -06:00
|
|
|
build = "x86_64-unknown-linux-musl"
|
|
|
|
host = [ "x86_64-unknown-linux-musl" ]
|
|
|
|
target = [ "x86_64-unknown-linux-musl" ]
|
2020-02-27 13:05:15 -07:00
|
|
|
|
|
|
|
docs = false
|
|
|
|
compiler-docs = false
|
|
|
|
extended = true
|
|
|
|
submodules = false
|
|
|
|
python = "python3"
|
|
|
|
locked-deps = true
|
|
|
|
vendor = true
|
2021-09-03 09:04:27 -06:00
|
|
|
tools = [ "cargo", "rustfmt" ]
|
2020-02-27 13:05:15 -07:00
|
|
|
sanitizers = false
|
|
|
|
profiler = false
|
|
|
|
full-bootstrap = false
|
2019-08-24 14:34:01 -06:00
|
|
|
|
|
|
|
[install]
|
|
|
|
prefix = "/usr"
|
|
|
|
|
2021-08-16 06:35:06 -06:00
|
|
|
[target.x86_64-unknown-linux-musl]
|
|
|
|
llvm-config = "/usr/bin/llvm-config"
|
|
|
|
crt-static = false
|
2021-09-02 03:17:51 -06:00
|
|
|
sanitizers = false
|
2021-08-16 06:35:06 -06:00
|
|
|
|
2021-09-03 00:55:25 -06:00
|
|
|
[dist]
|
|
|
|
src-tarball = false
|
|
|
|
|
2019-08-24 14:34:01 -06:00
|
|
|
[rust]
|
2021-09-02 03:17:51 -06:00
|
|
|
backtrace = false
|
2020-10-09 02:55:38 -06:00
|
|
|
channel = "stable"
|
2021-09-02 03:17:51 -06:00
|
|
|
codegen-tests = false
|
2021-09-03 09:04:27 -06:00
|
|
|
codegen-units-std = 1
|
2021-09-03 00:55:25 -06:00
|
|
|
codegen-units = 0
|
2020-10-09 02:55:38 -06:00
|
|
|
debug = false
|
|
|
|
debug-assertions = false
|
2021-09-02 03:17:51 -06:00
|
|
|
debuginfo-level = 0
|
|
|
|
incremental = false
|
|
|
|
jemalloc = false
|
|
|
|
rpath = false
|
2021-09-03 00:55:25 -06:00
|
|
|
dist-src = false
|
2019-08-24 14:34:01 -06:00
|
|
|
EOF
|
|
|
|
|
2021-08-16 06:35:06 -06:00
|
|
|
# Workaround to get Rust to build in llvm-only environments.
|
2021-09-02 03:17:51 -06:00
|
|
|
# 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.
|
2021-08-16 06:35:06 -06:00
|
|
|
case $("$CC" -print-file-name=libunwind.so) in */*)
|
|
|
|
printf 'llvm-libunwind = "system"\n' >> config.toml
|
|
|
|
|
2021-09-02 03:17:51 -06:00
|
|
|
mkdir -p libgcc
|
2021-08-16 06:35:06 -06:00
|
|
|
|
2021-09-02 03:17:51 -06:00
|
|
|
printf 'INPUT(-lunwind)\n' > \
|
|
|
|
libgcc/libgcc_s.so
|
2021-08-16 06:35:06 -06:00
|
|
|
|
2021-09-02 03:17:51 -06:00
|
|
|
ln -sf "$KISS_ROOT/usr/lib/libunwind.so.1" \
|
|
|
|
libgcc/libgcc_s.so.1
|
2021-08-16 06:35:06 -06:00
|
|
|
|
2021-09-02 03:17:51 -06:00
|
|
|
export \
|
|
|
|
LD_LIBRARY_PATH="$PWD/libgcc:$LD_LIBRARY_PATH" \
|
|
|
|
LIBRARY_PATH="$PWD/libgcc:$LIBRARY_PATH"
|
2021-08-16 06:35:06 -06:00
|
|
|
esac
|
|
|
|
|
2021-09-02 03:17:51 -06:00
|
|
|
./x.py build -j "$(grep -scF 'core id' /proc/cpuinfo)"
|
|
|
|
./x.py install
|
2020-05-05 15:56:59 -06:00
|
|
|
|
2021-07-06 07:03:16 -06:00
|
|
|
rm -rf \
|
|
|
|
"$1/usr/lib/rustlib/src/" \
|
|
|
|
"$1/usr/share/doc" \
|
|
|
|
"$1/usr/share/zsh" \
|
|
|
|
"$1/usr/lib/rustlib/uninstall.sh"
|
|
|
|
|