diff options
Diffstat (limited to 'source/d/rust/rust.SlackBuild')
-rwxr-xr-x | source/d/rust/rust.SlackBuild | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/source/d/rust/rust.SlackBuild b/source/d/rust/rust.SlackBuild index 0000ae3a9..97de6e165 100755 --- a/source/d/rust/rust.SlackBuild +++ b/source/d/rust/rust.SlackBuild @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 2017 Andrew Clemons, Wellington, New Zealand -# Copyright 2017, 2018, 2019, 2020, 2021 Patrick J. Volkerding, Sebeka, Minnesota, USA +# Copyright 2017, 2018, 2019, 2020, 2021, 2022, 2023 Patrick J. Volkerding, Sebeka, Minnesota, USA # Copyright 2017 Stuart Winter # All rights reserved. # @@ -26,17 +26,17 @@ cd $(dirname $0) ; CWD=$(pwd) PKGNAM=rust SRCNAM="${PKGNAM}c" -VERSION=${VERSION:-1.55.0} +VERSION=${VERSION:-1.77.0} BUILD=${BUILD:-1} # Set this to YES to build with the system LLVM, or NO to use the bundled LLVM. # YES is probably better (when it works...) -SYSTEM_LLVM=${SYSTEM_LLVM:-YES} +SYSTEM_LLVM=${SYSTEM_LLVM:-NO} # Bootstrap variables (might not be kept updated for latest Rust): -RSTAGE0_VERSION=${RSTAGE0_VERSION:-1.54.0} -RSTAGE0_DIR=${RSTAGE0_DIR:-2021-07-29} -CSTAGE0_VERSION=${CSTAGE0_VERSION:-1.54.0} +RSTAGE0_VERSION=${RSTAGE0_VERSION:-1.76.0} +RSTAGE0_DIR=${RSTAGE0_DIR:-2024-02-08} +CSTAGE0_VERSION=${CSTAGE0_VERSION:-1.76.0} CSTAGE0_DIR=${CSTAGE0_DIR:-$RSTAGE0_DIR} # Automatically determine the architecture we're building on: @@ -111,7 +111,7 @@ else fi TMP=${TMP:-/tmp} -OUTPUT=${OUTPUT:-/tmp} +OUTPUT=${OUTPUT:-$TMP} PKG=$TMP/package-$PKGNAM # Not needed, as the build will automatically use as many jobs as there are @@ -134,7 +134,8 @@ rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $SRCNAM-$VERSION-src -tar xvf $CWD/$SRCNAM-$VERSION-src.tar.?z || exit 1 +echo "Extracting $CWD/$SRCNAM-$VERSION-src.tar.?z..." +tar xf $CWD/$SRCNAM-$VERSION-src.tar.?z || exit 1 cd $SRCNAM-$VERSION-src || exit 1 # Link with -lffi in case of using system LLVM: @@ -163,7 +164,7 @@ link-shared = true build = "$BARCH-unknown-linux-$BABI" host = ["$TARCH-unknown-linux-$BABI"] target = ["$TARCH-unknown-linux-$BABI"] -tools = ["analysis", "cargo", "clippy", "rls", "rustfmt", "src"] +tools = ["analysis", "cargo", "clippy", "rls", "rustfmt", "src", "rust-analyzer", "rust-demangler"] submodules = false vendor = true extended = true @@ -179,7 +180,6 @@ codegen-units = 0 channel = "stable" rpath = false codegen-tests = false -ignore-git = true EOF @@ -230,10 +230,29 @@ elif [ "$BARCH" = "i686" ] ; then fi fi +# Fix path to the rust libraries in rust-analyzer: +if [ -r src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs ]; then + if [ ! "$LIBDIRSUFFIX" = "" ]; then + sed -i "s,\"lib/rustlib,\"lib${LIBDIRSUFFIX}/rustlib,g" src/tools/rust-analyzer/crates/project-model/src/sysroot.rs + fi +fi + # Build and install: python3 ./x.py build || exit 1 DESTDIR=$PKG python3 x.py install || exit 1 +# In case the rls stub doesn't get installed by the 'install' target: +if [ ! -x $PKG/usr/bin/rls ]; then + install -m755 build/*-linux-gnu/stage1-tools-bin/rls $PKG/usr/bin/rls +fi + +# Fix path to lldb_commands: +if [ -x $PKG/usr/bin/rust-lldb ]; then + if [ ! "$LIBDIRSUFFIX" = "" ]; then + sed -i "s,/lib/rustlib/,/lib$LIBDIRSUFFIX/rustlib/,g" $PKG/usr/bin/rust-lldb + fi +fi + # Eh, none of this is all that big. Might as well leave it around as a # reference. #rm -f $PKG/usr/lib$LIBDIRSUFFIX/rustlib/components @@ -264,6 +283,10 @@ find $PKG/usr/lib$LIBDIRSUFFIX -name "*.so" -exec chmod 755 "{}" \+ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +# Get rid of possible .old files in these locations: +rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.old +rm -f $PKG/usr/bin/*.old + # Commented out (for now) since we disable rpaths in config.toml: ## Remove any compiled-in RPATHs: #find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ |