2022-11-08 15:10:53 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Download and extract GCC arm-none-eabi toolchain
|
|
|
|
|
2022-11-08 17:35:29 -08:00
|
|
|
set -e
|
|
|
|
|
2022-11-09 04:18:40 -08:00
|
|
|
# URL to download original toolchain from
|
2023-07-05 17:53:36 -07:00
|
|
|
URL="https://github.com/rusefi/build_support/raw/master/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz"
|
2023-01-24 19:33:58 -08:00
|
|
|
# This is the md5sum of the /bin/arm-none-eabi-ld executable within the archive, used for verifying we have the proper version.
|
|
|
|
# If you change the above URL, you will need to update this checksum as well.
|
2023-07-05 17:53:36 -07:00
|
|
|
MANIFEST_SUM="d7145e6152652d550651e1ceeb9eea86"
|
2022-11-09 04:18:40 -08:00
|
|
|
# colloquial directory name, to afford re-use of script
|
|
|
|
COLLOQUIAL="gcc-arm-none-eabi"
|
|
|
|
# temporary working directory
|
2023-07-05 17:53:36 -07:00
|
|
|
TMP_DIR="/tmp/rusefi-provide_gcc12"
|
2022-11-08 15:10:53 -08:00
|
|
|
|
2022-11-09 04:18:40 -08:00
|
|
|
archive="${URL##*/}"
|
|
|
|
|
2023-01-24 19:33:58 -08:00
|
|
|
SWD="$PWD"
|
|
|
|
|
|
|
|
# If the checksum file doesn't exist, or if its checksum doesn't match, then download and install the archive.
|
|
|
|
if [ ! -f "${TMP_DIR}"/*/bin/arm-none-eabi-ld ] ||\
|
|
|
|
[ "$MANIFEST_SUM" != "$(md5sum ${TMP_DIR}/*/bin/arm-none-eabi-ld | cut -d ' ' -f 1)" ]; then
|
|
|
|
rm -rf "${TMP_DIR}"
|
|
|
|
# Download and extract archive
|
|
|
|
echo Downloading and extracting ${archive}
|
|
|
|
mkdir -p "${TMP_DIR}"
|
|
|
|
cd "${TMP_DIR}"
|
|
|
|
curl -L -o "${archive}" "${URL}"
|
|
|
|
tar -xaf "${archive}"
|
2023-06-08 14:54:09 -07:00
|
|
|
echo "Cleaning ${archive}"
|
2023-01-24 19:33:58 -08:00
|
|
|
rm "${archive}"
|
|
|
|
else
|
|
|
|
echo "Toolkit already present"
|
|
|
|
fi
|
2022-11-08 15:10:53 -08:00
|
|
|
|
|
|
|
# Create colloquially named link
|
2023-01-24 19:33:58 -08:00
|
|
|
cd "$SWD"
|
2023-06-08 14:54:09 -07:00
|
|
|
echo "Linking ${TMP_DIR} ${COLLOQUIAL}"
|
2023-03-20 06:24:52 -07:00
|
|
|
ln -sf "${TMP_DIR}"/* "${COLLOQUIAL}"
|