Files
2023-06-28 09:22:05 +08:00

86 lines
2.5 KiB
Plaintext
Executable File

_date=2023-04-20
_rust=1.69.0
_cargo=$_rust
_triplet=x86_64-unknown-linux-gnu
# Patch bootstrap and cargo so credential helpers
# are in /usr/lib instead of /usr/libexec
patch -d src/tools/cargo -Np1 < $PATCH/0001-cargo-Change-libexec-dir.patch
patch -Np1 -i $PATCH/0001-bootstrap-Change-libexec-dir.patch
mkdir -p build/cache/$_date
cp $SRC/rust-std-$_rust-$_triplet.tar.xz build/cache/$_date/
cp $SRC/rustc-$_rust-$_triplet.tar.xz build/cache/$_date/
cp $SRC/cargo-$_cargo-$_triplet.tar.xz build/cache/$_date/
cat << EOF > config.toml
# see config.toml.example for more possible options
# See the 8.4 book for an old example using shipped LLVM
# e.g. if not installing clang, or using a version before 13.0
# tell x.py to not keep printing an annoying warning
changelog-seen = 2
[llvm]
# by default, rust will build for a myriad of architectures
targets = "X86"
# When using system llvm prefer shared libraries
link-shared = true
[build]
# omit docs to save time and space (default is to build them)
docs = false
# install extended tools: cargo, clippy, etc
extended = true
# Do not query new versions of dependencies online.
locked-deps = true
# Specify which extended tools (those from the default install).
tools = ["cargo", "clippy", "rustfmt"]
# Use the source code shipped in the tarball for the dependencies.
# The combination of this and the "locked-deps" entry avoids downloading
# many crates from Internet, and makes the Rustc build more stable.
vendor = true
[install]
prefix = "/usr"
[rust]
channel = "stable"
description = "for LFS"
# BLFS used to not install the FileCheck executable from llvm,
# so disabled codegen tests. The assembly tests rely on FileCheck
# and cannot easily be disabled, so those will anyway fail if
# FileCheck has not been installed.
#codegen-tests = false
[target.x86_64-unknown-linux-gnu]
# NB the output of llvm-config (i.e. help options) may be
# dumped to the screen when config.toml is parsed.
llvm-config = "/usr/bin/llvm-config"
[target.i686-unknown-linux-gnu]
# NB the output of llvm-config (i.e. help options) may be
# dumped to the screen when config.toml is parsed.
llvm-config = "/usr/bin/llvm-config"
EOF
mkdir "$SRC/rust"
export CARGO_HOME="$SRC/rust"
export RUST_BACKTRACE=1
[ ! -e /usr/include/libssh2.h ] || export LIBSSH2_SYS_USE_PKG_CONFIG=1
python3 ./x.py build
DESTDIR=$PKG python3 ./x.py install
rm -rf $PKG/usr/lib/rustlib/components
rm -rf $PKG/usr/lib/rustlib/manifest-rustc
rm -rf $PKG/usr/lib/rustlib/rust-installer-version
rm -rf $PKG/etc