# Rust 1.29.2
# ===========
# Info about installing Rust via rustup:
#
# Assuming you trust that the devlopers are not evildoers and the process
# will not mess anything up on your system... The easiest, simplest way of
# installing it is by using rustup. It can also keep it updated for you.
# curl https://sh.rustup.rs -sSf | sh
#
# With rustup, programs go in ~/.cargo/bin
# It modifies ~/.profile to add that to PATH
#
# To uninstall a rustup-installed Rust: rustup self uninstall
#
# I installed it from source below to see how that goes, then removed
# that and used the rustup method instead (so I may not update this HOWTO
# again any time soon). The process could be hours to compile it vs
# 1 minute to download and auto-install it.
# Below we cover installing it manually from source, but even then, you're
# running a Python script that downloads a tarball, then you maybe clone
# something with Git... so, far from manual
# Get it
cd
test -f installed/rustc-1.29.2-src.tar.gz &&
mv -f installed/rustc-1.29.2-src.tar.gz .
test ! -f rustc-1.29.2-src.tar.gz &&
wget https://static.rust-lang.org/dist/rustc-1.29.2-src.tar.gz
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "5088e796aa2e47478cdf41e7243fc5443fafab0a7c70a11423e57c80c04167\
c9 rustc-1.29.2-src.tar.gz" | sha256sum -c
# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "rustc-*-src" -exec rm -r {} \;
tar xzvf ~/rustc-1.29.2-src.tar.gz
cd rustc-1.29.2-src
test $UID = 0 && chown -R root:root .
# Build it
./x.py build
# To change installation paths, use config.toml (copy config.toml.example)
# If you are 64-bit and use /usr/local/lib64, edit the libdir line
# /usr/local/man, not /usr/local/share/man (may be a symlink...)
# /usr/local/info, not /usr/local/share/info (")
# Verify changes with 'diff -u config.toml.example config.toml'
test $(uname -m) = 'x86_64' &&
cat config.toml.example | sed \
-e 's/^#libdir = .*/libdir = "lib64"/' \
-e 's/^#mandir = .*/mandir = "man"/' \
-e 's/^#infodir = .*/infodir = "info"/' > config.toml
cd /tmp
git clone https://github.com/dhuseby/cargo-bootstrap.git
git clone https://github.com/rust-lang/crates.io-index
mkdir out
cd ~/src
test -d ./cargo && ( cd cargo ; git pull )
test ! -d ./cargo &&
git clone --recursive https://github.com/rust-lang/cargo
cd cargo
cp /tmp/cargo-bootstrap/bootstrap.py .
mkdir build
./bootstrap.py --crate-index /tmp/crates.io-index --target-dir ./build \
--no-clone --no-clean --target x86_64-unknown-linux
./configure --local-cargo=./build/cargo-0_5_0
test -d /tmp/cargo-bootstrap && rm -r /tmp/cargo-bootstrap
test -d /tmp/crates.io-index && rm -r /tmp/crates.io-index
# If you ever want to uninstall Rust, this should do it:
su
test -x /usr/local/lib64/rustlib/uninstall.sh &&
/usr/local/lib64/rustlib/uninstall.sh
for libdir in /usr/local/lib /usr/local/lib64;
do
test -d $libdir && rm -r ${libdir}/rustlib
done
( cd /usr/local/bin ; rm -f rust-gdb rust-lldb rustc rustdoc )
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "rustc-*-src" -exec rm -r {} \;
rm -f ~/installed/rustc-*-src.tar.*