From ac345bbe97bf89dccd6b027d122d09986928ac44 Mon Sep 17 00:00:00 2001
From: f4exb <f4exb06@gmail.com>
Date: Sat, 10 Jun 2017 19:20:58 +0200
Subject: [PATCH] Removed dependency on liblz4

---
 Readme.md                                                 | 8 ++++----
 apple/deploy.sh                                           | 2 --
 debian/control                                            | 2 +-
 plugins/samplesource/sdrdaemonsource/sdrdaemonsource.pro  | 2 --
 .../sdrdaemonsource/sdrdaemonsourcebuffer.cpp             | 1 -
 sdrangel.android.pro                                      | 1 -
 sdrangel.macos.pro                                        | 1 -
 sdrangel.windows.pro                                      | 1 -
 windows.install.bat                                       | 1 -
 9 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/Readme.md b/Readme.md
index 527ad1a6d..922ef33ca 100644
--- a/Readme.md
+++ b/Readme.md
@@ -265,7 +265,7 @@ Install cmake version 3:
 
 <h3>With newer versions just do:</h3>
 
-  - `sudo apt-get install cmake g++ pkg-config libfftw3-dev libqt5multimedia5-plugins qtmultimedia5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtbase5-dev libusb-1.0 librtlsdr-dev libboost-all-dev libasound2-dev pulseaudio liblz4-dev libnanomsg-dev libopencv-dev libsqlite3-dev`
+  - `sudo apt-get install cmake g++ pkg-config libfftw3-dev libqt5multimedia5-plugins qtmultimedia5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtbase5-dev libusb-1.0 librtlsdr-dev libboost-all-dev libasound2-dev pulseaudio libnanomsg-dev libopencv-dev libsqlite3-dev`
   - `mkdir build && cd build && cmake ../ && make`
 
 `librtlsdr-dev` is in the `universe` repo. (utopic 14.10 amd64.)
@@ -290,7 +290,7 @@ For Debian Jessie or Stretch:
 
 This has been tested with the bleeding edge "Thumbleweed" distribution:
 
-`sudo zypper install cmake fftw3-devel gcc-c++ libusb-1_0-devel libqt5-qtbase-devel libQt5OpenGL-devel libqt5-qtmultimedia-devel libqt5-qttools-devel libQt5Network-devel libQt5Widgets-devel boost-devel alsa-devel pulseaudio liblz4 liblz4-devel`
+`sudo zypper install cmake fftw3-devel gcc-c++ libusb-1_0-devel libqt5-qtbase-devel libQt5OpenGL-devel libqt5-qtmultimedia-devel libqt5-qttools-devel libQt5Network-devel libQt5Widgets-devel boost-devel alsa-devel pulseaudio`
 
 Then you should be all set to build the software with `cmake` and `make` as discussed earlier.
 
@@ -303,7 +303,7 @@ This has been tested with Fedora 23 and 22:
 
   - `sudo dnf groupinstall "C Development Tools and Libraries"`
   - `sudo dnf install mesa-libGL-devel`
-  - `sudo dnf install cmake gcc-c++ pkgconfig fftw-devel libusb-devel qt5-qtbase-devel qt5-qtmultimedia-devel qt5-qttools-devel boost-devel pulseaudio alsa-lib-devel liblz4 liblz4-devel`
+  - `sudo dnf install cmake gcc-c++ pkgconfig fftw-devel libusb-devel qt5-qtbase-devel qt5-qtmultimedia-devel qt5-qttools-devel boost-devel pulseaudio alsa-lib-devel`
 
 Then you should be all set to build the software with `cmake` and `make` as discussed earlier.
 
@@ -313,7 +313,7 @@ Then you should be all set to build the software with `cmake` and `make` as disc
 
 Tested with the 15.09 version with LXDE desktop (community supported). The exact desktop environment should not matter anyway. Since Manjaro is Arch Linux based prerequisites should be similar for Arch and all derivatives.
 
-`sudo pacman -S cmake pkg-config fftw qt5-multimedia qt5-tools qt5-base libusb boost boost-libs pulseaudio lz4`
+`sudo pacman -S cmake pkg-config fftw qt5-multimedia qt5-tools qt5-base libusb boost boost-libs pulseaudio`
 
 Then you should be all set to build the software with `cmake` and `make` as discussed earlier.
 
diff --git a/apple/deploy.sh b/apple/deploy.sh
index decb6f63d..aee2afb8b 100755
--- a/apple/deploy.sh
+++ b/apple/deploy.sh
@@ -13,7 +13,6 @@ mkdir -p "${APP_PLUGINS}/samplesource"
 
 cp -v fcdhid/libfcdhid.dylib $APP_LIB
 cp -v fcdlib/libfcdlib.dylib $APP_LIB
-cp -v lz4/liblz4.dylib $APP_LIB
 cp -v mbelib/libmbelib.dylib $APP_LIB
 cp -v sdrbase/libsdrbase.dylib $APP_LIB
 cp -v devices/libdevices.dylib $APP_LIB
@@ -28,6 +27,5 @@ cd $APP_LIB
 cp /opt/local/lib/libnanomsg.5.0.0.dylib .
 ln -s libdsdcc.dylib libdsdcc.1.dylib
 ln -s libdevices.dylib libdevices.1.dylib
-ln -s liblz4.dylib liblz4.1.dylib
 ln -s libsdrbase.dylib libsdrbase.1.dylib
 ln -s libmbelib.dylib libmbelib.1.dylib
diff --git a/debian/control b/debian/control
index 8e8c7efb5..09def4930 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Homepage: https://github.com/f4exb/sdrangel
 
 Package: sdrangel
 Architecture: any
-Depends: libc6, libasound2, libfftw3-single3, libgcc1, libgl1-mesa-glx, liblz4-1, libnanomsg0, libqt5core5a, libqt5gui5, libqt5multimedia5, libqt5network5, libqt5opengl5, libqt5widgets5, libstdc++6, libusb-1.0-0, libopencv-dev, libsqlite3-dev, ${shlibs:Depends}, ${misc:Depends}
+Depends: libc6, libasound2, libfftw3-single3, libgcc1, libgl1-mesa-glx, libnanomsg0, libqt5core5a, libqt5gui5, libqt5multimedia5, libqt5network5, libqt5opengl5, libqt5widgets5, libstdc++6, libusb-1.0-0, libopencv-dev, libsqlite3-dev, ${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.
diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsource.pro b/plugins/samplesource/sdrdaemonsource/sdrdaemonsource.pro
index f85b3021f..61c1ac6e2 100644
--- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsource.pro
+++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsource.pro
@@ -19,7 +19,6 @@ CONFIG(MINGW64):LIBCM256CCSRC = "D:\softs\cm256cc"
 
 INCLUDEPATH += $$PWD
 INCLUDEPATH += ../../../sdrbase
-INCLUDEPATH += ../../../lz4
 INCLUDEPATH += $$LIBNANOMSGSRC/src
 INCLUDEPATH += $$LIBCM256CCSRC
 
@@ -53,7 +52,6 @@ sdrdaemonsourceudphandler.h
 FORMS += sdrdaemonsourcegui.ui
 
 LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
-LIBS += -L../../../lz4/$${build_subdir} -llz4
 LIBS += -L../../../nanomsg/$${build_subdir} -lnanomsg
 LIBS += -L../../../cm256cc/$${build_subdir} -lcm256cc
 
diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourcebuffer.cpp b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourcebuffer.cpp
index 0ae16958f..b2d375237 100644
--- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourcebuffer.cpp
+++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourcebuffer.cpp
@@ -18,7 +18,6 @@
 #include <cassert>
 #include <cstring>
 #include <cmath>
-#include <lz4.h>
 #include <boost/crc.hpp>
 #include <boost/cstdint.hpp>
 #include "sdrdaemonsourcebuffer.h"
diff --git a/sdrangel.android.pro b/sdrangel.android.pro
index fd217b125..897261fe0 100644
--- a/sdrangel.android.pro
+++ b/sdrangel.android.pro
@@ -6,7 +6,6 @@
 
 TEMPLATE = subdirs
 SUBDIRS = sdrbase
-SUBDIRS += lz4
 #SUBDIRS += librtlsdr
 #SUBDIRS += libhackrf
 #SUBDIRS += libairspy
diff --git a/sdrangel.macos.pro b/sdrangel.macos.pro
index de52e5b0e..62ec79f7d 100644
--- a/sdrangel.macos.pro
+++ b/sdrangel.macos.pro
@@ -7,7 +7,6 @@
 TEMPLATE = subdirs
 SUBDIRS = sdrbase
 SUBDIRS += devices
-SUBDIRS += lz4
 SUBDIRS += fcdhid
 SUBDIRS += fcdlib
 SUBDIRS += mbelib
diff --git a/sdrangel.windows.pro b/sdrangel.windows.pro
index b93a8b9a8..9be3372b8 100644
--- a/sdrangel.windows.pro
+++ b/sdrangel.windows.pro
@@ -7,7 +7,6 @@
 TEMPLATE = subdirs
 SUBDIRS = sdrbase
 SUBDIRS += devices
-SUBDIRS += lz4
 CONFIG(MINGW64)SUBDIRS += nanomsg
 SUBDIRS += fcdhid
 SUBDIRS += fcdlib
diff --git a/windows.install.bat b/windows.install.bat
index 5dcccb8b9..bff234c56 100644
--- a/windows.install.bat
+++ b/windows.install.bat
@@ -4,7 +4,6 @@ SET opencvdir="D:\softs\opencv\build\mw32\install\x86\mingw\bin"
 copy app\%1\sdrangel.exe %2
 copy sdrbase\%1\sdrbase.dll %2
 copy devices\%1\devices.dll %2
-copy lz4\%1\lz4.dll %2
 copy mbelib\%1\mbelib.dll %2
 copy dsdcc\%1\dsdcc.dll %2
 copy serialdv\%1\serialdv.dll %2