CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/scripts/configure-ci.sh
Views: 1798
1
#!/usr/bin/env bash
2
# Install dependencies and configure the environment for CI build testing
3
4
set -ex
5
6
# Disable ccache for the configure phase, it's not worth it
7
export CCACHE_DISABLE="true"
8
9
ARM_ROOT="gcc-arm-none-eabi-10-2020-q4-major"
10
ARM_TARBALL="$ARM_ROOT-x86_64-linux.tar.bz2"
11
12
RPI_ROOT="master"
13
RPI_TARBALL="$RPI_ROOT.tar.gz"
14
15
MUSL_ROOT="arm-linux-musleabihf-cross"
16
MUSL_TBZ="$MUSL_ROOT.tgz"
17
18
CCACHE_ROOT="ccache-3.4.2"
19
CCACHE_TARBALL="$CCACHE_ROOT.tar.bz2"
20
21
mkdir -p $HOME/opt
22
pushd $HOME
23
24
# STM32 toolchain
25
dir=$ARM_ROOT
26
if [ ! -d "$HOME/opt/$dir" -o ! -x "$HOME/opt/$dir/bin/arm-none-eabi-g++" ]; then
27
wget https://firmware.ardupilot.org/Tools/STM32-tools/$ARM_TARBALL
28
tar -xf $ARM_TARBALL -C opt
29
fi
30
31
# RPi/BBB toolchain
32
dir="tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64"
33
if [ ! -d "$HOME/opt/$dir" -o ! -x "$HOME/opt/$dir/bin/arm-linux-gnueabihf-g++" ]; then
34
wget https://firmware.ardupilot.org/Tools/Travis/NavIO/$RPI_TARBALL
35
tar -xf $RPI_TARBALL -C opt $dir
36
fi
37
38
# musl toolchain
39
dir=$MUSL_ROOT
40
if [ ! -d "$HOME/opt/$dir" -o ! -x "$HOME/opt/$dir/bin/arm-linux-musleabihf-g++" ]; then
41
wget https://musl.cc/$MUSL_TBZ
42
tar -xf $MUSL_TBZ -C opt
43
fi
44
45
# ccache
46
dir=$CCACHE_ROOT
47
if [ ! -d "$HOME/opt/$dir" ]; then
48
# if version 3.4 isn't there, try to remove older v3.3 folders from CI cache
49
rm -rf "$HOME/opt"/ccache-3.3*
50
51
wget https://www.samba.org/ftp/ccache/$CCACHE_TARBALL
52
tar -xf $CCACHE_TARBALL
53
pushd $CCACHE_ROOT
54
./configure --prefix="/tmp" --bindir="$HOME/opt/$dir"
55
make
56
make install
57
popd
58
fi
59
60
popd
61
62
mkdir -p $HOME/bin
63
64
# symlink to compiler versions
65
ln -s /usr/bin/clang-7 ~/bin/clang
66
ln -s /usr/bin/clang++-7 ~/bin/clang++
67
ln -s /usr/bin/llvm-ar-7 ~/bin/llvm-ar
68
69
mkdir -p $HOME/ccache
70
71
# configure ccache
72
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/g++
73
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/gcc
74
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-none-eabi-g++
75
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-none-eabi-gcc
76
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-linux-gnueabihf-g++
77
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-linux-gnueabihf-gcc
78
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-linux-musleabihf-gcc
79
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-linux-musleabihf-g++
80
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/clang++
81
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/clang
82
83
exportline="export PATH=$HOME/ccache"
84
exportline="${exportline}:$HOME/bin"
85
exportline="${exportline}:$HOME/.local/bin"
86
exportline="${exportline}:$HOME/opt/gcc-arm-none-eabi-10-2020-q4-major/bin"
87
exportline="${exportline}:$HOME/opt/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin"
88
exportline="${exportline}:$HOME/opt/arm-linux-musleabihf-cross/bin"
89
exportline="${exportline}:$HOME/opt/$CCACHE_ROOT"
90
exportline="${exportline}:\$PATH"
91
92
if grep -Fxq "$exportline" ~/.profile; then
93
echo "nothing to do";
94
else
95
echo $exportline >> ~/.profile;
96
fi
97
98
. ~/.profile
99
100
python -m pip install --progress-bar off --user -U argparse pyserial pexpect future lxml
101
python -m pip install --progress-bar off --user -U intelhex
102
python -m pip install --progress-bar off --user -U numpy
103
python -m pip install --progress-bar off --user -U edn_format
104
python -m pip install --progress-bar off --user -U empy==3.3.4
105
106