Skip to content

Commit 6f0a7a0

Browse files
committed
Install overhaul
* Address current build issues via patches * Advise on memory limit on RPi3 * Move all RPi helpers into their own file * Dependency folder cleanup, formatting and labels * Provide uninstall.sh to remove linked dependencies * Line up Github Actions/Ubuntu 22.04
1 parent fae99ae commit 6f0a7a0

File tree

9 files changed

+374
-169
lines changed

9 files changed

+374
-169
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
matrix:
2222
config:
2323
- {
24-
name: "Ubuntu Latest GCC (Release)",
24+
name: "Build Dash and dependencies",
2525
os: ubuntu-latest,
2626
build_type: "Release",
2727
cc: "gcc",
@@ -31,26 +31,19 @@ jobs:
3131

3232
steps:
3333
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
34-
- uses: actions/checkout@v2
34+
- uses: actions/checkout@v3
3535

3636
- name: Print env
3737
run: |
3838
echo github.event.action: ${{ github.event.action }}
3939
echo github.event_name: ${{ github.event_name }}
4040
4141
- name: Install dependencies on ubuntu
42-
if: startsWith(matrix.config.name, 'Ubuntu Latest GCC')
4342
run: |
44-
sudo apt-get update
43+
sudo apt update && sudo apt upgrade -y
4544
# sudo apt-get install --no-install-recommends libxkbcommon-x11-0 libgl1-mesa-dev xserver-xorg-video-all xserver-xorg-input-all xserver-xorg-core xinit x11-xserver-utils
46-
cmake --version
47-
gcc --version
48-
49-
- name: Patch install.sh
50-
shell: bash
51-
run: |
52-
sed -i 's/libusb-1.0.0-dev/libusb-1.0-0-dev/g' install.sh
53-
sed -i 's/^\s*\.\/dash/\# \.\/dash/g' install.sh
45+
# cmake --version
46+
# gcc --version
5447
5548
- name: Build
5649
shell: bash

install.sh

Lines changed: 86 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,48 @@ display_help() {
2222
echo
2323
}
2424

25-
#determine if script is being run on bullseye or above
26-
BULLSEYE=false
27-
read -d . DEBIAN_VERSION < /etc/debian_version
28-
if (( $DEBIAN_VERSION > 10 )); then
29-
echo Detected Debian version of Bullseye or above
30-
BULLSEYE=true
25+
# Check Distro version
26+
if [ -f /etc/os-release ]; then
27+
OS_DISTRO=$(source /etc/os-release; echo ${PRETTY_NAME%% *})
28+
if [ $OS_DISTRO = "Debian" ]; then
29+
isDebian=true
30+
#determine if script is being run on bullseye or above
31+
BULLSEYE=false
32+
read -d . DEBIAN_VERSION < /etc/debian_version
33+
if (( $DEBIAN_VERSION > 10 )); then
34+
echo Detected Debian version of Bullseye or above
35+
BULLSEYE=true
36+
fi
37+
elif [ $OS_DISTRO = "Ubuntu" ]; then
38+
isUbuntu=true
39+
echo Detected Ubuntu
40+
else
41+
echo Unsupported OS detected. Halting.
42+
exit 1
43+
fi
3144
fi
3245

3346
#check if /etc/rpi-issue exists, if not set the install Args to be false
3447
if [ -f /etc/rpi-issue ]
3548
then
49+
rpiModel=$(cat /sys/firmware/devicetree/base/model | awk '{print $3}')
50+
echo "Detected Raspberry Pi Model $rpiModel"
3651
installArgs="-DRPI_BUILD=true"
3752
isRpi=true
3853
else
3954
installArgs=""
4055
isRpi=false
4156
fi
4257

58+
#check for potential resource limit
59+
totalMem=$(free -tm | awk '/Total/ {print $2}')
60+
if [[ $rpiModel -lt 4 || $totalMem -lt 1900 ]]; then
61+
echo "Raspberry Pi Model $rpiModel with "$totalMem"MB RAM detected"
62+
echo "You may run out of memory while compiling with less than 2GB"
63+
echo "Consider raising swap space or compiling on another machine"
64+
sleep 5;
65+
fi
66+
4367
BUILD_TYPE="Release"
4468

4569
#check to see if there are any arguments supplied, if none are supplied run full install
@@ -113,7 +137,7 @@ dependencies=(
113137
"alsa-utils"
114138
"cmake"
115139
"libboost-all-dev"
116-
"libusb-1.0.0-dev"
140+
"libusb-1.0-0-dev"
117141
"libssl-dev"
118142
"libprotobuf-dev"
119143
"protobuf-c-compiler"
@@ -160,10 +184,11 @@ if [ $deps = false ]
160184
then
161185
echo -e skipping dependencies '\n'
162186
else
163-
if [ $BULLSEYE = false ]; then
187+
if [ $isDebian ] && [ $BULLSEYE = false ]; then
164188
echo Adding qt5-default to dependencies
165189
dependencies[${#dependencies[@]}]="qt5-default"
166190
fi
191+
167192
echo installing dependencies
168193
#loop through dependencies and install
169194
echo Running apt update
@@ -191,6 +216,9 @@ if [ $pulseaudio = false ]
191216
then
192217
echo -e skipping pulseaudio '\n'
193218
else
219+
#change to project root
220+
cd $script_path
221+
194222
echo Preparing to compile and install pulseaudio
195223
echo Grabbing pulseaudio deps
196224
sudo sed -i 's/#deb-src/deb-src/g' /etc/apt/sources.list
@@ -242,6 +270,9 @@ if [ $bluez = false ]
242270
then
243271
echo -e skipping bluez '\n'
244272
else
273+
#change to project root
274+
cd $script_path
275+
245276
echo Installing bluez
246277
sudo apt-get install -y libdbus-1-dev libudev-dev libical-dev libreadline-dev libjson-c-dev
247278
wget www.kernel.org/pub/linux/bluetooth/bluez-5.63.tar.xz
@@ -258,8 +289,8 @@ fi
258289
if [ $aasdk = false ]; then
259290
echo -e Skipping aasdk '\n'
260291
else
261-
#change to parent directory
262-
cd ..
292+
#change to project root
293+
cd $script_path
263294

264295
#clone aasdk
265296
git clone $aasdkRepo
@@ -281,6 +312,10 @@ else
281312
echo -e moving to aasdk '\n'
282313
cd aasdk
283314

315+
#apply set_FIPS_mode patch
316+
echo Apply set_FIPS_mode patch
317+
git apply $script_path/patches/aasdk_openssl-fips-fix.patch
318+
284319
#create build directory
285320
echo Creating aasdk build directory
286321
mkdir build
@@ -330,10 +365,10 @@ fi
330365
if [ $h264bitstream = false ]; then
331366
echo -e Skipping h264bitstream '\n'
332367
else
333-
#change to parent directory
334-
cd ..
368+
#change to project root
369+
cd $script_path
335370

336-
#clone aasdk
371+
#clone h264bitstream
337372
git clone $h264bitstreamRepo
338373
if [[ $? -eq 0 ]]; then
339374
echo -e h264bitstream Cloned ok '\n'
@@ -402,8 +437,8 @@ fi
402437
if [ $gstreamer = true ]; then
403438
echo installing gstreamer
404439

405-
#change to parent directory
406-
cd ..
440+
#change to project root
441+
cd $script_path
407442

408443
#clone gstreamer
409444
echo Cloning Gstreamer
@@ -425,7 +460,7 @@ if [ $gstreamer = true ]; then
425460
#change into newly cloned directory
426461
cd qt-gstreamer
427462

428-
if [ $BULLSEYE = true ]; then
463+
if [ $BULLSEYE = true ] || [ $isUbuntu = true ]; then
429464
#apply 1.18 patch
430465
echo Applying qt-gstreamer 1.18 patch
431466
git apply $script_path/patches/qt-gstreamer-1.18.patch
@@ -435,6 +470,10 @@ if [ $gstreamer = true ]; then
435470
echo Apply greenline patch
436471
git apply $script_path/patches/greenline_fix.patch
437472

473+
#apply atomic patch
474+
echo Apply atomic patch
475+
git apply $script_path/patches/qt-gstreamer_atomic-load.patch
476+
438477
#create build directory
439478
echo Creating Gstreamer build directory
440479
mkdir build
@@ -459,7 +498,7 @@ if [ $gstreamer = true ]; then
459498
fi
460499

461500
echo Making Gstreamer
462-
make -j4
501+
make
463502

464503
if [[ $? -eq 0 ]]; then
465504
echo -e Gstreamer make ok'\n'
@@ -493,8 +532,11 @@ if [ $openauto = false ]; then
493532
echo -e skipping openauto'\n'
494533
else
495534
echo Installing openauto
496-
cd ..
497535

536+
#change to project root
537+
cd $script_path
538+
539+
#clone openauto
498540
echo -e cloning openauto'\n'
499541
git clone $openautoRepo
500542
if [[ $? -eq 0 ]]; then
@@ -536,6 +578,7 @@ else
536578

537579
echo Beginning openauto make
538580
make
581+
539582
if [[ $? -eq 0 ]]; then
540583
echo -e Openauto make OK'\n'
541584
else
@@ -561,6 +604,9 @@ if [ $dash = false ]; then
561604
echo -e Skipping dash'\n'
562605
else
563606

607+
#change to project root
608+
cd $script_path
609+
564610
#create build directory
565611
echo Creating dash build directory
566612
mkdir build
@@ -585,6 +631,7 @@ else
585631

586632
echo Running Dash make
587633
make
634+
588635
if [[ $? -eq 0 ]]; then
589636
echo -e Dash make ok, executable can be found ../bin/dash
590637
echo
@@ -608,34 +655,30 @@ else
608655
echo Dash make failed with error code $?
609656
exit 1
610657
fi
658+
cd ../
611659

612-
#Setting openGL driver and GPU memory to 128mb
660+
#Raspberry Pi addons
613661
if $isRpi; then
614-
sudo raspi-config nonint do_memory_split 128
615-
if [[ $? -eq 0 ]]; then
616-
echo -e Memory set to 128mb'\n'
662+
read -p "Configure select Raspberry Pi enhancements? (y/N) " choice
663+
if [[ $choice == "y" || $choice == "Y" ]]; then
664+
./rpi.sh
665+
exit 0
617666
else
618-
echo Setting memory failed with error code $? please set manually
619-
exit 1
667+
echo "Continuing"
620668
fi
621-
622-
sudo raspi-config nonint do_gldriver G2
623-
if [[ $? -eq 0 ]]; then
624-
echo -e OpenGL set ok'\n'
625-
else
626-
echo Setting openGL failed with error code $? please set manually
627-
exit 1
628-
fi
629-
630-
echo enabling krnbt to speed up boot and improve stability
631-
cat <<EOT >> /boot/config.txt
632-
dtparam=krnbt
633-
EOT
634669
fi
635670

636-
637-
#Start app
638-
echo Starting app
639-
cd ../bin
640-
./dash
641-
fi
671+
read -p "Build complete! Start application? (y/N) " choice
672+
if [[ $choice == "y" || $choice == "Y" ]]; then
673+
./bin/dash
674+
if [[ $? -eq 1 ]]; then
675+
echo "Something went wrong! You may need to set up Xorg/X11"
676+
exit 1
677+
else
678+
exit 0
679+
fi
680+
else
681+
echo "Exiting"
682+
exit 0
683+
fi
684+
fi
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 885a8c83ef4f813205fa21cd9e96228db94bcdd2 Mon Sep 17 00:00:00 2001
2+
From: "John EVANS (eva0034)" <[email protected]>
3+
Date: Sat, 6 Jan 2024 16:58:01 +1100
4+
Subject: [PATCH] Update SSLWrapper.cpp:
5+
6+
fix sslwrapper.cpp for newer openssl compilation.
7+
---
8+
src/Transport/SSLWrapper.cpp | 14 ++++++++++++++
9+
1 file changed, 14 insertions(+)
10+
11+
diff --git a/src/Transport/SSLWrapper.cpp b/src/Transport/SSLWrapper.cpp
12+
index 6aca9b44..1c770bf8 100644
13+
--- a/src/Transport/SSLWrapper.cpp
14+
+++ b/src/Transport/SSLWrapper.cpp
15+
@@ -33,13 +33,27 @@ SSLWrapper::SSLWrapper()
16+
{
17+
SSL_library_init();
18+
SSL_load_error_strings();
19+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L && !defined(LIBRESSL_VERSION_NUMBER)
20+
+ /*
21+
+ * ERR_load_*(), ERR_func_error_string(), ERR_get_error_line(), ERR_get_error_line_data(), ERR_get_state()
22+
+ * OpenSSL now loads error strings automatically so these functions are not needed.
23+
+ * SEE FOR MORE:
24+
+ * https://www.openssl.org/docs/manmaster/man7/migration_guide.html
25+
+ *
26+
+ */
27+
+#else
28+
ERR_load_BIO_strings();
29+
+#endif
30+
OpenSSL_add_all_algorithms();
31+
}
32+
33+
SSLWrapper::~SSLWrapper()
34+
{
35+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
36+
+ EVP_default_properties_enable_fips(nullptr, 0);
37+
+#else
38+
FIPS_mode_set(0);
39+
+#endif
40+
ENGINE_cleanup();
41+
CONF_modules_unload(1);
42+
EVP_cleanup();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/elements/gstqtvideosink/gstqtvideosinkplugin.h b/elements/gstqtvideosink/gstqtvideosinkplugin.h
2+
index dc04671..a72c572 100644
3+
--- a/elements/gstqtvideosink/gstqtvideosinkplugin.h
4+
+++ b/elements/gstqtvideosink/gstqtvideosinkplugin.h
5+
@@ -27,7 +27,7 @@ GST_DEBUG_CATEGORY_EXTERN(gst_qt_video_sink_debug);
6+
#define DEFINE_TYPE_FULL(cpp_type, type_name, parent_type, additional_initializations) \
7+
GType cpp_type::get_type() \
8+
{ \
9+
- static volatile gsize gonce_data = 0; \
10+
+ static gsize gonce_data = 0; \
11+
if (g_once_init_enter(&gonce_data)) { \
12+
GType type = 0; \
13+
GTypeInfo info; \

0 commit comments

Comments
 (0)