2019-04-25 11:30:08 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Install prerequisites
|
2019-08-18 07:38:29 +01:00
|
|
|
dpkg -s qt5-default
|
|
|
|
QT5_NOT_INSTALLED=$?
|
|
|
|
dpkg -s libusb-1.0-0-dev
|
|
|
|
LIBUSB_NOT_INSTALLED=$?
|
2019-04-25 11:30:08 +01:00
|
|
|
|
2019-09-08 06:43:28 +01:00
|
|
|
# We don't want to bail if one of the first 4 lines returns error. That's what they're meant to do!
|
|
|
|
set -e
|
|
|
|
|
2019-08-18 07:38:29 +01:00
|
|
|
if [ $QT5_NOT_INSTALLED != 0 ] || [ $LIBUSB_NOT_INSTALLED != 0 ]; then
|
2019-08-18 07:22:11 +01:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install qt5-default
|
|
|
|
sudo apt-get install libusb-1.0-0-dev
|
|
|
|
else
|
2019-08-18 07:30:03 +01:00
|
|
|
echo "Prerequesites are already installed. Skipping step."
|
2019-08-18 07:22:11 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Move to /tmp so we don't leave junk in the user's folders
|
2019-04-25 11:30:08 +01:00
|
|
|
cd /tmp
|
|
|
|
|
2019-08-18 07:22:11 +01:00
|
|
|
# Install gcc-8.10, which is modern C++ friendly
|
|
|
|
# see https://solarianprogrammer.com/2017/12/08/raspberry-pi-raspbian-install-gcc-compile-cpp-17-programs/
|
|
|
|
if [ -d "/usr/local/gcc-8.1.0-labrador" ]; then
|
|
|
|
echo "gcc-8.1.0-labrador is already installed. Skipping step."
|
|
|
|
else
|
|
|
|
rm -rf raspberry-pi-gcc-binary
|
|
|
|
git clone --depth 1 https://github.com/EspoTek/raspberry-pi-gcc-binary
|
|
|
|
cd ./raspberry-pi-gcc-binary
|
|
|
|
tar xf gcc-8.1.0.tar.bz2
|
|
|
|
sudo mv gcc-8.1.0 /usr/local/gcc-8.1.0-labrador
|
|
|
|
fi
|
|
|
|
|
2019-04-25 11:30:08 +01:00
|
|
|
# Clone the latest version of Labrador
|
|
|
|
rm -rf labrador
|
|
|
|
git clone --depth 1 https://github.com/espotek/labrador
|
|
|
|
|
2019-08-18 07:22:11 +01:00
|
|
|
# Set PATH so that make can find gcc-8.10
|
|
|
|
export PATH=/usr/local/gcc-8.1.0-labrador/bin:$PATH
|
|
|
|
|
2019-04-25 11:30:08 +01:00
|
|
|
# Build labrador
|
|
|
|
cd labrador/Desktop_Interface
|
|
|
|
qmake
|
2019-08-18 07:22:11 +01:00
|
|
|
make CXX=g++-8.1.0 CC=gcc-8.1.0
|
2019-04-25 11:30:08 +01:00
|
|
|
sudo make install
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
rm -rf raspberry-pi-gcc-binary
|
2019-08-18 07:49:43 +01:00
|
|
|
rm -rf labrador
|
|
|
|
|
|
|
|
echo "Labrador installation success!"
|
2019-09-08 06:43:28 +01:00
|
|
|
echo "To run the software, enter \"labrador\" into the terminal or open the app from the \"Education\" menu."
|