### How to compile and set up Dream DRM on Ubuntu

Dream is an open source software receiver and transmitter for DRM (Digital Radio Mondiale) standard. It is a cross-platform application, yet there are no up-to-date Linux packages for major distros. I tried to install existing packages and failed to launch Dream with a segmentation fault.

So I decided to build from source. Dream needs Qt development kit and some other libraries. For audio decoding and encoding, AAC libraries are needed. These are available in repositories, but most of the time they are compiled without DRM support. I will show you how to compile them with DRM support and make Dream detect them.

Update: Tested and working on Ubuntu 16.04 and 16.10.

The instructions below are based on the official instructions on Dream website. I updated them to work with newer Ubuntu releases and I also added a Desktop entry, so you can launch Dream from Dash. It should be noted that the source compiles on Qt5, yet Dream doesn't work (segmentation fault).

I made compile and installation instructions as a bash script that is divided in five sections. The first section deals with dependencies installation and is mandatory. The second section will download, build and copy the AAC decoder library. This is needed if you want to use Dream to decode DRM. The third section is about AAC encoder library, which you only need if you want to transmit DRM signal via sound card. The fourth section will download and compile Dream and the last section will clean up your system from the no longer needed files that resulted during compilation and download.

In order to successfully compile Dream, you have to modify the dream.pro file (the Qt project file) and replace every occurrence of OUT_PWD with /usr. You will also get a linking error unless you replace faad_drm with faad2_drm. You can do these by editing dream.pro with a text editor or use sed as in the below script.

To start Dream easily from Dash or other app menu, you must make a desktop entry file and place it in ~/.local/share/applications. This is what the file should contain:
[Desktop Entry]
Version=1.0
Type=Application
Name=Dream
TryExec=/usr/local/bin/dream
Exec=/usr/local/bin/dream
Icon=dream.svg
Categories=Audio;AudioVideo;Science;Electronics
The icon must be copied from ./dream/src/GUI-QT/res/MainIcon.svg to /usr/share/icons/dream.svg. The script which follows takes care of all.

Download the script from GitHub. You can save it, make it executable and run it or you can paste each command in Terminal. Note that this script may become invalid with newer version of Dream, so adjust file names as needed. If you want to speed up the compiling, add after each make call the argument -jX where X is the maximum number of jobs executed at the same time.

If you want to compile with Qt5, although for me it didn't work, replace qmake-qt4 with qmake and install qt5-default. It also compiles with Qt downloaded from qt.io as long as you use the correct qmake.

If you want to transmit with Dream, run it with -t argument:
dream -t
 Dream transmit mode
In a future article I will describe a 455 kHz downconverter that you can add to any AM radio and use it with Dream to decode DRM signals.