From c8b691c3dd22d5566658ebd08952985d3af531b8 Mon Sep 17 00:00:00 2001
From: f4exb <f4exb06@gmail.com>
Date: Tue, 18 Oct 2022 21:21:10 +0200
Subject: [PATCH] Revert "Remove codec2 from Appveyor and Travis builds"

This reverts commit 3d23d4023fadf1a77b21b21c6e3341411d5e432b.
---
 .appveyor.yml            |  2 +-
 .travis.yml              |  2 ++
 cmake/ci/build_codec2.sh | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 cmake/ci/build_codec2.sh

diff --git a/.appveyor.yml b/.appveyor.yml
index 5e29d6440..58c14c04c 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -87,7 +87,7 @@ for:
             libqt5charts5-dev libqt5texttospeech5-dev libfaad-dev zlib1g-dev \
             libusb-1.0-0-dev libhidapi-dev libboost-all-dev libasound2-dev libopencv-dev libopencv-imgcodecs-dev \
             libxml2-dev bison flex ffmpeg  libpostproc-dev libavcodec-dev libavformat-dev \
-            libopus-dev libairspy-dev libhackrf-dev \
+            libopus-dev libcodec2-dev libairspy-dev libhackrf-dev \
             libbladerf-dev libsoapysdr-dev libiio-dev libuhd-dev \
             python3-mako python3-cheetah python3-numpy \
             autoconf automake libtool ninja-build libclang1-11
diff --git a/.travis.yml b/.travis.yml
index c98e0ebf9..2b1625359 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -70,6 +70,8 @@ install:
   # macOS 10.11 doesn't support newest Qt
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then if [[ "$TRAVIS_OSX_IMAGE" == "xcode7.3" ]]; then sudo port -N -k install qt59-qtmultimedia qt59-qttools; else sudo port -N -k install qt5-qtmultimedia qt5-qttools; fi; fi
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source macports-ci ccache --save; fi
+  # use codec2 from repository
+  #- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES=ON" ]]; then bash cmake/ci/build_codec2.sh; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES=ON" ]]; then bash cmake/ci/build_cm256cc.sh; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES=ON" ]]; then bash cmake/ci/build_mbelib.sh; fi
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ ! "${CMAKE_CUSTOM_OPTIONS}" =~ "ENABLE_EXTERNAL_LIBRARIES=ON" ]]; then bash cmake/ci/build_serialdv.sh; fi
diff --git a/cmake/ci/build_codec2.sh b/cmake/ci/build_codec2.sh
new file mode 100644
index 000000000..dc5b6e364
--- /dev/null
+++ b/cmake/ci/build_codec2.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+sudo apt-get -y install libsamplerate0-dev libspeex-dev libspeexdsp-dev
+
+cd $HOME
+mkdir -p external && cd external
+mkdir -p drowe67 && cd drowe67
+
+git clone https://github.com/drowe67/codec2.git
+
+cd codec2
+git reset --hard "v1.0.3"
+mkdir -p build && cd build
+cmake ..
+sudo make install
+sudo ldconfig