ardupilot/Tools/scripts/configure-ci.sh

105 lines
3.0 KiB
Bash
Raw Normal View History

#!/bin/bash
# Install dependencies and configure the environment for CI build testing
2016-01-20 01:14:45 -04:00
set -ex
# Disable ccache for the configure phase, it's not worth it
export CCACHE_DISABLE="true"
ARM_ROOT="gcc-arm-none-eabi-10-2020-q4-major"
ARM_TARBALL="$ARM_ROOT-x86_64-linux.tar.bz2"
RPI_ROOT="master"
RPI_TARBALL="$RPI_ROOT.tar.gz"
MUSL_ROOT="arm-linux-musleabihf-cross"
MUSL_TBZ="$MUSL_ROOT.tgz"
CCACHE_ROOT="ccache-3.4.2"
2016-04-16 04:26:23 -03:00
CCACHE_TARBALL="$CCACHE_ROOT.tar.bz2"
mkdir -p $HOME/opt
2016-04-16 04:26:23 -03:00
pushd $HOME
# STM32 toolchain
2016-04-16 04:26:23 -03:00
dir=$ARM_ROOT
if [ ! -d "$HOME/opt/$dir" -o ! -x "$HOME/opt/$dir/bin/arm-none-eabi-g++" ]; then
wget https://firmware.ardupilot.org/Tools/STM32-tools/$ARM_TARBALL
2016-04-16 04:26:23 -03:00
tar -xf $ARM_TARBALL -C opt
fi
# RPi/BBB toolchain
2016-04-16 04:26:23 -03:00
dir="tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64"
if [ ! -d "$HOME/opt/$dir" -o ! -x "$HOME/opt/$dir/bin/arm-linux-gnueabihf-g++" ]; then
wget https://firmware.ardupilot.org/Tools/Travis/NavIO/$RPI_TARBALL
2016-04-16 04:26:23 -03:00
tar -xf $RPI_TARBALL -C opt $dir
fi
# musl toolchain
dir=$MUSL_ROOT
if [ ! -d "$HOME/opt/$dir" -o ! -x "$HOME/opt/$dir/bin/arm-linux-musleabihf-g++" ]; then
wget https://musl.cc/$MUSL_TBZ
tar -xf $MUSL_TBZ -C opt
fi
# ccache
2016-04-16 04:26:23 -03:00
dir=$CCACHE_ROOT
if [ ! -d "$HOME/opt/$dir" ]; then
# if version 3.4 isn't there, try to remove older v3.3 folders from CI cache
rm -rf "$HOME/opt"/ccache-3.3*
2016-04-16 04:26:23 -03:00
wget https://www.samba.org/ftp/ccache/$CCACHE_TARBALL
tar -xf $CCACHE_TARBALL
pushd $CCACHE_ROOT
./configure --prefix="/tmp" --bindir="$HOME/opt/$dir"
make
make install
popd
fi
popd
mkdir -p $HOME/bin
# symlink to compiler versions
ln -s /usr/bin/clang-7 ~/bin/clang
ln -s /usr/bin/clang++-7 ~/bin/clang++
ln -s /usr/bin/llvm-ar-7 ~/bin/llvm-ar
mkdir -p $HOME/ccache
# configure ccache
2016-04-16 04:26:23 -03:00
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/g++
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/gcc
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-none-eabi-g++
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-none-eabi-gcc
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-linux-gnueabihf-g++
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-linux-gnueabihf-gcc
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-linux-musleabihf-gcc
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/arm-linux-musleabihf-g++
2016-04-16 05:58:37 -03:00
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/clang++
ln -s ~/opt/$CCACHE_ROOT/ccache ~/ccache/clang
exportline="export PATH=$HOME/ccache"
exportline="${exportline}:$HOME/bin"
exportline="${exportline}:$HOME/.local/bin"
exportline="${exportline}:$HOME/opt/gcc-arm-none-eabi-10-2020-q4-major/bin"
2016-03-08 20:55:21 -04:00
exportline="${exportline}:$HOME/opt/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin"
exportline="${exportline}:$HOME/opt/arm-linux-musleabihf-cross/bin"
exportline="${exportline}:$HOME/opt/$CCACHE_ROOT"
exportline="${exportline}:\$PATH"
if grep -Fxq "$exportline" ~/.profile; then
echo "nothing to do";
else
echo $exportline >> ~/.profile;
fi
. ~/.profile
python -m pip install --user -U argparse pyserial pexpect future lxml
python -m pip install --user -U intelhex
python -m pip install --user -U numpy
python -m pip install --user -U edn_format