Skip to content

Instantly share code, notes, and snippets.

@tehmaze
Last active December 20, 2016 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tehmaze/10e97ba7864edfcb3eadfaea08f1a168 to your computer and use it in GitHub Desktop.
Save tehmaze/10e97ba7864edfcb3eadfaea08f1a168 to your computer and use it in GitHub Desktop.
Building dml on rpi
#!/bin/bash
# Exit on error
set -e
# Exit on unassigned variable
set -u
WORKDIR=$HOME/src
# Work directory
mkdir -p $WORKDIR
# Check debian version
if ! grep -q "^8" /etc/debian_version; then
echo "This only works on Debian 8.x (e.g. Raspbian/Jessie)" >&2
exit 1
fi
# Check user, enforce a little best practice
if [ "x${USER}" = "xroot" ]; then
echo "Do not run this script as the root user, use an unprivileged user" >&2
echo "The script will use sudo whenever root privileges are required" >&2
exit 1
fi
cat <<QRT
Welcome to the dml build script by Wijnand PD0MZ
This will attempt to build dml and all its dependancies on your system. It
requires sufficient free disk space to complete the build. Also note, that
if the system is used for other HAM applications, this script may remove
required dependancies for your running projects. Make sure you run this on
a system that's clean and doesn't serve production data. You have been warned.
The standard disclaimer applies that the authors cannot be held responsible
for any potential damages done to your system, rigs, hardware or mental state.
73s
Wijnand PD0MZ
QRT
read -p "Press return to continue, or hit ^C now to abort" _
# Update apt
sudo apt-get update
# Remove packages that we are going to install from source
sudo apt-get purge libhamlib2 libhamlib-dev libhamlib-utils \
libcodec2-0.4 libcodec2-dev \
libwebsockets-dev libwebsockets3
# Compiler dependancies, version control
sudo apt-get install -y build-essential libtool autoconf automake pkg-config \
git subversion \
libusb-dev libusb-1.0-0-dev libreadline-dev \
texinfo libmagic-dev
# Install libssl from backports, since dml requires openssl-1.0.2
sudo apt install -y -t jessie-backports libssl-dev libsamplerate-dev
# Clone & install codec2-dev
if [ -z "$(pkg-config --modversion codec2 2>/dev/null || /bin/true)" ]; then
if [ ! -d $WORKDIR/codec2-dev ]; then
svn co https://svn.code.sf.net/p/freetel/code/codec2-dev $WORKDIR/codec2-dev
fi
mkdir -p $WORKDIR/codec2-dev/build && cd $WORKDIR/codec2-dev/build && cmake ../ && make && sudo make install
fi
# Clone & install hamlib
if [ -z "$(pkg-config --modversion hamlib 2>/dev/null || /bin/true)" ]; then
if [ ! -d $WORKDIR/hamlib ]; then
git clone https://github.com/N0NB/hamlib $WORKDIR/hamlib
fi
pushd $WORKDIR/hamlib
./autogen.sh && make && sudo make install
popd
fi
# Clone & install libwebsockets
if [ -z "$(pkg-config --modversion libwebsockets 2>/dev/null || /bin/true)" ]; then
if [ ! -d $WORKDIR/libwebsockets ]; then
git clone -b v2.1-stable https://github.com/warmcat/libwebsockets $WORKDIR/libwebsockets
fi
mkdir -p $WORKDIR/libwebsockets/build && cd $WORKDIR/libwebsockets/build && cmake ../ && make && sudo make install
fi
# Clone & install eth_ar
if [ ! -f /usr/local/include/eth_ar/eth_ar.h ]; then
if [ ! -d $WORKDIR/eth_ar ]; then
git clone http://video.vreeken.net/~pe1rxq/eth_ar.git/ $WORKDIR/eth_ar
fi
# XXX Bug in eth_ar, link against libm
cd $WORKDIR/eth_ar && ./bootstrap && make CFLAGS=-lm && sudo make install
fi
# Clone & install dml
if [ ! -e /usr/local/bin/dmld ]; then
if [ ! -d $WORKDIR/dml ]; then
git clone http://video.vreeken.net/~pe1rxq/dml.git/ $WORKDIR/dml
fi
# Monkey patch for incorrect formatting strings
sed -e 's/%016lx/%016llx/' -i $WORKDIR/dml/dml_reflector.c
# Also here missing libm
cd $WORKDIR/dml && ./bootstrap && make CFLAGS=-lm && sudo make install
fi
echo "All done. QRT. 73s de PD0MZ"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment