Skip to content

Commit

Permalink
development/rust: Updated for version 1.26.2.
Browse files Browse the repository at this point in the history
This took longer than expected to get sorted out on my side. Building
1.26.2 from 1.25.0 on x86_64 was failing. I finally managed to track
down a workaround and have added a patch for that.

rust-lang/rust#51698

Signed-off-by: Andrew Clemons <[email protected]>
  • Loading branch information
aclemons committed Jun 22, 2018
1 parent 873bf2c commit f0d1520
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 45 deletions.
5 changes: 3 additions & 2 deletions development/rust/README.SLACKWARE
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Here is a rough guide to bootstrap rust completely from source:

* Build and install mrustc (from slackbuilds.org). You now have a fully
functional rust 1.19.0.
* Now build for rust 1.20.0, 1.21.0, 1.22.1, 1.23.0, 1.24.1, and finally
1.25.0.
* Now build for rust 1.20.0, 1.21.0, 1.22.1, 1.23.0, 1.24.1, 1.25.0, and finally
1.26.2.

This slackbuild is currently compatible with each of those versions.
Since we are building completely from source, you only need the source
Expand All @@ -32,6 +32,7 @@ Example:
VERSION=1.23.0 FULL_BOOTSTRAP=no LOCAL_BOOTSTRAP=yes ./rust.SlackBuild
VERSION=1.24.1 FULL_BOOTSTRAP=no LOCAL_BOOTSTRAP=yes ./rust.SlackBuild
VERSION=1.25.0 FULL_BOOTSTRAP=no LOCAL_BOOTSTRAP=yes ./rust.SlackBuild
VERSION=1.26.2 FULL_BOOTSTRAP=no LOCAL_BOOTSTRAP=yes ./rust.SlackBuild

You might prefer to do a full bootstrap for 1.20.0, which is what mrustc's own
bootstrap script suggests. The versions after that do not need a full bootstrap.
Expand Down
54 changes: 34 additions & 20 deletions development/rust/rust.SlackBuild
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,22 @@

PRGNAM=rust
SRCNAM="${PRGNAM}c"
VERSION=${VERSION:-1.25.0}

# src/stage0.txt
RSTAGE0_VERSION=${RSTAGE0_VERSION:-1.24.0}
RSTAGE0_DIR=${RSTAGE0_DIR:-2018-02-15}
CSTAGE0_VERSION=${CSTAGE0_VERSION:-0.25.0}
CSTAGE0_DIR=${CSTAGE0_DIR:-$RSTAGE0_DIR}

VERSION=${VERSION:-1.26.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

# Set this to YES to build with the system LLVM, or NO to use the bundled LLVM.
# YES is probably better (when it works...)
# LLVM in Slackware14.2 is now too old to build rust 1.26.0
SYSTEM_LLVM=${SYSTEM_LLVM:-NO}
SYSTEM_LLVM=$(echo "$SYSTEM_LLVM" | tr '[:lower:]' '[:upper:]')

# Bootstrap variables (might not be kept updated for latest Rust):
RSTAGE0_VERSION=${RSTAGE0_VERSION:-1.25.0}
RSTAGE0_DIR=${RSTAGE0_DIR:-2018-03-29}
CSTAGE0_VERSION=${CSTAGE0_VERSION:-0.26.0}
CSTAGE0_DIR=${CSTAGE0_DIR:-$RSTAGE0_DIR}

if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
Expand Down Expand Up @@ -134,6 +139,11 @@ rm -rf $SRCNAM-$VERSION-src
tar xvf $CWD/$SRCNAM-$VERSION-src.tar.xz
cd $SRCNAM-$VERSION-src

# Link with -lffi in case of using system LLVM:
if [ "${SYSTEM_LLVM}" = "YES" ]; then
zcat $CWD/link_libffi.diff.gz | patch -p1 --verbose || exit 1
fi

if [ "$LOCAL_BOOTSTRAP" != "yes" ] ; then
# rust requires bootstrapping with the previous rust version.
# versions are defined in src/stage0.txt.
Expand All @@ -149,14 +159,9 @@ fi
# Build configuration. We'll go ahead and build with rpath because it may be
# needed during the build, and then we'll strip the rpaths out of the
# binaries later.

# LLVM in Slackware14.2 is now too old to build rust 1.24.1, so the rust build
# falls back to building its own. You can force using the system LLVM with this
# flag.
SYSTEM_LLVM=${SYSTEM_LLVM:-no}

cat << EOF > config.toml
[llvm]
ccache = "/usr/bin/ccache"
targets = "X86"
[build]
Expand All @@ -176,20 +181,20 @@ mandir = "man"
[rust]
codegen-units = 0
thinlto = false
channel = "stable"
rpath = true
codegen-tests = false
ignore-git = true
EOF

if [ "$ARCH" = "arm" ] ; then
sed -i 's/"X86"/"X86;ARM"//' config.toml
fi

if [ "$SYSTEM_LLVM" = "yes" ] ; then
if [ "${SYSTEM_LLVM}" = "YES" ]; then
cat << EOF >> config.toml
# Add this stuff to build with the system LLVM:
[target.i586-unknown-linux-gnu]
llvm-config = "/usr/bin/llvm-config"
Expand Down Expand Up @@ -218,9 +223,6 @@ EOF
chmod 0755 local-llvm-config
sed -i "s|/usr/bin/llvm-config|$(pwd)/local-llvm-config|" config.toml
fi

# Link with -lffi in case of using system LLVM:
zcat $CWD/link_libffi.diff.gz | patch -p1 --verbose
fi

FULL_BOOTSTRAP="${FULL_BOOTSTRAP:-no}"
Expand All @@ -233,6 +235,10 @@ if [ "$LOCAL_BOOTSTRAP" = "yes" ] ; then
sed -i "s|^\(extended = true\)$|\1\nrustc = \"/usr/bin/rustc\"\ncargo = \"/usr/bin/cargo\"|" config.toml
fi

if [ "$ARCH" = "x86_64" ] && [ "$LOCAL_BOOTSTRAP" = "yes" ] ; then
zcat $CWD/slackware64_local_bootstrap.diff.gz | patch -p1 --verbose || exit 1
fi

chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
Expand Down Expand Up @@ -284,6 +290,14 @@ gzip -9 $PKG/usr/lib$LIBDIRSUFFIX/rustlib/manifest-*
# Correct permissions on shared libraries:
find $PKG/usr/lib$LIBDIRSUFFIX -name "*.so" -exec chmod 755 "{}" \;

# Evidently there are a lot of duplicated libraries in this tree, so let's
# try to save some space:
(
find "$PKG/usr/lib${LIBDIRSUFFIX}/rustlib" -type d -path '*/*-linux-gnu/*' -name 'lib' | while read -r dir ; do
cd "$dir" && for file in *.so ; do if cmp -s "$file" ../../../"$file" ; then ln -sf ../../../"$file" ; fi ; done
done
)

# Strip ELF objects:
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
Expand Down
46 changes: 23 additions & 23 deletions development/rust/rust.info
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
PRGNAM="rust"
VERSION="1.25.0"
VERSION="1.26.2"
HOMEPAGE="https://www.rust-lang.org"
DOWNLOAD="https://static.rust-lang.org/dist/rustc-1.25.0-src.tar.xz \
https://static.rust-lang.org/dist/2018-02-15/cargo-0.25.0-i686-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-02-15/rust-std-1.24.0-i686-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-02-15/rustc-1.24.0-i686-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-02-15/cargo-0.25.0-arm-unknown-linux-gnueabi.tar.gz \
https://static.rust-lang.org/dist/2018-02-15/rust-std-1.24.0-arm-unknown-linux-gnueabi.tar.gz \
https://static.rust-lang.org/dist/2018-02-15/rustc-1.24.0-arm-unknown-linux-gnueabi.tar.gz"
MD5SUM="57295a3c3bedfc21e3c643b397a1f017 \
b5aff8de6cf43993d6486d7ccc42bf8e \
d7e33d9b7226bda2ef68302af86ad503 \
c0a641b8dd8e96787169b35c9c1c2903 \
86701e7bf219b7ea7647ea35ec5104c7 \
4c0633ed46b931820ca09d9ce3e6ec2b \
f32f60683990bd3978aa284d69a4f7b9"
DOWNLOAD_x86_64="https://static.rust-lang.org/dist/rustc-1.25.0-src.tar.xz \
https://static.rust-lang.org/dist/2018-02-15/cargo-0.25.0-x86_64-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-02-15/rust-std-1.24.0-x86_64-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-02-15/rustc-1.24.0-x86_64-unknown-linux-gnu.tar.gz"
MD5SUM_x86_64="57295a3c3bedfc21e3c643b397a1f017 \
3563bdec9bc620fcd0bd046424eb78af \
2dd480376768d227cd2925ff3c87d685 \
2e35e45653015fd85f65e9fc1e2f8270"
DOWNLOAD="https://static.rust-lang.org/dist/rustc-1.26.2-src.tar.xz \
https://static.rust-lang.org/dist/2018-03-29/cargo-0.26.0-i686-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-03-29/rust-std-1.25.0-i686-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-03-29/rustc-1.25.0-i686-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-03-29/cargo-0.26.0-arm-unknown-linux-gnueabi.tar.gz \
https://static.rust-lang.org/dist/2018-03-29/rust-std-1.25.0-arm-unknown-linux-gnueabi.tar.gz \
https://static.rust-lang.org/dist/2018-03-29/rustc-1.25.0-arm-unknown-linux-gnueabi.tar.gz"
MD5SUM="5185c661cab0d34121e78a2a5c28af5f \
d49b79a5425ea14c0f54d8d4abe48cc7 \
5f248be4a20a53419d0bf5c5120ebe04 \
d6c7c406e1a783b174aaf1414e9f0900 \
4fe96e55897f156fdbc80c96a0913516 \
3e1a27b11f17428290a6133a1b0211c8 \
5f277935c04a431fb64bbac160d53118"
DOWNLOAD_x86_64="https://static.rust-lang.org/dist/rustc-1.26.2-src.tar.xz \
https://static.rust-lang.org/dist/2018-03-29/cargo-0.26.0-x86_64-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-03-29/rust-std-1.25.0-x86_64-unknown-linux-gnu.tar.gz \
https://static.rust-lang.org/dist/2018-03-29/rustc-1.25.0-x86_64-unknown-linux-gnu.tar.gz"
MD5SUM_x86_64="5185c661cab0d34121e78a2a5c28af5f \
b0de62d86f0ba71078471d09916873c6 \
37e9f9193413caba47134af3306328c5 \
6e9c8ae2946cf6626ad6511c7a1d6c2a"
REQUIRES="patchelf"
MAINTAINER="Andrew Clemons"
EMAIL="[email protected]"
Binary file added development/rust/slackware64_local_bootstrap.diff.gz
Binary file not shown.

0 comments on commit f0d1520

Please sign in to comment.