From ecc1647ee60e13af2303ed87488f55422f0dcfdd Mon Sep 17 00:00:00 2001
From: Edouard Griffiths <f4exb06@gmail.com>
Date: Wed, 26 Oct 2016 00:57:46 +0200
Subject: [PATCH] Implemented Debian package build environment

---
 .gitignore                                 |   5 +
 CMakeLists.txt                             | 501 +++++++++++----------
 cm256cc/CMakeLists.txt                     |  67 +++
 debian/README.Debian                       |   6 +
 debian/README.source                       |  10 +
 debian/changelog                           |   6 +
 debian/compat                              |   1 +
 debian/control                             |  24 +
 debian/copyright                           |  33 ++
 debian/debhelper-build-stamp               |   2 +
 debian/init.d.ex                           |  26 ++
 debian/manpage.1.ex                        |  56 +++
 debian/manpage.sgml.ex                     | 154 +++++++
 debian/manpage.xml.ex                      | 291 ++++++++++++
 debian/menu.ex                             |   2 +
 debian/postinst.ex                         |  39 ++
 debian/postrm.ex                           |  37 ++
 debian/preinst.ex                          |  35 ++
 debian/prerm.ex                            |  38 ++
 debian/rules                               |  25 +
 debian/sdrangel-docs.docs                  |   2 +
 debian/sdrangel.cron.d.ex                  |   4 +
 debian/sdrangel.default.ex                 |  10 +
 debian/sdrangel.doc-base.EX                |  20 +
 debian/source/format                       |   1 +
 debian/watch.ex                            |  39 ++
 dsdcc/CMakeLists.txt                       |  74 +++
 libairspy/CMakeLists.txt                   |  36 ++
 libhackrf/CMakeLists.txt                   |  30 ++
 librtlsdr/CMakeLists.txt                   |  39 ++
 mbelib/CMakeLists.txt                      |  36 ++
 plugins/channelrx/CMakeLists.txt           |   4 +
 plugins/channelrx/demoddsd/CMakeLists.txt  |  61 ++-
 plugins/samplesource/airspy/CMakeLists.txt |  57 ++-
 plugins/samplesource/hackrf/CMakeLists.txt |  54 ++-
 plugins/samplesource/rtlsdr/CMakeLists.txt |  58 ++-
 serialdv/CMakeLists.txt                    |  29 ++
 37 files changed, 1599 insertions(+), 313 deletions(-)
 create mode 100644 cm256cc/CMakeLists.txt
 create mode 100644 debian/README.Debian
 create mode 100644 debian/README.source
 create mode 100644 debian/changelog
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/copyright
 create mode 100644 debian/debhelper-build-stamp
 create mode 100644 debian/init.d.ex
 create mode 100644 debian/manpage.1.ex
 create mode 100644 debian/manpage.sgml.ex
 create mode 100644 debian/manpage.xml.ex
 create mode 100644 debian/menu.ex
 create mode 100644 debian/postinst.ex
 create mode 100644 debian/postrm.ex
 create mode 100644 debian/preinst.ex
 create mode 100644 debian/prerm.ex
 create mode 100755 debian/rules
 create mode 100644 debian/sdrangel-docs.docs
 create mode 100644 debian/sdrangel.cron.d.ex
 create mode 100644 debian/sdrangel.default.ex
 create mode 100644 debian/sdrangel.doc-base.EX
 create mode 100644 debian/source/format
 create mode 100644 debian/watch.ex
 create mode 100644 dsdcc/CMakeLists.txt
 create mode 100644 libairspy/CMakeLists.txt
 create mode 100644 libhackrf/CMakeLists.txt
 create mode 100644 librtlsdr/CMakeLists.txt
 create mode 100644 mbelib/CMakeLists.txt
 create mode 100644 serialdv/CMakeLists.txt

diff --git a/.gitignore b/.gitignore
index 9db615813..f46606f55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,8 @@ sdrangelove.supp
 *.cs
 *.pro.user
 .idea/*
+debian/sdrangel/*
+debian/sdrangel.substvars
+debian/files
+debian/sdrangel.debhelper.log
+obj-x86_64-linux-gnu/*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3fb956e5c..045a10b06 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,13 +29,16 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
 project(sdrangel)
 
 if (BUILD_TYPE MATCHES RELEASE)
-	set(CMAKE_BUILD_TYPE "Release")
+    set(CMAKE_BUILD_TYPE "Release")
 elseif (BUILD_TYPE MATCHES RELEASEWITHDBGINFO)
-	set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo")
+    set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo")
 elseif (BUILD_TYPE MATCHES DEBUG)
-	set(CMAKE_BUILD_TYPE "Debug")
+    set(CMAKE_BUILD_TYPE "Debug")
+elseif (BUILD_TYPE MATCHES DEBIAN)
+    set(CMAKE_BUILD_TYPE "Release")
+    set(BUILD_DEBIAN TRUE)
 else()
-	set(CMAKE_BUILD_TYPE "Release")
+    set(CMAKE_BUILD_TYPE "Release")
 endif()
 
 set(QT_USE_QTOPENGL TRUE)
@@ -51,9 +54,12 @@ find_package(PkgConfig)
 
 find_package(Boost)
 find_package(FFTW3F)
-find_package(LibDSDcc)
-find_package(LibMbe)
-find_package(SerialDV)
+
+if (NOT BUILD_DEBIAN)
+    find_package(LibDSDcc)
+    find_package(LibMbe)
+    find_package(SerialDV)
+endif()
 
 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86")
  SET(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
@@ -68,261 +74,261 @@ endif(APPLE)
 #include(${QT_USE_FILE})
 
 if (DEBUG_OUTPUT)
-	set( QT_DEFINITIONS "${QT_DEFINITIONS}" )
+    set( QT_DEFINITIONS "${QT_DEFINITIONS}" )
 else()
-	set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" )
+    set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" )
 endif()
 
 add_definitions(${QT_DEFINITIONS})
 
 if(MSVC)
-	foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
-		string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
-		set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
-		set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
-		set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
-	endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
+    foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
+        string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
+        set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
+        set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
+        set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
+    endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
 endif()
 
 ##############################################################################
 
 set(sdrbase_SOURCES
-	sdrbase/mainwindow.cpp
+    sdrbase/mainwindow.cpp
 
-	sdrbase/audio/audiodeviceinfo.cpp
-	sdrbase/audio/audiofifo.cpp
-	sdrbase/audio/audiooutput.cpp
+    sdrbase/audio/audiodeviceinfo.cpp
+    sdrbase/audio/audiofifo.cpp
+    sdrbase/audio/audiooutput.cpp
 
-	sdrbase/dsp/afsquelch.cpp
-	sdrbase/dsp/agc.cpp
-	sdrbase/dsp/downchannelizer.cpp
+    sdrbase/dsp/afsquelch.cpp
+    sdrbase/dsp/agc.cpp
+    sdrbase/dsp/downchannelizer.cpp
     sdrbase/dsp/upchannelizer.cpp
-	sdrbase/dsp/channelmarker.cpp
-	sdrbase/dsp/ctcssdetector.cpp
-	sdrbase/dsp/dspcommands.cpp
-	sdrbase/dsp/dspengine.cpp
-	sdrbase/dsp/dspdevicesourceengine.cpp
+    sdrbase/dsp/channelmarker.cpp
+    sdrbase/dsp/ctcssdetector.cpp
+    sdrbase/dsp/dspcommands.cpp
+    sdrbase/dsp/dspengine.cpp
+    sdrbase/dsp/dspdevicesourceengine.cpp
     sdrbase/dsp/dspdevicesinkengine.cpp
-	sdrbase/dsp/fftengine.cpp
-	sdrbase/dsp/fftfilt.cxx
-	sdrbase/dsp/fftwindow.cpp
-	sdrbase/dsp/filterrc.cpp
-	sdrbase/dsp/filtermbe.cpp
-	sdrbase/dsp/filerecord.cpp
-	sdrbase/dsp/interpolator.cpp
-	sdrbase/dsp/inthalfbandfilter.cpp
-	sdrbase/dsp/lowpass.cpp
-	sdrbase/dsp/movingaverage.cpp
-	sdrbase/dsp/nco.cpp
-	sdrbase/dsp/pidcontroller.cpp
+    sdrbase/dsp/fftengine.cpp
+    sdrbase/dsp/fftfilt.cxx
+    sdrbase/dsp/fftwindow.cpp
+    sdrbase/dsp/filterrc.cpp
+    sdrbase/dsp/filtermbe.cpp
+    sdrbase/dsp/filerecord.cpp
+    sdrbase/dsp/interpolator.cpp
+    sdrbase/dsp/inthalfbandfilter.cpp
+    sdrbase/dsp/lowpass.cpp
+    sdrbase/dsp/movingaverage.cpp
+    sdrbase/dsp/nco.cpp
+    sdrbase/dsp/pidcontroller.cpp
     sdrbase/dsp/phaselock.cpp
-	sdrbase/dsp/samplesinkfifo.cpp
+    sdrbase/dsp/samplesinkfifo.cpp
     sdrbase/dsp/samplesourcefifo.cpp
     sdrbase/dsp/samplesinkfifodoublebuffered.cpp
-	sdrbase/dsp/basebandsamplesink.cpp
+    sdrbase/dsp/basebandsamplesink.cpp
     sdrbase/dsp/basebandsamplesource.cpp
-	sdrbase/dsp/nullsink.cpp
-	sdrbase/dsp/spectrumscopecombovis.cpp
-	sdrbase/dsp/scopevis.cpp
-	sdrbase/dsp/spectrumvis.cpp
-	sdrbase/dsp/threadedbasebandsamplesink.cpp
+    sdrbase/dsp/nullsink.cpp
+    sdrbase/dsp/spectrumscopecombovis.cpp
+    sdrbase/dsp/scopevis.cpp
+    sdrbase/dsp/spectrumvis.cpp
+    sdrbase/dsp/threadedbasebandsamplesink.cpp
     sdrbase/dsp/threadedbasebandsamplesource.cpp
 
-	sdrbase/gui/aboutdialog.cpp
-	sdrbase/gui/addpresetdialog.cpp
-	sdrbase/gui/basicchannelsettingswidget.cpp
-	sdrbase/gui/buttonswitch.cpp
-	sdrbase/gui/channelwindow.cpp
-	sdrbase/gui/colormapper.cpp
-	sdrbase/gui/glscope.cpp
-	sdrbase/gui/glscopegui.cpp
-	sdrbase/gui/glshadersimple.cpp
-	sdrbase/gui/glshadertextured.cpp
+    sdrbase/gui/aboutdialog.cpp
+    sdrbase/gui/addpresetdialog.cpp
+    sdrbase/gui/basicchannelsettingswidget.cpp
+    sdrbase/gui/buttonswitch.cpp
+    sdrbase/gui/channelwindow.cpp
+    sdrbase/gui/colormapper.cpp
+    sdrbase/gui/glscope.cpp
+    sdrbase/gui/glscopegui.cpp
+    sdrbase/gui/glshadersimple.cpp
+    sdrbase/gui/glshadertextured.cpp
     sdrbase/gui/glspectrum.cpp
-	sdrbase/gui/glspectrumgui.cpp
-	sdrbase/gui/indicator.cpp
-	sdrbase/gui/mypositiondialog.cpp
-	sdrbase/gui/pluginsdialog.cpp
-	sdrbase/gui/audiodialog.cpp
-	sdrbase/gui/presetitem.cpp
-	sdrbase/gui/rollupwidget.cpp
-	sdrbase/gui/samplingdevicecontrol.cpp
-	sdrbase/gui/scale.cpp
-	sdrbase/gui/scaleengine.cpp
-	sdrbase/gui/valuedial.cpp
+    sdrbase/gui/glspectrumgui.cpp
+    sdrbase/gui/indicator.cpp
+    sdrbase/gui/mypositiondialog.cpp
+    sdrbase/gui/pluginsdialog.cpp
+    sdrbase/gui/audiodialog.cpp
+    sdrbase/gui/presetitem.cpp
+    sdrbase/gui/rollupwidget.cpp
+    sdrbase/gui/samplingdevicecontrol.cpp
+    sdrbase/gui/scale.cpp
+    sdrbase/gui/scaleengine.cpp
+    sdrbase/gui/valuedial.cpp
 
-	sdrbase/dsp/devicesamplesource.cpp
+    sdrbase/dsp/devicesamplesource.cpp
     sdrbase/dsp/devicesamplesink.cpp
 
-	sdrbase/plugin/pluginapi.cpp
-	#sdrbase/plugin/plugingui.cpp
-	sdrbase/plugin/plugininterface.cpp
-	sdrbase/plugin/pluginmanager.cpp
+    sdrbase/plugin/pluginapi.cpp
+    #sdrbase/plugin/plugingui.cpp
+    sdrbase/plugin/plugininterface.cpp
+    sdrbase/plugin/pluginmanager.cpp
 
-	sdrbase/settings/preferences.cpp
-	sdrbase/settings/preset.cpp
-	sdrbase/settings/mainsettings.cpp
+    sdrbase/settings/preferences.cpp
+    sdrbase/settings/preset.cpp
+    sdrbase/settings/mainsettings.cpp
 
     sdrbase/util/CRC64.cpp
-	sdrbase/util/db.cpp
-	sdrbase/util/message.cpp
-	sdrbase/util/messagequeue.cpp
-	sdrbase/util/prettyprint.cpp
-	sdrbase/util/syncmessenger.cpp
-	sdrbase/util/samplesourceserializer.cpp
-	sdrbase/util/simpleserializer.cpp
-	#sdrbase/util/spinlock.cpp
-	
-	sdrbase/device/devicesourceapi.cpp
+    sdrbase/util/db.cpp
+    sdrbase/util/message.cpp
+    sdrbase/util/messagequeue.cpp
+    sdrbase/util/prettyprint.cpp
+    sdrbase/util/syncmessenger.cpp
+    sdrbase/util/samplesourceserializer.cpp
+    sdrbase/util/simpleserializer.cpp
+    #sdrbase/util/spinlock.cpp
+    
+    sdrbase/device/devicesourceapi.cpp
     sdrbase/device/devicesinkapi.cpp
 )
 
 set(sdrbase_HEADERS
-	sdrbase/mainwindow.h
+    sdrbase/mainwindow.h
 
-	sdrbase/audio/audiodeviceinfo.h
-	sdrbase/audio/audiofifo.h
-	sdrbase/audio/audiooutput.h
+    sdrbase/audio/audiodeviceinfo.h
+    sdrbase/audio/audiofifo.h
+    sdrbase/audio/audiooutput.h
 
-	sdrbase/dsp/afsquelch.h
-	sdrbase/dsp/downchannelizer.h
+    sdrbase/dsp/afsquelch.h
+    sdrbase/dsp/downchannelizer.h
     sdrbase/dsp/upchannelizer.h
-	sdrbase/dsp/channelmarker.h
-	sdrbase/dsp/complex.h
-	sdrbase/dsp/decimators.h
-	sdrbase/dsp/dspcommands.h
-	sdrbase/dsp/dspengine.h
-	sdrbase/dsp/dspdevicesourceengine.h
+    sdrbase/dsp/channelmarker.h
+    sdrbase/dsp/complex.h
+    sdrbase/dsp/decimators.h
+    sdrbase/dsp/dspcommands.h
+    sdrbase/dsp/dspengine.h
+    sdrbase/dsp/dspdevicesourceengine.h
     sdrbase/dsp/dspdevicesinkengine.h
-	sdrbase/dsp/dsptypes.h
-	sdrbase/dsp/fftengine.h
-	sdrbase/dsp/fftfilt.h
-	sdrbase/dsp/fftwengine.h
-	sdrbase/dsp/fftwindow.h
-	sdrbase/dsp/filterrc.h
-	sdrbase/dsp/filtermbe.h
-	sdrbase/dsp/filerecord.h
-	sdrbase/dsp/gfft.h
-	sdrbase/dsp/interpolator.h
-	sdrbase/dsp/inthalfbandfilter.h
-	sdrbase/dsp/kissfft.h
-	sdrbase/dsp/kissengine.h
-	sdrbase/dsp/lowpass.h
-	sdrbase/dsp/misc.h
-	sdrbase/dsp/movingaverage.h
-	sdrbase/dsp/nco.h
-	sdrbase/dsp/phasediscri.h
-	sdrbase/dsp/phaselock.h
+    sdrbase/dsp/dsptypes.h
+    sdrbase/dsp/fftengine.h
+    sdrbase/dsp/fftfilt.h
+    sdrbase/dsp/fftwengine.h
+    sdrbase/dsp/fftwindow.h
+    sdrbase/dsp/filterrc.h
+    sdrbase/dsp/filtermbe.h
+    sdrbase/dsp/filerecord.h
+    sdrbase/dsp/gfft.h
+    sdrbase/dsp/interpolator.h
+    sdrbase/dsp/inthalfbandfilter.h
+    sdrbase/dsp/kissfft.h
+    sdrbase/dsp/kissengine.h
+    sdrbase/dsp/lowpass.h
+    sdrbase/dsp/misc.h
+    sdrbase/dsp/movingaverage.h
+    sdrbase/dsp/nco.h
+    sdrbase/dsp/phasediscri.h
+    sdrbase/dsp/phaselock.h
     sdrbase/dsp/pidcontroller.h
-	sdrbase/dsp/samplesinkfifo.h
+    sdrbase/dsp/samplesinkfifo.h
     sdrbase/dsp/samplesourcefifo.h
     sdrbase/dsp/samplesinkfifodoublebuffered.h
     sdrbase/dsp/samplesinkfifodecimator.h
-	sdrbase/dsp/basebandsamplesink.h
+    sdrbase/dsp/basebandsamplesink.h
     sdrbase/dsp/basebandsamplesource.h
-	sdrbase/dsp/nullsink.h
-	sdrbase/dsp/scopevis.h
-	sdrbase/dsp/spectrumvis.h
-	sdrbase/dsp/threadedbasebandsamplesink.h
+    sdrbase/dsp/nullsink.h
+    sdrbase/dsp/scopevis.h
+    sdrbase/dsp/spectrumvis.h
+    sdrbase/dsp/threadedbasebandsamplesink.h
     sdrbase/dsp/threadedbasebandsamplesource.h
 
-	sdrbase/gui/aboutdialog.h
-	sdrbase/gui/addpresetdialog.h
-	sdrbase/gui/basicchannelsettingswidget.h
-	sdrbase/gui/buttonswitch.h
-	sdrbase/gui/channelwindow.h
-	sdrbase/gui/colormapper.h
-	sdrbase/gui/glscope.h
-	sdrbase/gui/glscopegui.h
-	sdrbase/gui/glshadersimple.h
-	sdrbase/gui/glshadertextured.h
+    sdrbase/gui/aboutdialog.h
+    sdrbase/gui/addpresetdialog.h
+    sdrbase/gui/basicchannelsettingswidget.h
+    sdrbase/gui/buttonswitch.h
+    sdrbase/gui/channelwindow.h
+    sdrbase/gui/colormapper.h
+    sdrbase/gui/glscope.h
+    sdrbase/gui/glscopegui.h
+    sdrbase/gui/glshadersimple.h
+    sdrbase/gui/glshadertextured.h
     sdrbase/gui/glspectrum.h
-	sdrbase/gui/glspectrumgui.h
-	sdrbase/gui/indicator.h
-	sdrbase/gui/mypositiondialog.h
-	sdrbase/gui/physicalunit.h
-	sdrbase/gui/pluginsdialog.h
-	sdrbase/gui/audiodialog.h
-	sdrbase/gui/presetitem.h
-	sdrbase/gui/rollupwidget.h
-	sdrbase/gui/samplingdevicecontrol.h
-	sdrbase/gui/scale.h
-	sdrbase/gui/scaleengine.h
-	sdrbase/gui/valuedial.h
+    sdrbase/gui/glspectrumgui.h
+    sdrbase/gui/indicator.h
+    sdrbase/gui/mypositiondialog.h
+    sdrbase/gui/physicalunit.h
+    sdrbase/gui/pluginsdialog.h
+    sdrbase/gui/audiodialog.h
+    sdrbase/gui/presetitem.h
+    sdrbase/gui/rollupwidget.h
+    sdrbase/gui/samplingdevicecontrol.h
+    sdrbase/gui/scale.h
+    sdrbase/gui/scaleengine.h
+    sdrbase/gui/valuedial.h
 
-	sdrbase/dsp/devicesamplesource.h
+    sdrbase/dsp/devicesamplesource.h
     sdrbase/dsp/devicesamplesink.h
 
-	sdrbase/plugin/pluginapi.h
-	sdrbase/plugin/plugingui.h
-	sdrbase/plugin/plugininterface.h
-	sdrbase/plugin/pluginmanager.h
+    sdrbase/plugin/pluginapi.h
+    sdrbase/plugin/plugingui.h
+    sdrbase/plugin/plugininterface.h
+    sdrbase/plugin/pluginmanager.h
 
-	sdrbase/settings/preferences.h
-	sdrbase/settings/preset.h
-	sdrbase/settings/mainsettings.h
+    sdrbase/settings/preferences.h
+    sdrbase/settings/preset.h
+    sdrbase/settings/mainsettings.h
 
-	sdrbase/util/CRC64.h
+    sdrbase/util/CRC64.h
     sdrbase/util/db.h
-	sdrbase/util/export.h
-	sdrbase/util/message.h
-	sdrbase/util/messagequeue.h
-	sdrbase/util/movingaverage.h
-	sdrbase/util/prettyprint.h
-	sdrbase/util/syncmessenger.h
-	sdrbase/util/samplesourceserializer.h
-	sdrbase/util/simpleserializer.h
-	#sdrbase/util/spinlock.h
-	
-	sdrbase/device/devicesourceapi.h
+    sdrbase/util/export.h
+    sdrbase/util/message.h
+    sdrbase/util/messagequeue.h
+    sdrbase/util/movingaverage.h
+    sdrbase/util/prettyprint.h
+    sdrbase/util/syncmessenger.h
+    sdrbase/util/samplesourceserializer.h
+    sdrbase/util/simpleserializer.h
+    #sdrbase/util/spinlock.h
+    
+    sdrbase/device/devicesourceapi.h
     sdrbase/device/devicesinkapi.h
 )
 
 set(sdrbase_SOURCES
-	${sdrbase_SOURCES}
-	${sdrbase_HEADERS}
+    ${sdrbase_SOURCES}
+    ${sdrbase_HEADERS}
 )
 
 set(sdrbase_FORMS
-	sdrbase/mainwindow.ui
+    sdrbase/mainwindow.ui
 
-	sdrbase/gui/aboutdialog.ui
-	sdrbase/gui/addpresetdialog.ui
-	sdrbase/gui/basicchannelsettingswidget.ui
-	sdrbase/gui/glscopegui.ui
-	sdrbase/gui/glspectrumgui.ui
-	sdrbase/gui/pluginsdialog.ui
-	sdrbase/gui/audiodialog.ui
-	sdrbase/gui/samplingdevicecontrol.ui
-	sdrbase/gui/myposdialog.ui
+    sdrbase/gui/aboutdialog.ui
+    sdrbase/gui/addpresetdialog.ui
+    sdrbase/gui/basicchannelsettingswidget.ui
+    sdrbase/gui/glscopegui.ui
+    sdrbase/gui/glspectrumgui.ui
+    sdrbase/gui/pluginsdialog.ui
+    sdrbase/gui/audiodialog.ui
+    sdrbase/gui/samplingdevicecontrol.ui
+    sdrbase/gui/myposdialog.ui
 )
 
 set(sdrbase_RESOURCES
-	sdrbase/resources/res.qrc
+    sdrbase/resources/res.qrc
 )
 
 if(FFTW3F_FOUND)
-	set(sdrbase_SOURCES
-		${sdrbase_SOURCES}
-		sdrbase/dsp/fftwengine.cpp
-	)
-	set(sdrbase_HEADERS
-		${sdrbase_HEADERS}
-		sdrbase/dsp/fftwengine.h
-	)
-	add_definitions(-DUSE_FFTW)
-	include_directories(${FFTW3F_INCLUDE_DIRS})
+    set(sdrbase_SOURCES
+        ${sdrbase_SOURCES}
+        sdrbase/dsp/fftwengine.cpp
+    )
+    set(sdrbase_HEADERS
+        ${sdrbase_HEADERS}
+        sdrbase/dsp/fftwengine.h
+    )
+    add_definitions(-DUSE_FFTW)
+    include_directories(${FFTW3F_INCLUDE_DIRS})
 else(FFTW3F_FOUND)
-	set(sdrbase_SOURCES
-		${sdrbase_SOURCES}
-		sdrbase/dsp/kissengine.cpp
-		sdrbase/dsp/kissfft.h
-	)
-	set(sdrbase_HEADERS
-		${sdrbase_HEADERS}
-		sdrbase/dsp/kissengine.h
-	)
-	add_definitions(-DUSE_KISSFFT)
+    set(sdrbase_SOURCES
+        ${sdrbase_SOURCES}
+        sdrbase/dsp/kissengine.cpp
+        sdrbase/dsp/kissfft.h
+    )
+    set(sdrbase_HEADERS
+        ${sdrbase_HEADERS}
+        sdrbase/dsp/kissengine.h
+    )
+    add_definitions(-DUSE_KISSFFT)
 endif(FFTW3F_FOUND)
 
 if (LIBSERIALDV_FOUND)
@@ -340,6 +346,21 @@ if (LIBSERIALDV_FOUND)
     include_directories(${LIBSERIALDV_INCLUDE_DIR})
 endif(LIBSERIALDV_FOUND)
 
+if (BUILD_DEBIAN)
+    set(sdrbase_SOURCES
+        ${sdrbase_SOURCES}
+        sdrbase/dsp/dvserialworker.cpp
+        sdrbase/dsp/dvserialengine.cpp
+    )
+    set(sdrbase_HEADERS
+        ${sdrbase_HEADERS}
+        sdrbase/dsp/dvserialworker.h
+        sdrbase/dsp/dvserialengine.h
+    )
+    add_definitions(-DDSD_USE_SERIALDV)
+    include_directories(${LIBSERIALDVSRC})
+endif (BUILD_DEBIAN)
+
 #include(${QT_USE_FILE})
 add_definitions(${QT_DEFINITIONS})
 
@@ -348,92 +369,106 @@ qt5_wrap_ui(sdrbase_FORMS_HEADERS ${sdrbase_FORMS})
 qt5_add_resources(sdrbase_RESOURCES_RCC ${sdrbase_RESOURCES})
 
 if(WIN32)
-	SET(sdrbase_SOURCES ${sdrbase_SOURCES} sdrbase/resources/sdrangel.rc)
+    SET(sdrbase_SOURCES ${sdrbase_SOURCES} sdrbase/resources/sdrangel.rc)
 endif(WIN32)
 
 add_library(sdrbase SHARED
-	${sdrbase_SOURCES}
-	${sdrbase_HEADERS_MOC}
-	${sdrbase_FORMS_HEADERS}
-	${sdrbase_RESOURCES_RCC}
+    ${sdrbase_SOURCES}
+    ${sdrbase_HEADERS_MOC}
+    ${sdrbase_FORMS_HEADERS}
+    ${sdrbase_RESOURCES_RCC}
 )
 
 target_link_libraries(sdrbase
-	${QT_LIBRARIES}
-	${OPENGL_LIBRARIES}
+    ${QT_LIBRARIES}
+    ${OPENGL_LIBRARIES}
 )
 
 if(FFTW3F_FOUND)
-	target_link_libraries(sdrbase ${FFTW3F_LIBRARIES})
+    target_link_libraries(sdrbase ${FFTW3F_LIBRARIES})
 endif(FFTW3F_FOUND)
 
 if(LIBSERIALDV_FOUND)
     target_link_libraries(sdrbase ${LIBSERIALDV_LIBRARY})
 endif(LIBSERIALDV_FOUND)
 
+if (BUILD_DEBIAN)
+    target_link_libraries(sdrbase serialdv)
+endif (BUILD_DEBIAN)
+
 set_target_properties(sdrbase PROPERTIES DEFINE_SYMBOL "sdrangel_EXPORTS")
 target_compile_features(sdrbase PRIVATE cxx_generalized_initializers) # cmake >= 3.1.0
 
 qt5_use_modules(sdrbase Core Widgets OpenGL Multimedia)
 
 include_directories(
-	${CMAKE_CURRENT_BINARY_DIR}
-	${CMAKE_SOURCE_DIR}/sdrbase
-	${OPENGL_INCLUDE_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_SOURCE_DIR}/sdrbase
+    ${OPENGL_INCLUDE_DIR}
 )
 
 if(USE_SIMD MATCHES SSE2)
-	if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
-		set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2" )
-		set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse2" )
-		add_definitions(-DUSE_SIMD)
-	elseif(MSVC)
-		set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
-		set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
-		set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
-		add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
-		add_definitions(-DUSE_SIMD)
-	endif()
+    if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
+        set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2" )
+        set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse2" )
+        add_definitions(-DUSE_SIMD)
+    elseif(MSVC)
+        set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
+        set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
+        set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+        add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+        add_definitions(-DUSE_SIMD)
+    endif()
 endif()
 
 ##############################################################################
 
 set(sdrangel_SOURCES
-	app/main.cpp
+    app/main.cpp
 )
 
 if(WIN32)
-	SET(sdrangel_SOURCES ${sdrangel_SOURCES} sdrbase/resources/sdrangel.rc)
+    SET(sdrangel_SOURCES ${sdrangel_SOURCES} sdrbase/resources/sdrangel.rc)
 endif(WIN32)
 
 add_executable(sdrangel
-	${sdrangel_SOURCES}
+    ${sdrangel_SOURCES}
 )
 
 target_link_libraries(sdrangel
-	sdrbase
-	${QT_LIBRARIES}
-	${OPENGL_LIBRARIES}
+    sdrbase
+    ${QT_LIBRARIES}
+    ${OPENGL_LIBRARIES}
 )
 
 if(WIN32)
-	set_target_properties(sdrangel PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
-	set_target_properties(sdrangel PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
-	set_target_properties(sdrangel PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
-	set_target_properties(sdrangel PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE")
-	set_target_properties(sdrangel PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
-	set_target_properties(sdrangel PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
+    set_target_properties(sdrangel PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
+    set_target_properties(sdrangel PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
+    set_target_properties(sdrangel PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
+    set_target_properties(sdrangel PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE")
+    set_target_properties(sdrangel PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
+    set_target_properties(sdrangel PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
 endif(WIN32)
 
 qt5_use_modules(sdrangel Widgets Multimedia)
 
 ##############################################################################
 
+if (BUILD_DEBIAN)
+    add_subdirectory(cm256cc)
+    add_subdirectory(mbelib)
+    add_subdirectory(serialdv)
+    add_subdirectory(dsdcc)
+    add_subdirectory(libairspy)
+    add_subdirectory(libhackrf)
+    add_subdirectory(librtlsdr)
+endif (BUILD_DEBIAN)
+
 add_subdirectory(plugins)
 
 if(LIBUSB_FOUND AND UNIX)
-	add_subdirectory(fcdhid)
-	add_subdirectory(fcdlib)
+    add_subdirectory(fcdhid)
+    add_subdirectory(fcdlib)
 endif(LIBUSB_FOUND AND UNIX)
 
 ##############################################################################
diff --git a/cm256cc/CMakeLists.txt b/cm256cc/CMakeLists.txt
new file mode 100644
index 000000000..8a4a5feef
--- /dev/null
+++ b/cm256cc/CMakeLists.txt
@@ -0,0 +1,67 @@
+project(cm256cc)
+
+set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11" )
+set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11" )
+add_definitions(-DNO_RESTRICT)
+
+EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
+message( STATUS "Architecture: ${ARCHITECTURE}" )
+
+if(${ARCHITECTURE} MATCHES "x86_64|AMD64|x86")
+    SET(USE_SIMD "SSSE3" CACHE STRING "Use SIMD SSSE3 instructions")
+elseif(${ARCHITECTURE} MATCHES "armv7l")
+    SET(USE_SIMD "NEON" CACHE STRING "Use SIMD NEON instructions")
+endif()
+
+if(USE_SIMD MATCHES SSSE3)
+    if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
+        set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mssse3" )
+        set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mssse3" )
+        message(STATUS "g++ SSSE3")
+        add_definitions(-DUSE_SIMD)
+    elseif(MSVC)
+        set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
+        set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
+        set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
+        message(STATUS "MSVC SSSE3")
+        add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
+        add_definitions(-DUSE_SIMD)
+    endif()
+elseif(USE_SIMD MATCHES NEON)
+    if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
+        set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpu=neon" )
+        set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mfpu=neon" )
+        message(STATUS "g++ NEON")
+        add_definitions(-DUSE_NEON)
+    endif()
+else()
+    message(STATUS "Unsupported architecture")
+    return()
+endif()
+
+set(cm256cc_SOURCES
+    ${LIBCM256CCSRC}/gf256.cpp
+    ${LIBCM256CCSRC}/cm256.cpp
+)
+
+set(cm256cc_HEADERS
+    ${LIBCM256CCSRC}/gf256.h
+    ${LIBCM256CCSRC}/cm256.h
+)
+
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBCM256CCSRC}
+)
+
+add_definitions(-DQT_SHARED)
+
+add_library(cm256cc SHARED
+    ${cm256cc_SOURCES}
+)
+
+target_link_libraries(cm256cc
+)
+
+install(TARGETS cm256cc DESTINATION lib)
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 000000000..3902d5873
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,6 @@
+sdrangel for Debian
+------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- F4EXB <f4exb06@gmail.com>  Tue, 25 Oct 2016 11:15:15 +0200
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 000000000..5a6ac0a64
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,10 @@
+sdrangel for Debian
+------------------
+
+<this file describes information about the source package, see Debian policy
+manual section 4.14. You WILL either need to modify or delete this file>
+
+
+
+ -- F4EXB <f4exb06@gmail.com>  Tue, 25 Oct 2016 11:15:15 +0200
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 000000000..2b0e31eab
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,6 @@
+sdrangel (2.2.0-1) unstable; urgency=medium
+
+  * Initial release as a Debian package
+  * Embryonic Tx support (phase 1)
+
+ -- Edouard Griffiths, F4EXB <f4exb06@gmail.com>  Tue, 24 Oct 2016 23:15:15 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 000000000..ec635144f
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 000000000..75668e9e5
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,24 @@
+Source: sdrangel
+Section: hamradio
+Priority: optional
+Maintainer: Edouard Griffiths, F4EXB <f4exb06@gmail.com>
+Build-Depends: debhelper (>=9)
+Standards-Version: 3.9.6
+Homepage: https://github.com/f4exb/sdrangel
+#Vcs-Git: git://anonscm.debian.org/collab-maint/sdrangel.git
+#Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/sdrangel.git
+
+Package: sdrangel
+Architecture: any
+Depends: libc6, libasound2, libfftw3-single3, libgcc1, libgl1-mesa-glx, libglu1-mesa, liblz4-1, libnanomsg0, libqt5core5a, libqt5gui5, libqt5multimedia5, libqt5network5, libqt5opengl5, libqt5widgets5, libstdc++6, libusb-1.0-0, ${shlibs:Depends}, ${misc:Depends}
+Description: SDR/Analyzer/Generator front-end for various hardware
+ SDR/Analyzer/Generator front-end for Airspy, BladeRF (Rx), HackRF (Rx), RTL-SDR and FunCube. 
+ Also File source and sink for I/Q samples, network I/Q sources with SDRDaemon.
+ Based on Qt5 framework and OpenGL for the spectrum and scope rendering.
+ Builds on Linux, Windows and Mac O/S
+ Reception modes supported: 
+   Analog: AM, NFM, WFM, SSB, broadcast FM
+   Digital: D-Star, Yaesu SF, DMR, dPMR, LoRa
+   Analyzer: Generic channel
+ Transmission modes supported:
+   Analog: AM
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 000000000..df75fd247
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,33 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: sdrangel
+Source: https://github.com/f4exb/sdrangel
+
+Files: *
+Copyright: 2015-2016 Edouard Griffiths, <f4exb06@gmail.com>
+License: GPL-3.0+
+
+Files: debian/*
+Copyright: 2016 Edouard Griffiths, F4EXB <f4exb06@gmail.com>
+License: GPL-3.0+
+
+License: GPL-3.0+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
+# Please avoid picking licenses with terms that are more restrictive than the
+# packaged work, as it may make Debian's contributions unacceptable upstream.
diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp
new file mode 100644
index 000000000..baa0b3599
--- /dev/null
+++ b/debian/debhelper-build-stamp
@@ -0,0 +1,2 @@
+sdrangel
+sdrangel
diff --git a/debian/init.d.ex b/debian/init.d.ex
new file mode 100644
index 000000000..6798489c5
--- /dev/null
+++ b/debian/init.d.ex
@@ -0,0 +1,26 @@
+#!/bin/sh
+# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
+if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
+    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
+fi
+### BEGIN INIT INFO
+# Provides:          sdrangel
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: <Enter a short description of the software>
+# Description:       <Enter a long description of the software>
+#                    <...>
+#                    <...>
+### END INIT INFO
+
+# Author: F4EXB <f4exb06@gmail.com>
+
+DESC="sdrangel"
+DAEMON=/usr/bin/sdrangel
+
+# This is an example to start a single forking daemon capable of writing
+# a pid file. To get other behaviors, implement do_start(), do_stop() or
+# other functions to override the defaults in /lib/init/init-d-script.
+# See also init-d-script(5)
diff --git a/debian/manpage.1.ex b/debian/manpage.1.ex
new file mode 100644
index 000000000..7eb695cfd
--- /dev/null
+++ b/debian/manpage.1.ex
@@ -0,0 +1,56 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" (C) Copyright 2016 F4EXB <f4exb06@gmail.com>,
+.\"
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH Sdrangel SECTION "October 25 2016"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+sdrangel \- program to do something
+.SH SYNOPSIS
+.B sdrangel
+.RI [ options ] " files" ...
+.br
+.B bar
+.RI [ options ] " files" ...
+.SH DESCRIPTION
+This manual page documents briefly the
+.B sdrangel
+and
+.B bar
+commands.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+\fBsdrangel\fP is a program that...
+.SH OPTIONS
+These programs follow the usual GNU command line syntax, with long
+options starting with two dashes (`-').
+A summary of options is included below.
+For a complete description, see the Info files.
+.TP
+.B \-h, \-\-help
+Show summary of options.
+.TP
+.B \-v, \-\-version
+Show version of program.
+.SH SEE ALSO
+.BR bar (1),
+.BR baz (1).
+.br
+The programs are documented fully by
+.IR "The Rise and Fall of a Fooish Bar" ,
+available via the Info system.
diff --git a/debian/manpage.sgml.ex b/debian/manpage.sgml.ex
new file mode 100644
index 000000000..18542f526
--- /dev/null
+++ b/debian/manpage.sgml.ex
@@ -0,0 +1,154 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+
+
+	The docbook-to-man binary is found in the docbook-to-man package.
+	Please remember that if you create the nroff version in one of the
+	debian/rules file targets (such as build), you will need to include
+	docbook-to-man in your Build-Depends control field.
+
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>FIRSTNAME</firstname>">
+  <!ENTITY dhsurname   "<surname>SURNAME</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>October 25 2016</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY dhsection   "<manvolnum>SECTION</manvolnum>">
+  <!ENTITY dhemail     "<email>f4exb06@gmail.com</email>">
+  <!ENTITY dhusername  "F4EXB">
+  <!ENTITY dhucpackage "<refentrytitle>Sdrangel</refentrytitle>">
+  <!ENTITY dhpackage   "sdrangel">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2003</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>program to do something</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+
+      <arg><option>-e <replaceable>this</replaceable></option></arg>
+
+      <arg><option>--example <replaceable>that</replaceable></option></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>&dhpackage;</command> and <command>bar</command>
+      commands.</para>
+
+    <para>This manual page was written for the &debian; distribution
+      because the original program does not have a manual page.
+      Instead, it has documentation in the &gnu;
+      <application>Info</application> format; see below.</para>
+
+    <para><command>&dhpackage;</command> is a program that...</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <para>These programs follow the usual &gnu; command line syntax,
+      with long options starting with two dashes (`-').  A summary of
+      options is included below.  For a complete description, see the
+      <application>Info</application> files.</para>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option>
+        </term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-v</option>
+          <option>--version</option>
+        </term>
+        <listitem>
+          <para>Show version of program.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>bar (1), baz (1).</para>
+
+    <para>The programs are documented fully by <citetitle>The Rise and
+      Fall of a Fooish Bar</citetitle> available via the
+      <application>Info</application> system.</para>
+  </refsect1>
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; &dhemail; for
+      the &debian; system (and may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the &gnu; General Public License, Version 2 any
+      later version published by the Free Software Foundation.
+    </para>
+    <para>
+      On Debian systems, the complete text of the GNU General Public
+      License can be found in /usr/share/common-licenses/GPL.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
diff --git a/debian/manpage.xml.ex b/debian/manpage.xml.ex
new file mode 100644
index 000000000..ce7bb9824
--- /dev/null
+++ b/debian/manpage.xml.ex
@@ -0,0 +1,291 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+
+<!--
+
+`xsltproc -''-nonet \
+          -''-param man.charmap.use.subset "0" \
+          -''-param make.year.ranges "1" \
+          -''-param make.single.year.ranges "1" \
+          /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
+          manpage.xml'
+
+A manual page <package>.<section> will be generated. You may view the
+manual page with: nroff -man <package>.<section> | less'. A typical entry
+in a Makefile or Makefile.am is:
+
+DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl
+XP     = xsltproc -''-nonet -''-param man.charmap.use.subset "0"
+
+manpage.1: manpage.xml
+        $(XP) $(DB2MAN) $<
+
+The xsltproc binary is found in the xsltproc package. The XSL files are in
+docbook-xsl. A description of the parameters you can use can be found in the
+docbook-xsl-doc-* packages. Please remember that if you create the nroff
+version in one of the debian/rules file targets (such as build), you will need
+to include xsltproc and docbook-xsl in your Build-Depends control field.
+Alternatively use the xmlto command/package. That will also automatically
+pull in xsltproc and docbook-xsl.
+
+Notes for using docbook2x: docbook2x-man does not automatically create the
+AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as
+<refsect1> ... </refsect1>.
+
+To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections
+read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be
+found in the docbook-xsl-doc-html package.
+
+Validation can be done using: `xmllint -''-noout -''-valid manpage.xml`
+
+General documentation about man-pages and man-page-formatting:
+man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
+
+-->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "FIRSTNAME">
+  <!ENTITY dhsurname   "SURNAME">
+  <!-- dhusername could also be set to "&dhfirstname; &dhsurname;". -->
+  <!ENTITY dhusername  "F4EXB">
+  <!ENTITY dhemail     "f4exb06@gmail.com">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1) and
+       http://www.tldp.org/HOWTO/Man-Page/q2.html. -->
+  <!ENTITY dhsection   "SECTION">
+  <!-- TITLE should be something like "User commands" or similar (see
+       http://www.tldp.org/HOWTO/Man-Page/q2.html). -->
+  <!ENTITY dhtitle     "sdrangel User Manual">
+  <!ENTITY dhucpackage "Sdrangel">
+  <!ENTITY dhpackage   "sdrangel">
+]>
+
+<refentry>
+  <refentryinfo>
+    <title>&dhtitle;</title>
+    <productname>&dhpackage;</productname>
+    <authorgroup>
+      <author>
+       <firstname>&dhfirstname;</firstname>
+        <surname>&dhsurname;</surname>
+        <contrib>Wrote this manpage for the Debian system.</contrib>
+        <address>
+          <email>&dhemail;</email>
+        </address>
+      </author>
+    </authorgroup>
+    <copyright>
+      <year>2007</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    <legalnotice>
+      <para>This manual page was written for the Debian system
+        (and may be used by others).</para>
+      <para>Permission is granted to copy, distribute and/or modify this
+        document under the terms of the GNU General Public License,
+        Version 2 or (at your option) any later version published by
+        the Free Software Foundation.</para>
+      <para>On Debian systems, the complete text of the GNU General Public
+        License can be found in
+        <filename>/usr/share/common-licenses/GPL</filename>.</para>
+    </legalnotice>
+  </refentryinfo>
+  <refmeta>
+    <refentrytitle>&dhucpackage;</refentrytitle>
+    <manvolnum>&dhsection;</manvolnum>
+  </refmeta>
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+    <refpurpose>program to do something</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+      <!-- These are several examples, how syntaxes could look -->
+      <arg choice="plain"><option>-e <replaceable>this</replaceable></option></arg>
+      <arg choice="opt"><option>--example=<parameter>that</parameter></option></arg>
+      <arg choice="opt">
+        <group choice="req">
+          <arg choice="plain"><option>-e</option></arg>
+          <arg choice="plain"><option>--example</option></arg>
+        </group>
+        <replaceable class="option">this</replaceable>
+      </arg>
+      <arg choice="opt">
+        <group choice="req">
+          <arg choice="plain"><option>-e</option></arg>
+          <arg choice="plain"><option>--example</option></arg>
+        </group>
+        <group choice="req">
+          <arg choice="plain"><replaceable>this</replaceable></arg>
+          <arg choice="plain"><replaceable>that</replaceable></arg>
+        </group>
+      </arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+      <!-- Normally the help and version options make the programs stop
+           right after outputting the requested information. -->
+      <group choice="opt">
+        <arg choice="plain">
+          <group choice="req">
+            <arg choice="plain"><option>-h</option></arg>
+            <arg choice="plain"><option>--help</option></arg>
+          </group>
+        </arg>
+        <arg choice="plain">
+          <group choice="req">
+            <arg choice="plain"><option>-v</option></arg>
+            <arg choice="plain"><option>--version</option></arg>
+          </group>
+        </arg>
+      </group>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="description">
+    <title>DESCRIPTION</title>
+    <para>This manual page documents briefly the
+      <command>&dhpackage;</command> and <command>bar</command>
+      commands.</para>
+    <para>This manual page was written for the Debian distribution
+      because the original program does not have a manual page.
+      Instead, it has documentation in the GNU <citerefentry>
+        <refentrytitle>info</refentrytitle>
+        <manvolnum>1</manvolnum>
+      </citerefentry> format; see below.</para>
+    <para><command>&dhpackage;</command> is a program that...</para>
+  </refsect1>
+  <refsect1 id="options">
+    <title>OPTIONS</title>
+    <para>The program follows the usual GNU command line syntax,
+      with long options starting with two dashes (`-').  A summary of
+      options is included below.  For a complete description, see the
+      <citerefentry>
+        <refentrytitle>info</refentrytitle>
+        <manvolnum>1</manvolnum>
+      </citerefentry> files.</para>
+    <variablelist>
+      <!-- Use the variablelist.term.separator and the
+           variablelist.term.break.after parameters to
+           control the term elements. -->
+      <varlistentry>
+        <term><option>-e <replaceable>this</replaceable></option></term>
+        <term><option>--example=<replaceable>that</replaceable></option></term>
+        <listitem>
+          <para>Does this and that.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-h</option></term>
+        <term><option>--help</option></term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-v</option></term>
+        <term><option>--version</option></term>
+        <listitem>
+          <para>Show version of program.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1 id="files">
+    <title>FILES</title>
+    <variablelist>
+      <varlistentry>
+        <term><filename>/etc/foo.conf</filename></term>
+        <listitem>
+          <para>The system-wide configuration file to control the
+            behaviour of <application>&dhpackage;</application>. See
+            <citerefentry>
+              <refentrytitle>foo.conf</refentrytitle>
+              <manvolnum>5</manvolnum>
+            </citerefentry> for further details.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><filename>${HOME}/.foo.conf</filename></term>
+        <listitem>
+          <para>The per-user configuration file to control the
+             behaviour of <application>&dhpackage;</application>. See
+             <citerefentry>
+               <refentrytitle>foo.conf</refentrytitle>
+               <manvolnum>5</manvolnum>
+             </citerefentry> for further details.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1 id="environment">
+    <title>ENVIRONMENT</title>
+    <variablelist>
+      <varlistentry>
+        <term><envar>FOO_CONF</envar></term>
+        <listitem>
+          <para>If used, the defined file is used as configuration
+            file (see also <xref linkend="files"/>).</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1 id="diagnostics">
+    <title>DIAGNOSTICS</title>
+    <para>The following diagnostics may be issued
+      on <filename class="devicefile">stderr</filename>:</para>
+    <variablelist>
+      <varlistentry>
+        <term><errortext>Bad configuration file. Exiting.</errortext></term>
+        <listitem>
+          <para>The configuration file seems to contain a broken configuration
+            line. Use the <option>--verbose</option> option, to get more info.
+          </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+    <para><command>&dhpackage;</command> provides some return codes, that can
+      be used in scripts:</para>
+    <segmentedlist>
+      <segtitle>Code</segtitle>
+      <segtitle>Diagnostic</segtitle>
+      <seglistitem>
+        <seg><errorcode>0</errorcode></seg>
+        <seg>Program exited successfully.</seg>
+      </seglistitem>
+      <seglistitem>
+        <seg><errorcode>1</errorcode></seg>
+        <seg>The configuration file seems to be broken.</seg>
+      </seglistitem>
+    </segmentedlist>
+  </refsect1>
+  <refsect1 id="bugs">
+    <!-- Or use this section to tell about upstream BTS. -->
+    <title>BUGS</title>
+    <para>The program is currently limited to only work
+      with the <package>foobar</package> library.</para>
+    <para>The upstreams <acronym>BTS</acronym> can be found
+      at <ulink url="http://bugzilla.foo.tld"/>.</para>
+  </refsect1>
+  <refsect1 id="see_also">
+    <title>SEE ALSO</title>
+    <!-- In alpabetical order. -->
+    <para><citerefentry>
+        <refentrytitle>bar</refentrytitle>
+        <manvolnum>1</manvolnum>
+      </citerefentry>, <citerefentry>
+        <refentrytitle>baz</refentrytitle>
+        <manvolnum>1</manvolnum>
+      </citerefentry>, <citerefentry>
+        <refentrytitle>foo.conf</refentrytitle>
+        <manvolnum>5</manvolnum>
+      </citerefentry></para>
+    <para>The programs are documented fully by <citetitle>The Rise and
+      Fall of a Fooish Bar</citetitle> available via the <citerefentry>
+        <refentrytitle>info</refentrytitle>
+        <manvolnum>1</manvolnum>
+      </citerefentry> system.</para>
+  </refsect1>
+</refentry>
+
diff --git a/debian/menu.ex b/debian/menu.ex
new file mode 100644
index 000000000..323344ff2
--- /dev/null
+++ b/debian/menu.ex
@@ -0,0 +1,2 @@
+?package(sdrangel):needs="X11|text|vc|wm" section="Applications/see-menu-manual"\
+  title="sdrangel" command="/usr/bin/sdrangel"
diff --git a/debian/postinst.ex b/debian/postinst.ex
new file mode 100644
index 000000000..4ad9faf6d
--- /dev/null
+++ b/debian/postinst.ex
@@ -0,0 +1,39 @@
+#!/bin/sh
+# postinst script for sdrangel
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/postrm.ex b/debian/postrm.ex
new file mode 100644
index 000000000..308d92fff
--- /dev/null
+++ b/debian/postrm.ex
@@ -0,0 +1,37 @@
+#!/bin/sh
+# postrm script for sdrangel
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/preinst.ex b/debian/preinst.ex
new file mode 100644
index 000000000..710319cc1
--- /dev/null
+++ b/debian/preinst.ex
@@ -0,0 +1,35 @@
+#!/bin/sh
+# preinst script for sdrangel
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    install|upgrade)
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/prerm.ex b/debian/prerm.ex
new file mode 100644
index 000000000..3a2361759
--- /dev/null
+++ b/debian/prerm.ex
@@ -0,0 +1,38 @@
+#!/bin/sh
+# prerm script for sdrangel
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 000000000..83c1e2b4f
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,25 @@
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+#export DH_VERBOSE = 1
+
+
+# see FEATURE AREAS in dpkg-buildflags(1)
+#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+# see ENVIRONMENT in dpkg-buildflags(1)
+# package maintainers to append CFLAGS
+#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
+# package maintainers to append LDFLAGS
+#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+
+%:
+	dh $@ --parallel
+
+
+# dh_make generated override targets
+# This is example for Cmake (See https://bugs.debian.org/641051 )
+override_dh_auto_configure:
+	dh_auto_configure -- -DCMAKE_INSTALL_PREFIX=/opt/sdrangel -DBUILD_TYPE=DEBIAN -DLIBCM256CCSRC=/z1/development/cm256cc -DLIBDSDCCSRC=/z1/development/dsdcc -DLIBAIRSPYSRC=/z1/development/libairspy/libairspy -DLIBHACKRFSRC=/z1/development/hackrf/host/libhackrf -DLIBRTLSDRSRC=/z1/development/librtlsdr.f4exb -DLIBMBELIBSRC=/z1/development/mbelib -DLIBSERIALDVSRC=/z1/development/serialDV
+#	dh_auto_configure -- -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/sdrangel -DCM256CC_LIBRARIES=/opt/install/cm256cc/lib/libcm256cc.so -DCM256CC_INCLUDE_DIR=/opt/install/cm256cc/include/cm256cc
diff --git a/debian/sdrangel-docs.docs b/debian/sdrangel-docs.docs
new file mode 100644
index 000000000..731904114
--- /dev/null
+++ b/debian/sdrangel-docs.docs
@@ -0,0 +1,2 @@
+README.source
+README.Debian
diff --git a/debian/sdrangel.cron.d.ex b/debian/sdrangel.cron.d.ex
new file mode 100644
index 000000000..907ef16d0
--- /dev/null
+++ b/debian/sdrangel.cron.d.ex
@@ -0,0 +1,4 @@
+#
+# Regular cron jobs for the sdrangel package
+#
+0 4	* * *	root	[ -x /usr/bin/sdrangel_maintenance ] && /usr/bin/sdrangel_maintenance
diff --git a/debian/sdrangel.default.ex b/debian/sdrangel.default.ex
new file mode 100644
index 000000000..934b7c529
--- /dev/null
+++ b/debian/sdrangel.default.ex
@@ -0,0 +1,10 @@
+# Defaults for sdrangel initscript
+# sourced by /etc/init.d/sdrangel
+# installed at /etc/default/sdrangel by the maintainer scripts
+
+#
+# This is a POSIX shell fragment
+#
+
+# Additional options that are passed to the Daemon.
+DAEMON_OPTS=""
diff --git a/debian/sdrangel.doc-base.EX b/debian/sdrangel.doc-base.EX
new file mode 100644
index 000000000..ff3c191c8
--- /dev/null
+++ b/debian/sdrangel.doc-base.EX
@@ -0,0 +1,20 @@
+Document: sdrangel
+Title: Debian sdrangel Manual
+Author: <insert document author here>
+Abstract: This manual describes what sdrangel is
+ and how it can be used to
+ manage online manuals on Debian systems.
+Section: unknown
+
+Format: debiandoc-sgml
+Files: /usr/share/doc/sdrangel/sdrangel.sgml.gz
+
+Format: postscript
+Files: /usr/share/doc/sdrangel/sdrangel.ps.gz
+
+Format: text
+Files: /usr/share/doc/sdrangel/sdrangel.text.gz
+
+Format: HTML
+Index: /usr/share/doc/sdrangel/html/index.html
+Files: /usr/share/doc/sdrangel/html/*.html
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 000000000..163aaf8d8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch.ex b/debian/watch.ex
new file mode 100644
index 000000000..d49d0021a
--- /dev/null
+++ b/debian/watch.ex
@@ -0,0 +1,39 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# See uscan(1) for format
+
+# Compulsory line, this is a version 4 file
+version=4
+
+# PGP signature mangle, so foo.tar.gz has foo.tar.gz.sig
+#opts="pgpsigurlmangle=s%$%.sig%"
+
+# HTTP site (basic)
+#http://example.com/downloads.html \
+#  files/sdrangel-([\d\.]+)\.tar\.gz debian uupdate
+
+# Uncommment to examine a FTP server
+#ftp://ftp.example.com/pub/sdrangel-(.*)\.tar\.gz debian uupdate
+
+# SourceForge hosted projects
+# http://sf.net/sdrangel/ sdrangel-(.*)\.tar\.gz debian uupdate
+
+# GitHub hosted projects
+#opts="filenamemangle="s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%<project>-$1.tar.gz%" \
+#   https://github.com/<user>/sdrangel/tags \
+#   (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate
+
+# PyPI
+# https://pypi.python.org/packages/source/<initial>/sdrangel/ \
+#   sdrangel-(.+)\.tar\.gz debian uupdate
+
+# Direct Git
+# opts="mode=git" http://git.example.com/sdrangel.git \
+#   refs/tags/v([\d\.]+) debian uupdate
+
+
+
+
+# Uncomment to find new files on GooglePages
+# http://example.googlepages.com/foo.html sdrangel-(.*)\.tar\.gz
diff --git a/dsdcc/CMakeLists.txt b/dsdcc/CMakeLists.txt
new file mode 100644
index 000000000..ef6e8fab1
--- /dev/null
+++ b/dsdcc/CMakeLists.txt
@@ -0,0 +1,74 @@
+project(dsdcc)
+
+set(dsdcc_SOURCES
+    ${LIBDSDCCSRC}/descramble.cpp
+    ${LIBDSDCCSRC}/dmr.cpp
+    ${LIBDSDCCSRC}/dsd_decoder.cpp
+    ${LIBDSDCCSRC}/dsd_filters.cpp
+    ${LIBDSDCCSRC}/dsd_logger.cpp
+    ${LIBDSDCCSRC}/dsd_mbe.cpp
+    ${LIBDSDCCSRC}/dsd_opts.cpp
+    ${LIBDSDCCSRC}/dsd_state.cpp
+    ${LIBDSDCCSRC}/dsd_symbol.cpp
+    ${LIBDSDCCSRC}/dstar.cpp
+    ${LIBDSDCCSRC}/ysf.cpp
+    ${LIBDSDCCSRC}/nxdn.cpp
+    ${LIBDSDCCSRC}/dpmr.cpp
+    ${LIBDSDCCSRC}/p25p1_heuristics.cpp
+    ${LIBDSDCCSRC}/fec.cpp
+    ${LIBDSDCCSRC}/crc.cpp
+    ${LIBDSDCCSRC}/viterbi.cpp
+    ${LIBDSDCCSRC}/viterbi3.cpp
+    ${LIBDSDCCSRC}/viterbi5.cpp
+    ${LIBDSDCCSRC}/pn.cpp
+    ${LIBDSDCCSRC}/mbefec.cpp
+    ${LIBDSDCCSRC}/locator.cpp
+)
+
+set(dsdcc_HEADERS
+    ${LIBDSDCCSRC}/descramble.h
+    ${LIBDSDCCSRC}/dmr.h
+    ${LIBDSDCCSRC}/dsd_decoder.h
+    ${LIBDSDCCSRC}/dsd_filters.h
+    ${LIBDSDCCSRC}/dsd_logger.h
+    ${LIBDSDCCSRC}/dsd_mbe.h
+    ${LIBDSDCCSRC}/dsd_opts.h
+    ${LIBDSDCCSRC}/dsd_state.h
+    ${LIBDSDCCSRC}/dsd_symbol.h
+    ${LIBDSDCCSRC}/dstar.h
+    ${LIBDSDCCSRC}/ysf.h
+    ${LIBDSDCCSRC}/nxdn.h
+    ${LIBDSDCCSRC}/dpmr.h
+    ${LIBDSDCCSRC}/p25p1_heuristics.h
+    ${LIBDSDCCSRC}/runningmaxmin.h
+    ${LIBDSDCCSRC}/doublebuffer.h
+    ${LIBDSDCCSRC}/fec.h
+    ${LIBDSDCCSRC}/crc.h
+    ${LIBDSDCCSRC}/viterbi.h
+    ${LIBDSDCCSRC}/viterbi3.h
+    ${LIBDSDCCSRC}/viterbi5.h
+    ${LIBDSDCCSRC}/pn.h
+    ${LIBDSDCCSRC}/mbefec.h
+    ${LIBDSDCCSRC}/locator.h    
+)
+
+add_definitions(-DDSD_USE_MBELIB)
+
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBDSDCCSRC}
+    ${LIBMBELIBSRC}
+)
+
+add_definitions(-DQT_SHARED)
+
+add_library(dsdcc SHARED
+    ${dsdcc_SOURCES}
+)
+
+target_link_libraries(dsdcc
+    mbelib
+)
+
+install(TARGETS dsdcc DESTINATION lib)
diff --git a/libairspy/CMakeLists.txt b/libairspy/CMakeLists.txt
new file mode 100644
index 000000000..5c5309be4
--- /dev/null
+++ b/libairspy/CMakeLists.txt
@@ -0,0 +1,36 @@
+project(airspy)
+
+find_package(LibUSB)
+
+set(airspy_SOURCES
+    ${LIBAIRSPYSRC}/src/airspy.c
+    ${LIBAIRSPYSRC}/src/iqconverter_float.c
+    ${LIBAIRSPYSRC}/src/iqconverter_int16.c
+)
+
+set(airspy_HEADERS
+    ${LIBAIRSPYSRC}/src/airspy.h
+    ${LIBAIRSPYSRC}/src/airspy_commands.h
+    ${LIBAIRSPYSRC}/src/iqconverter_float.h
+    ${LIBAIRSPYSRC}/src/iqconverter_int16.h
+    ${LIBAIRSPYSRC}/src/filters.h
+)
+
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBUSB_INCLUDE_DIR}    
+    ${LIBAIRSPYSRC}/src
+)
+
+add_definitions(-DQT_SHARED)
+
+add_library(airspy SHARED
+    ${airspy_SOURCES}
+)
+
+target_link_libraries(airspy
+    ${LIBUSB_LIBRARIES}
+)
+
+install(TARGETS airspy DESTINATION lib)
diff --git a/libhackrf/CMakeLists.txt b/libhackrf/CMakeLists.txt
new file mode 100644
index 000000000..468f32f6d
--- /dev/null
+++ b/libhackrf/CMakeLists.txt
@@ -0,0 +1,30 @@
+project(hackrf)
+
+find_package(LibUSB)
+
+set(hackrf_SOURCES
+    ${LIBHACKRFSRC}/src/hackrf.c
+)
+
+set(hackrf_HEADERS
+    ${LIBHACKRFSRC}/src/hackrf.h
+)
+
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBUSB_INCLUDE_DIR}    
+    ${LIBHACKRFSRC}/src
+)
+
+add_definitions(-DQT_SHARED)
+
+add_library(hackrf SHARED
+    ${hackrf_SOURCES}
+)
+
+target_link_libraries(hackrf
+    ${LIBUSB_LIBRARIES}
+)
+
+install(TARGETS hackrf DESTINATION lib)
diff --git a/librtlsdr/CMakeLists.txt b/librtlsdr/CMakeLists.txt
new file mode 100644
index 000000000..f41b6a785
--- /dev/null
+++ b/librtlsdr/CMakeLists.txt
@@ -0,0 +1,39 @@
+project(rtlsdr)
+
+find_package(LibUSB)
+
+set(rtlsdr_SOURCES
+    ${LIBRTLSDRSRC}/src/librtlsdr.c 
+    ${LIBRTLSDRSRC}/src/tuner_e4k.c 
+    ${LIBRTLSDRSRC}/src/tuner_fc0012.c  
+    ${LIBRTLSDRSRC}/src/tuner_fc0013.c  
+    ${LIBRTLSDRSRC}/src/tuner_fc2580.c  
+    ${LIBRTLSDRSRC}/src/tuner_r82xx.c   
+    ${LIBRTLSDRSRC}/src/getopt/getopt.c 
+)
+
+set(rtlsdr_HEADERS
+    ${LIBRTLSDRSRC}/include/rtl-sdr.h   
+    ${LIBRTLSDRSRC}/include/rtl-sdr_export.h    
+    ${LIBRTLSDRSRC}/src/getopt/getopt.h 
+)
+
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBUSB_INCLUDE_DIR}
+    ${LIBRTLSDRSRC}/include
+    ${LIBRTLSDRSRC}/src
+)
+
+add_definitions(-DQT_SHARED)
+
+add_library(rtlsdr SHARED
+    ${rtlsdr_SOURCES}
+)
+
+target_link_libraries(rtlsdr
+    ${LIBUSB_LIBRARIES}
+)
+
+install(TARGETS rtlsdr DESTINATION lib)
diff --git a/mbelib/CMakeLists.txt b/mbelib/CMakeLists.txt
new file mode 100644
index 000000000..a085fa384
--- /dev/null
+++ b/mbelib/CMakeLists.txt
@@ -0,0 +1,36 @@
+project(mbelib)
+
+set(mbelib_SOURCES
+    ${LIBMBELIBSRC}/ambe3600x2400.c
+    ${LIBMBELIBSRC}/ambe3600x2450.c
+    ${LIBMBELIBSRC}/ecc.c
+    ${LIBMBELIBSRC}/imbe7100x4400.c
+    ${LIBMBELIBSRC}/imbe7200x4400.c
+    ${LIBMBELIBSRC}/mbelib.c
+)
+
+set(mbelib_HEADERS
+    ${LIBMBELIBSRC}/ambe3600x2400_const.h
+    ${LIBMBELIBSRC}/ambe3600x2450_const.h
+    ${LIBMBELIBSRC}/ecc_const.h
+    ${LIBMBELIBSRC}/imbe7200x4400_const.h
+    ${LIBMBELIBSRC}/mbelib.h
+    ${LIBMBELIBSRC}/mbelib_const.h
+)
+
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBMBELIBSRC}
+)
+
+add_definitions(-DQT_SHARED)
+
+add_library(mbelib SHARED
+    ${mbelib_SOURCES}
+)
+
+target_link_libraries(mbelib
+)
+
+install(TARGETS mbelib DESTINATION lib)
diff --git a/plugins/channelrx/CMakeLists.txt b/plugins/channelrx/CMakeLists.txt
index 5d866bfa4..6fce4669e 100644
--- a/plugins/channelrx/CMakeLists.txt
+++ b/plugins/channelrx/CMakeLists.txt
@@ -13,3 +13,7 @@ add_subdirectory(chanalyzer)
 if(LIBDSDCC_FOUND AND LIBMBE_FOUND)
     add_subdirectory(demoddsd)
 endif(LIBDSDCC_FOUND AND LIBMBE_FOUND)
+
+if (BUILD_DEBIAN)
+    add_subdirectory(demoddsd)
+endif (BUILD_DEBIAN)
diff --git a/plugins/channelrx/demoddsd/CMakeLists.txt b/plugins/channelrx/demoddsd/CMakeLists.txt
index 6c03e4364..dfa00a545 100644
--- a/plugins/channelrx/demoddsd/CMakeLists.txt
+++ b/plugins/channelrx/demoddsd/CMakeLists.txt
@@ -1,29 +1,38 @@
 project(dsddemod)
 
 set(dsddemod_SOURCES
-	dsddemod.cpp
-	dsddemodgui.cpp
-	dsddemodplugin.cpp
-	dsddecoder.cpp
+    dsddemod.cpp
+    dsddemodgui.cpp
+    dsddemodplugin.cpp
+    dsddecoder.cpp
 )
 
 set(dsddemod_HEADERS
-	dsddemod.h
-	dsddemodgui.h
-	dsddemodplugin.h
-	dsddecoder.h
+    dsddemod.h
+    dsddemodgui.h
+    dsddemodplugin.h
+    dsddecoder.h
 )
 
 set(dsddemod_FORMS
-	dsddemodgui.ui
+    dsddemodgui.ui
 )
 
+if (BUILD_DEBIAN)
 include_directories(
-	.
-	${CMAKE_CURRENT_BINARY_DIR}
-	${LIBDSDCC_INCLUDE_DIR}
-	${LIBMBE_INCLUDE_DIR}
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBDSDCCSRC}
+    ${LIBMBELIBSRC}
 )
+else (BUILD_DEBIAN)
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBDSDCC_INCLUDE_DIR}
+    ${LIBMBE_INCLUDE_DIR}
+)
+endif (BUILD_DEBIAN)
 
 #include(${QT_USE_FILE})
 add_definitions(${QT_DEFINITIONS})
@@ -33,18 +42,28 @@ add_definitions(-DQT_SHARED)
 qt5_wrap_ui(dsddemod_FORMS_HEADERS ${dsddemod_FORMS})
 
 add_library(demoddsd SHARED
-	${dsddemod_SOURCES}
-	${dsddemod_HEADERS_MOC}
-	${dsddemod_FORMS_HEADERS}
+    ${dsddemod_SOURCES}
+    ${dsddemod_HEADERS_MOC}
+    ${dsddemod_FORMS_HEADERS}
 )
 
+if (BUILD_DEBIAN)
 target_link_libraries(demoddsd
-	${QT_LIBRARIES}
-	sdrbase
-	${LIBDSDCC_LIBRARIES}
-	${LIBMBE_LIBRARY}
+    ${QT_LIBRARIES}
+    sdrbase
+    dsdcc
+    mbelib
 )
+else (BUILD_DEBIAN)
+target_link_libraries(demoddsd
+    ${QT_LIBRARIES}
+    sdrbase
+    ${LIBDSDCC_LIBRARIES}
+    ${LIBMBE_LIBRARY}
+)
+endif (BUILD_DEBIAN)
+
 
 qt5_use_modules(demoddsd Core Widgets OpenGL Multimedia)
 
-install(TARGETS demoddsd DESTINATION lib/plugins/channelrx)
\ No newline at end of file
+install(TARGETS demoddsd DESTINATION lib/plugins/channelrx)
diff --git a/plugins/samplesource/airspy/CMakeLists.txt b/plugins/samplesource/airspy/CMakeLists.txt
index 1ba5cf91a..23aa03b63 100644
--- a/plugins/samplesource/airspy/CMakeLists.txt
+++ b/plugins/samplesource/airspy/CMakeLists.txt
@@ -1,30 +1,38 @@
 project(airspy)
 
 set(airspy_SOURCES
-	airspygui.cpp
-	airspyinput.cpp
-	airspyplugin.cpp
-	airspysettings.cpp
-	airspythread.cpp
+    airspygui.cpp
+    airspyinput.cpp
+    airspyplugin.cpp
+    airspysettings.cpp
+    airspythread.cpp
 )
 
 set(airspy_HEADERS
-	airspygui.h
-	airspyinput.h
-	airspyplugin.h
-	airspysettings.h
-	airspythread.h
+    airspygui.h
+    airspyinput.h
+    airspyplugin.h
+    airspysettings.h
+    airspythread.h
 )
 
 set(airspy_FORMS
-	airspygui.ui
+    airspygui.ui
 )
 
+if (BUILD_DEBIAN)
 include_directories(
-	.
-	${CMAKE_CURRENT_BINARY_DIR}
-	${LIBAIRSPY_INCLUDE_DIR}
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBAIRSPYSRC}/src
 )
+else (BUILD_DEBIAN)
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBAIRSPY_INCLUDE_DIR}
+)
+endif (BUILD_DEBIAN)
 
 #include(${QT_USE_FILE})
 #add_definitions(${QT_DEFINITIONS})
@@ -36,16 +44,25 @@ add_definitions(-DQT_SHARED)
 qt5_wrap_ui(airspy_FORMS_HEADERS ${airspy_FORMS})
 
 add_library(inputairspy SHARED
-	${airspy_SOURCES}
-	${airspy_HEADERS_MOC}
-	${airspy_FORMS_HEADERS}
+    ${airspy_SOURCES}
+    ${airspy_HEADERS_MOC}
+    ${airspy_FORMS_HEADERS}
 )
 
+if (BUILD_DEBIAN)
 target_link_libraries(inputairspy
-	${QT_LIBRARIES}
-	${LIBAIRSPY_LIBRARIES}
-	sdrbase
+    ${QT_LIBRARIES}
+    airspy
+    sdrbase
 )
+else (BUILD_DEBIAN)
+target_link_libraries(inputairspy
+    ${QT_LIBRARIES}
+    ${LIBAIRSPY_LIBRARIES}
+    sdrbase
+)
+endif (BUILD_DEBIAN)
+
 
 qt5_use_modules(inputairspy Core Widgets OpenGL Multimedia)
 
diff --git a/plugins/samplesource/hackrf/CMakeLists.txt b/plugins/samplesource/hackrf/CMakeLists.txt
index bc47b71db..ee8880921 100644
--- a/plugins/samplesource/hackrf/CMakeLists.txt
+++ b/plugins/samplesource/hackrf/CMakeLists.txt
@@ -1,30 +1,38 @@
 project(hackrf)
 
 set(hackrf_SOURCES
-	hackrfgui.cpp
-	hackrfinput.cpp
-	hackrfplugin.cpp
-	hackrfsettings.cpp
-	hackrfthread.cpp
+    hackrfgui.cpp
+    hackrfinput.cpp
+    hackrfplugin.cpp
+    hackrfsettings.cpp
+    hackrfthread.cpp
 )
 
 set(hackrf_HEADERS
-	hackrfgui.h
-	hackrfinput.h
-	hackrfplugin.h
-	hackrfsettings.h
-	hackrfthread.h
+    hackrfgui.h
+    hackrfinput.h
+    hackrfplugin.h
+    hackrfsettings.h
+    hackrfthread.h
 )
 
 set(hackrf_FORMS
-	hackrfgui.ui
+    hackrfgui.ui
 )
 
+if (BUILD_DEBIAN)
 include_directories(
         .
-	${CMAKE_CURRENT_BINARY_DIR}
-	${LIBHACKRF_INCLUDE_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBHACKRFSRC}/src
 )
+else (BUILD_DEBIAN)
+include_directories(
+        .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBHACKRF_INCLUDE_DIR}
+)
+endif (BUILD_DEBIAN)
 
 #include(${QT_USE_FILE})
 #add_definitions(${QT_DEFINITIONS})
@@ -36,16 +44,24 @@ add_definitions(-DQT_SHARED)
 qt5_wrap_ui(hackrf_FORMS_HEADERS ${hackrf_FORMS})
 
 add_library(inputhackrf SHARED
-	${hackrf_SOURCES}
-	${hackrf_HEADERS_MOC}
-	${hackrf_FORMS_HEADERS}
+    ${hackrf_SOURCES}
+    ${hackrf_HEADERS_MOC}
+    ${hackrf_FORMS_HEADERS}
 )
 
+if (BUILD_DEBIAN)
 target_link_libraries(inputhackrf
-	${QT_LIBRARIES}
-	${LIBHACKRF_LIBRARIES}
-	sdrbase
+    ${QT_LIBRARIES}
+    ${LIBHACKRF_LIBRARIES}
+    sdrbase
 )
+else (BUILD_DEBIAN)
+target_link_libraries(inputhackrf
+    ${QT_LIBRARIES}
+    hackrf
+    sdrbase
+)
+endif (BUILD_DEBIAN)
 
 qt5_use_modules(inputhackrf Core Widgets OpenGL Multimedia)
 
diff --git a/plugins/samplesource/rtlsdr/CMakeLists.txt b/plugins/samplesource/rtlsdr/CMakeLists.txt
index 13e5fefa9..2c67fd775 100644
--- a/plugins/samplesource/rtlsdr/CMakeLists.txt
+++ b/plugins/samplesource/rtlsdr/CMakeLists.txt
@@ -1,30 +1,39 @@
 project(rtlsdr)
 
 set(rtlsdr_SOURCES
-	rtlsdrgui.cpp
-	rtlsdrinput.cpp
-	rtlsdrplugin.cpp
-	rtlsdrsettings.cpp
-	rtlsdrthread.cpp
+    rtlsdrgui.cpp
+    rtlsdrinput.cpp
+    rtlsdrplugin.cpp
+    rtlsdrsettings.cpp
+    rtlsdrthread.cpp
 )
 
 set(rtlsdr_HEADERS
-	rtlsdrgui.h
-	rtlsdrinput.h
-	rtlsdrplugin.h
-	rtlsdrsettings.h
-	rtlsdrthread.h
+    rtlsdrgui.h
+    rtlsdrinput.h
+    rtlsdrplugin.h
+    rtlsdrsettings.h
+    rtlsdrthread.h
 )
 
 set(rtlsdr_FORMS
-	rtlsdrgui.ui
+    rtlsdrgui.ui
 )
 
+if (BUILD_DEBIAN)
 include_directories(
-	.
-	${CMAKE_CURRENT_BINARY_DIR}
-	${LIBRTLSDR_INCLUDE_DIR}
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBRTLSDRSRC}/include
+    ${LIBRTLSDRSRC}/src
 )
+else (BUILD_DEBIAN)
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBRTLSDR_INCLUDE_DIR}
+)
+endif (BUILD_DEBIAN)
 
 #include(${QT_USE_FILE})
 add_definitions(${QT_DEFINITIONS})
@@ -35,16 +44,25 @@ add_definitions(-DQT_SHARED)
 qt5_wrap_ui(rtlsdr_FORMS_HEADERS ${rtlsdr_FORMS})
 
 add_library(inputrtlsdr SHARED
-	${rtlsdr_SOURCES}
-	${rtlsdr_HEADERS_MOC}
-	${rtlsdr_FORMS_HEADERS}
+    ${rtlsdr_SOURCES}
+    ${rtlsdr_HEADERS_MOC}
+    ${rtlsdr_FORMS_HEADERS}
 )
 
+if (BUILD_DEBIAN)
 target_link_libraries(inputrtlsdr
-	${QT_LIBRARIES}
-	${LIBRTLSDR_LIBRARIES}
-	sdrbase
+    ${QT_LIBRARIES}
+    rtlsdr
+    sdrbase
 )
+else (BUILD_DEBIAN)
+target_link_libraries(inputrtlsdr
+    ${QT_LIBRARIES}
+    ${LIBRTLSDR_LIBRARIES}
+    sdrbase
+)
+endif (BUILD_DEBIAN)
+
 
 qt5_use_modules(inputrtlsdr Core Widgets OpenGL Multimedia)
 
diff --git a/serialdv/CMakeLists.txt b/serialdv/CMakeLists.txt
new file mode 100644
index 000000000..f120477be
--- /dev/null
+++ b/serialdv/CMakeLists.txt
@@ -0,0 +1,29 @@
+project(serialdv)
+
+set(serialdv_SOURCES
+    ${LIBSERIALDVSRC}/dvcontroller.cpp  
+    ${LIBSERIALDVSRC}/serialdatacontroller.cpp  
+)
+
+set(serialdv_HEADERS
+    ${LIBSERIALDVSRC}/dvcontroller.h    
+    ${LIBSERIALDVSRC}/serialdatacontroller.h    
+)
+
+include_directories(
+    .
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${LIBSERIALDVSRC}
+)
+
+add_definitions(-DQT_SHARED)
+
+add_library(serialdv SHARED
+    ${serialdv_SOURCES}
+)
+
+target_link_libraries(serialdv
+    ${LIBUSB_LIBRARIES}
+)
+
+install(TARGETS serialdv DESTINATION lib)