diff --git a/extra/rust/build b/extra/rust/build index 75b8f482..eb789ef4 100755 --- a/extra/rust/build +++ b/extra/rust/build @@ -1,5 +1,9 @@ #!/bin/sh -e +# 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. @@ -41,7 +45,7 @@ submodules = false python = "python3" locked-deps = true vendor = true -tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src", "rust-demangler"] +tools = [ "cargo" ] sanitizers = false profiler = false full-bootstrap = false @@ -52,42 +56,42 @@ prefix = "/usr" [target.x86_64-unknown-linux-musl] llvm-config = "/usr/bin/llvm-config" crt-static = false +sanitizers = false [rust] -channel = "stable" -rpath = false -debuginfo-level = 0 -debug = false backtrace = false -jemalloc = false -debug-assertions = false +channel = "stable" codegen-tests = false -codegen-units-std = 1 +codegen-units-std = 0 +debug = false +debug-assertions = false +debuginfo-level = 0 +incremental = false +jemalloc = false +rpath = false EOF # Workaround to get Rust to build in llvm-only environments. +# 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. case $("$CC" -print-file-name=libunwind.so) in */*) printf 'llvm-libunwind = "system"\n' >> 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 + mkdir -p libgcc - printf 'INPUT(-lunwind)\n' > \ - libgcc/libgcc_s.so + printf 'INPUT(-lunwind)\n' > \ + libgcc/libgcc_s.so - ln -sf "$KISS_ROOT/usr/lib/libunwind.so.1" \ - libgcc/libgcc_s.so.1 + 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" - } + 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 +./x.py build -j "$(grep -scF 'core id' /proc/cpuinfo)" +./x.py install rm -rf \ "$1/usr/lib/rustlib/src/" \ diff --git a/extra/rust/depends b/extra/rust/depends index e482f17e..f70e18ce 100644 --- a/extra/rust/depends +++ b/extra/rust/depends @@ -1,7 +1,7 @@ cmake make curl make -openssl llvm +openssl pkgconf make python make xz