#!/bin/bash

# The Rust ecosystem isn't of the maturity yet, to permit me to sanely
# build from source every time.  The easiest way to get back on track is to
# use their binaries.
# For example, using rust 1.37, I cannot build rust 1.39 because the Cargo.lock
# file isn't recognised.  I suppose it was changed in rust-1.38, so I'd be expected
# to either hack it to bits, or upgrade to rust-1.38 then 1.39.
# This is a rather immature bootstrapping process, IMO.
#
# I find it easier to follow the method advertised on the web, rather than do it
# from the SlackBuild by updating the binary archives manually.
removepkg rust

[ -d /lib64 ] && {
cd /lib
ln -vfs ../lib64/ld-linux-aarch64.so.1 .
ldconfig ;}

# From http://www.rust-lang.org:
curl https://sh.rustup.rs -sSf | sh

# Bung it on to the file system so that the rust build can find it.
# This is because the boot strap version (v18) that the build downloads is older
# than the one we're building (v19), and it doesn't work.
cp -fav /root/.cargo/bin/* /usr/local/bin/
#source ~/.cargo/env
cd /usr/bin
ln -vfs /usr/local/bin/{rustc,cargo} .
