-
Notifications
You must be signed in to change notification settings - Fork 119
/
labrador_bootstrap_pi
executable file
·68 lines (57 loc) · 2.09 KB
/
labrador_bootstrap_pi
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Install prerequisites
dpkg -s qtbase5-dev
QTBASE_NOT_INSTALLED=$?
dpkg -s qtchooser
QTCHOOSER_NOT_INSTALLED=$?
dpkg -s qt5-qmake
QMAKE_NOT_INSTALLED=$?
dpkg -s qtbase5-dev-tools
QTDEV_NOT_INSTALLED=$?
dpkg -s libusb-1.0-0-dev
LIBUSB_NOT_INSTALLED=$?
dpkg -s libfftw3-dev
FFTW_NOT_INSTALLED=$?
# 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
if [ $QTBASE_NOT_INSTALLED != 0 ] || [ $QTCHOOSER_NOT_INSTALLED != 0 ] || [ $QMAKE_NOT_INSTALLED != 0 ] || [ $QTDEV_NOT_INSTALLED != 0 ] || [ $LIBUSB_NOT_INSTALLED != 0 ] || [ $FFTW_NOT_INSTALLED != 0 ]; then
sudo apt-get update
sudo apt-get install -y qtbase5-dev
sudo apt-get install -y qtchooser
sudo apt-get install -y qt5-qmake
sudo apt-get install -y qtbase5-dev-tools
sudo apt-get install -y libusb-1.0-0-dev
sudo apt-get install -y libfftw3-dev
else
echo "Prerequesites are already installed. Skipping step."
fi
# Move to /tmp so we don't leave junk in the user's folders
cd /tmp
# 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
# Clone the latest version of Labrador
rm -rf labrador
git clone --depth 1 https://github.com/espotek/labrador
# Set PATH so that make can find gcc-8.10
export PATH=/usr/local/gcc-8.1.0-labrador/bin:$PATH
# Set QT_SELECT so qtchooser picks the right version
export QT_SELECT=qt5
# Build labrador
cd labrador/Desktop_Interface
qmake
make CXX=g++-8.1.0 CC=gcc-8.1.0
sudo make install
# Cleanup
rm -rf raspberry-pi-gcc-binary
rm -rf labrador
echo "Labrador installation success!"
echo "To run the software, enter \"labrador\" into the terminal or open the app from the \"Education\" menu."