Skip to content

Instantly share code, notes, and snippets.

@anoduck
Created June 22, 2023 08:10
Show Gist options
  • Save anoduck/b4c1f66af67c772accb0b5bbbca1cbc9 to your computer and use it in GitHub Desktop.
Save anoduck/b4c1f66af67c772accb0b5bbbca1cbc9 to your computer and use it in GitHub Desktop.
Simple script to install sdrangel
#!/usr/bin/env bash
#
# Copyright (C) 2023 Anoduck
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# --------------------------------------------------------------------------------
#########################################
# ___ ___ ___ _ _ #
# / __| \| _ \ /_\ _ _ __ _ ___| | #
# \__ \ |) | / / _ \| ' \/ _` / -_) | #
# |___/___/|_|_\/_/ \_\_||_\__, \___|_| #
# |___/ #
#########################################
# ================================================================================
# Script to install sdrangel
WORKDIR="/opt/build"
INSTALLDIR="/opt/install"
mkdir -p /opt/build && cd "$_" || return
sudo chown "$USER":users /opt/build
sudo mkdir -p "$INSTALLDIR"
sudo chown "$USER":users "$INSTALLDIR"
sudo apt-get update && sudo apt-get -y install \
git cmake g++ pkg-config autoconf automake libtool libfftw3-dev libusb-1.0-0-dev libusb-dev libhidapi-dev libopengl-dev \
qtbase5-dev qtchooser libqt5multimedia5-plugins qtmultimedia5-dev libqt5websockets5-dev \
qttools5-dev qttools5-dev-tools libqt5opengl5-dev libqt5quick5 libqt5charts5-dev \
qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick-window2 \
qml-module-qtquick-dialogs qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-layouts \
libqt5serialport5-dev qtdeclarative5-dev qtpositioning5-dev qtlocation5-dev libqt5texttospeech5-dev \
qtwebengine5-dev qtbase5-private-dev libqt5gamepad5-dev \
libfaad-dev zlib1g-dev libboost-all-dev libasound2-dev pulseaudio libopencv-dev libxml2-dev bison flex \
ffmpeg libavcodec-dev libavformat-dev libopus-dev doxygen graphviz libsndfile-dev libspeexdsp-dev libsamplerate0-dev
if [[ "$PWD" == "$WORKDIR" ]]; then
echo "Pulling Dependency Repositories from Github."
for REPO in srcejon/aptdec.git \
f4exb/cm256cc.git \
srcejon/dab-cmdline \
szechyjs/mbelib.git \
f4exb/serialDV.git \
f4exb/dsdcc.git \
drowe67/codec2.git \
f4exb/sdrangel.git \
f4exb/libsigmf.git \
dnwrnr/sgp4.git \
f4exb/sdrangel.git;
do git clone https://github.com/"$REPO"; done
fi
echo "Building dependencies for sdrangel"
cd aptdec || return
git checkout libaptdec
git submodule update --init --recursive
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/aptdec ..
make -j "$(nproc)" install
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd cm256cc || return
git reset --hard c0e92b92aca3d1d36c990b642b937c64d363c559
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/cm256cc ..
make -j "$(nproc)" install
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd dab-cmdline/library || return
git checkout msvc
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/libdab ..
make -j "$(nproc)" install
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd mbelib || return
git reset --hard 9a04ed5c78176a9965f3d43f7aa1b1f5330e771f
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/mbelib ..
make -j "$(nproc)" install || return
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd serialDV || return
git reset --hard "v1.1.4"
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/serialdv ..
make -j "$(nproc)" install
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd dsdcc || return
git reset --hard "v1.9.3"
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/dsdcc\
-DUSE_MBELIB=ON\
-DLIBMBE_INCLUDE_DIR="$INSTALLDIR"/mbelib/include\
-DLIBMBE_LIBRARY="$INSTALLDIR"/mbelib/lib/libmbe.so\
-DLIBSERIALDV_INCLUDE_DIR="$INSTALLDIR"/serialdv/include/serialdv\
-DLIBSERIALDV_LIBRARY="$INSTALLDIR"/serialdv/lib/libserialdv.so ..
make -j "$(nproc)" install
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd codec2 || return
git reset --hard 76a20416d715ee06f8b36a9953506876689a3bd2
mkdir -p build_linux; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/codec2 ..
make -j "$(nproc)" install
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd sgp4 || return
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/sgp4 ..
make -j "$(nproc)" install
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd libsigmf || return
git checkout "new-namespaces"
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/libsigmf ..
make -j "$(nproc)" install
cd "$WORKDIR" || echo "Something went wrong changing dir" || exit
cd sdrangel || return
mkdir -p build; cd "$_" || return
cmake -Wno-dev -DDEBUG_OUTPUT=ON -DRX_SAMPLE_24BIT=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMIRISDR_DIR="$INSTALLDIR"/libmirisdr \
-DAIRSPY_DIR="$INSTALLDIR"/libairspy \
-DAIRSPYHF_DIR="$INSTALLDIR"/libairspyhf \
-DBLADERF_DIR="$INSTALLDIR"/libbladeRF \
-DHACKRF_DIR="$INSTALLDIR"/libhackrf \
-DRTLSDR_DIR="$INSTALLDIR"/librtlsdr \
-DLIMESUITE_DIR="$INSTALLDIR"/LimeSuite \
-DIIO_DIR="$INSTALLDIR"/libiio \
-DPERSEUS_DIR="$INSTALLDIR"/libperseus \
-DXTRX_DIR="$INSTALLDIR"/xtrx-images \
-DSOAPYSDR_DIR="$INSTALLDIR"/SoapySDR \
-DUHD_DIR="$INSTALLDIR"/uhd \
-DAPT_DIR="$INSTALLDIR"/aptdec \
-DCM256CC_DIR="$INSTALLDIR"/cm256cc \
-DDSDCC_DIR="$INSTALLDIR"/dsdcc \
-DSERIALDV_DIR="$INSTALLDIR"/serialdv \
-DMBE_DIR="$INSTALLDIR"/mbelib \
-DCODEC2_DIR="$INSTALLDIR"/codec2 \
-DSGP4_DIR="$INSTALLDIR"/sgp4 \
-DLIBSIGMF_DIR="$INSTALLDIR"/libsigmf \
-DDAB_DIR="$INSTALLDIR"/libdab \
-DCMAKE_INSTALL_PREFIX="$INSTALLDIR"/sdrangel ..
make -j "$(nproc)" install
cd "$HOME" || echo "Something went wrong changing dir" || exit
echo "Install Finished!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment