Skip to content

Instantly share code, notes, and snippets.

@fagci
Last active March 11, 2023 13:13
Show Gist options
  • Save fagci/3abb0bdbeb69e13a51c86b082c59e1dd to your computer and use it in GitHub Desktop.
Save fagci/3abb0bdbeb69e13a51c86b082c59e1dd to your computer and use it in GitHub Desktop.
Script to install rtl_sdr tools plus dsd decoder on termux.
#!/usr/bin/env -S bash -x
REPOS_DIR=~/sdr_tools_repos
pkg update
pkg install curl
curl https://its-pointless.github.io/setup-pointless-repo.sh |bash
pkg install build-essential cmake make git libusb pulseaudio portaudio fftw gcc-10 libgfortran5 openblas
mkdir -p "$REPOS_DIR"
cd "$REPOS_DIR"
git clone https://github.com/librtlsdr/librtlsdr.git
git clone https://github.com/LouisErigHerve/mbelib.git
git clone https://github.com/kumanna/itpp.git
git clone https://github.com/LouisErigHerve/dsd.git
function cd_build() {
cd "${REPOS_DIR}/$1"
git reset --hard
mkdir build
cd build
}
function failed(){
echo "Failed"
exit 255
}
cd_build itpp
echo "Configuring itpp"
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX .. || failed
echo "Building itpp"
{ make || failed; } && make install
cd_build librtlsdr
echo "Configuring librtlsdr"
sed -i 's/pthread_cancel[(]/pthread_exit((void *)/g' "$REPOS_DIR"/librtlsdr/src/rtl_adsb.c
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX .. || failed
echo "Building librtlsdr"
{ make || failed; } && make install
cd_build mbelib
echo "Configuring mbelib"
cmake -DCMAKE_INSTALL_PREFIX=$PREFIX .. || failed
echo "Building mbelib"
{ make || failed; } && make install
cd_build dsd
echo "Configuring dsd"
sed -i 's/sys\/soundcard.h/linux\/soundcard.h/g' "$REPOS_DIR"/dsd/include/dsd.h
cmake -D MBE_INCLUDE_DIR=$PREFIX/local/include \
-D ITPP_INCLUDE_DIR=$PREFIX/include/itpp \
-D ITPP_LIBRARY=$PREFIX/lib/libitpp_debug.so \
-D CMAKE_INSTALL_PREFIX=$PREFIX .. \
|| failed
echo "Building dsd"
{ make || failed; } && make install
echo "librtlsdr and dsd successfully installed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment