2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-12-22 23:30:05 -07:00
repo/extra/rust/build
2021-07-08 00:02:10 +03:00

79 lines
1.8 KiB
Bash
Executable File

#!/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-05-06}"
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 <<EOF
[llvm]
link-shared = true
[build]
build = "x86_64-unknown-linux-musl"
host = [ "x86_64-unknown-linux-musl" ]
target = [ "x86_64-unknown-linux-musl" ]
docs = false
compiler-docs = false
extended = true
submodules = false
python = "python3"
locked-deps = true
vendor = true
tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src", "rust-demangler"]
sanitizers = false
profiler = false
full-bootstrap = false
[install]
prefix = "/usr"
[rust]
channel = "stable"
rpath = false
debuginfo-level = 0
debug = false
backtrace = false
jemalloc = false
debug-assertions = false
codegen-tests = false
codegen-units-std = 1
[target.x86_64-unknown-linux-musl]
llvm-config = "/usr/bin/llvm-config"
crt-static = false
EOF
export DESTDIR="$1"
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"