-
Notifications
You must be signed in to change notification settings - Fork 6
/
toolchain-aarch64-linux-gnu.sh
49 lines (34 loc) · 1.5 KB
/
toolchain-aarch64-linux-gnu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash -eux
# SPDX-License-Identifier: MIT
# Copyright (c) 2019, DornerWorks, Ltd.
# Author: Stewart Hildebrand
# Usage:
# $ source toolchain-aarch64-linux-gnu.sh
# or
# $ . toolchain-aarch64-linux-gnu.sh
# This script must reside in a writeable directory
# https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
ARM64_TOOLCHAIN_WRKDIR=$(pwd)/
ARM64_TOOLCHAIN_SCRIPTDIR=$(cd $(dirname ${BASH_SOURCE}) && pwd)/
if ! which ccache > /dev/null; then
sudo apt install ccache
fi
if [ ! -h /usr/lib/ccache/aarch64-linux-gnu-gcc ]; then
sudo ln -s ../../bin/ccache /usr/lib/ccache/aarch64-linux-gnu-gcc
fi
if [ ! -h /usr/lib/ccache/aarch64-linux-gnu-g++ ]; then
sudo ln -s ../../bin/ccache /usr/lib/ccache/aarch64-linux-gnu-g++
fi
if [ -z "${ARM64_TOOLCHAIN_VERSION-}" ]; then
ARM64_TOOLCHAIN_VERSION=8.3-2019.03
ARM64_TOOLCHAIN_FILENAME=gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu
if [ ! -d ${ARM64_TOOLCHAIN_SCRIPTDIR}${ARM64_TOOLCHAIN_FILENAME} ]; then
cd ${ARM64_TOOLCHAIN_SCRIPTDIR}
if [ ! -s ${ARM64_TOOLCHAIN_FILENAME}.tar.xz ]; then
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/${ARM64_TOOLCHAIN_VERSION}/binrel/${ARM64_TOOLCHAIN_FILENAME}.tar.xz
fi
tar -xf ${ARM64_TOOLCHAIN_FILENAME}.tar.xz
cd ${ARM64_TOOLCHAIN_WRKDIR}
fi
PATH=/usr/lib/ccache:${ARM64_TOOLCHAIN_SCRIPTDIR}${ARM64_TOOLCHAIN_FILENAME}/bin:$(echo ${PATH} | sed 's|/usr/lib/ccache:||g')
fi