summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Laß2021-05-09 21:22:07 +0200
committerMichael Laß2021-05-09 21:22:07 +0200
commit017a175aba6f8dfe5a8e48c792f6fb573d5a4dee (patch)
tree639dde24cb80cca5ec2868fcf2b482c2eeae675b
parent2a2296573c0f2fab05916da4359e253b4406c2f8 (diff)
downloadaur-017a175aba6f8dfe5a8e48c792f6fb573d5a4dee.tar.gz
Add a couple of patches and fix one optdepend
-rw-r--r--.SRCINFO12
-rw-r--r--0001-Remove-liio-from-linker-flags-when-using-CMAKE.patch30
-rw-r--r--0002-Fix-illegal-memory-access-in-fibDecoder-FIG1Extensio.patch40
-rw-r--r--0003-Leave-K-loop-in-reedSolomon-computeLambda-in-time.patch47
-rw-r--r--0004-Fix-index-computation-in-SpectrogramData-value.patch29
-rw-r--r--PKGBUILD31
6 files changed, 180 insertions, 9 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a11f67185628..5093ff2bc7c7 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = qt-dab
pkgdesc = Software DAB decoder for use with various SDR devices
pkgver = 3.71
- pkgrel = 2
+ pkgrel = 3
url = https://www.sdr-j.tk/
arch = x86_64
license = GPL2
@@ -15,11 +15,19 @@ pkgbase = qt-dab
optdepends = airspy: Support for Airspy
optdepends = hackrf: Support for HackRF
optdepends = limesuite: Support for LimeSDR
- optdepends = libiio: Support for Pluto
+ optdepends = libad9361: Support for Pluto
optdepends = rtl-sdr: Support for RTL-SDR
optdepends = libsdrplay: Support for SDRplay
source = https://github.com/JvanKatwijk/qt-dab/archive/refs/tags/Qt-DAB3.71.tar.gz
+ source = 0001-Remove-liio-from-linker-flags-when-using-CMAKE.patch
+ source = 0002-Fix-illegal-memory-access-in-fibDecoder-FIG1Extensio.patch
+ source = 0003-Leave-K-loop-in-reedSolomon-computeLambda-in-time.patch
+ source = 0004-Fix-index-computation-in-SpectrogramData-value.patch
sha256sums = 8a5ec68a7b920ee3b397fa8d9bd2e773f5e95ca5bb5a939dc907f4509d3df84f
+ sha256sums = eecc7813f00586dc37212971a5106a0ba4c106a3970a79e90fe8de1afd13a35a
+ sha256sums = 914eff3d5230d161af38ef1f85e3cecd45f2b150efc9ff8460e4be22f175319c
+ sha256sums = 1e22af5dc6ac8ec4ed512675d3606a8fa68245ba37ecf6a09045cbcf21a1a3c4
+ sha256sums = e2f998ec4495acc1141a9c8afa8a3fcc48de53a9214430443f474b6955c54490
pkgname = qt-dab
diff --git a/0001-Remove-liio-from-linker-flags-when-using-CMAKE.patch b/0001-Remove-liio-from-linker-flags-when-using-CMAKE.patch
new file mode 100644
index 000000000000..a4fa783316f5
--- /dev/null
+++ b/0001-Remove-liio-from-linker-flags-when-using-CMAKE.patch
@@ -0,0 +1,30 @@
+From 8f4178bc86c891d45b2491ba66a169a0ccf137e9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michael=20La=C3=9F?= <bevan@bi-co.net>
+Date: Sun, 9 May 2021 17:48:29 +0200
+Subject: [PATCH 1/4] Remove -liio from linker flags when using CMAKE
+
+When requesting support for PLUTO via CMAKE, it configures
+pluto-handler-2, which does not link against libiio but instead uses
+dlopen() to dynamically load the library at runtime.
+
+Remove the flag to make qt-dab compile with pluto-handler-2 enabled on
+systems without libiio.
+---
+ dab-maxi/CMakeLists.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/dab-maxi/CMakeLists.txt b/dab-maxi/CMakeLists.txt
+index eb8f458..10b8b6f 100755
+--- a/dab-maxi/CMakeLists.txt
++++ b/dab-maxi/CMakeLists.txt
+@@ -691,7 +691,6 @@ endif ()
+ ./qt-devices/pluto-handler-2/pluto-handler.cpp
+ )
+
+- list(APPEND extraLibs -liio)
+ add_definitions (-DHAVE_PLUTO)
+ endif (PLUTO)
+ #
+--
+2.31.1
+
diff --git a/0002-Fix-illegal-memory-access-in-fibDecoder-FIG1Extensio.patch b/0002-Fix-illegal-memory-access-in-fibDecoder-FIG1Extensio.patch
new file mode 100644
index 000000000000..591f89d91009
--- /dev/null
+++ b/0002-Fix-illegal-memory-access-in-fibDecoder-FIG1Extensio.patch
@@ -0,0 +1,40 @@
+From eafbd99420c255c3938de35503c7f7fb5c0fb78a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michael=20La=C3=9F?= <bevan@bi-co.net>
+Date: Sun, 9 May 2021 17:14:52 +0200
+Subject: [PATCH 2/4] Fix illegal memory access in fibDecoder::FIG1Extension1
+
+If serviceIndex == -1, then the following does a write to non-allocated
+heap memory:
+
+ ensemble -> services [serviceIndex]. hasName = true;
+
+In that case, it is also unnecessessary to set this value, as it is
+already set by fibDecoder::createService.
+---
+ src/ofdm/fib-decoder.cpp | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/ofdm/fib-decoder.cpp b/src/ofdm/fib-decoder.cpp
+index f5b4f27..28746f3 100755
+--- a/src/ofdm/fib-decoder.cpp
++++ b/src/ofdm/fib-decoder.cpp
+@@ -963,12 +963,12 @@ char label [17];
+ (const char *) label,
+ (CharacterSet) charSet);
+ serviceIndex = findService (dataName);
+- if (serviceIndex == -1)
++ if (serviceIndex == -1) {
+ createService (dataName, SId, 0);
+- else
++ } else {
+ ensemble -> services [serviceIndex]. SCIds = 0;
+-
+- ensemble -> services [serviceIndex]. hasName = true;
++ ensemble -> services [serviceIndex]. hasName = true;
++ }
+ }
+
+ // service component label 8.1.14.3
+--
+2.31.1
+
diff --git a/0003-Leave-K-loop-in-reedSolomon-computeLambda-in-time.patch b/0003-Leave-K-loop-in-reedSolomon-computeLambda-in-time.patch
new file mode 100644
index 000000000000..973b8e23398b
--- /dev/null
+++ b/0003-Leave-K-loop-in-reedSolomon-computeLambda-in-time.patch
@@ -0,0 +1,47 @@
+From e88b758f25717d07b25082fd17dc5b067c7682a3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michael=20La=C3=9F?= <bevan@bi-co.net>
+Date: Sun, 9 May 2021 20:33:50 +0200
+Subject: [PATCH 3/4] Leave K loop in reedSolomon::computeLambda in time
+
+So far, the loop ran as long as K <= nroots. In the last iteration, the
+only relevant operation was the update of Lambda. All operations after
+that have no relevance if there is no next iteration. However, that part
+caused an invalid access into syndromes.
+
+Let the loop run only as long K < nroots and do the final Lambda
+calculation afterwards.
+
+Fixes #202
+---
+ src/backend/reed-solomon.cpp | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/src/backend/reed-solomon.cpp b/src/backend/reed-solomon.cpp
+index c4d8f2c..90352d5 100755
+--- a/src/backend/reed-solomon.cpp
++++ b/src/backend/reed-solomon.cpp
+@@ -281,7 +281,7 @@ int16_t deg_lambda;
+ Lambda [0] = 1;
+ Corrector [1] = 1;
+ //
+- while (K <= nroots) {
++ while (K < nroots) {
+ uint8_t oldLambda [nroots];
+ memcpy (oldLambda, Lambda, nroots * sizeof (Lambda [0]));
+ //
+@@ -311,6 +311,12 @@ int16_t deg_lambda;
+ K += 1;
+ } // end of Berlekamp loop
+
++// Compute final lambda
++ for (i = 0; i < nroots; i ++)
++ Lambda [i] = myGalois. add_poly (Lambda [i],
++ myGalois. multiply_poly (error,
++ Corrector [i]));
++
+ for (i = 0; i < nroots; i ++) {
+ if (Lambda [i] != 0)
+ deg_lambda = i;
+--
+2.31.1
+
diff --git a/0004-Fix-index-computation-in-SpectrogramData-value.patch b/0004-Fix-index-computation-in-SpectrogramData-value.patch
new file mode 100644
index 000000000000..071266d51d35
--- /dev/null
+++ b/0004-Fix-index-computation-in-SpectrogramData-value.patch
@@ -0,0 +1,29 @@
+From 21e9934ad7d1168d5806d8d8d15c1e31335aec26 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michael=20La=C3=9F?= <bevan@bi-co.net>
+Date: Sun, 9 May 2021 21:06:51 +0200
+Subject: [PATCH 4/4] Fix index computation in SpectrogramData::value
+
+data is of size datawidth*dataheight. The result of x/width and y/height
+may result in [0,1]. We therefore must multiply with (datawidth-1) and
+(dataheight-1) to stay within the bounds of data.
+---
+ includes/scopes-qwt6/spectrogramdata.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/includes/scopes-qwt6/spectrogramdata.h b/includes/scopes-qwt6/spectrogramdata.h
+index 7c153da..c25d2cf 100755
+--- a/includes/scopes-qwt6/spectrogramdata.h
++++ b/includes/scopes-qwt6/spectrogramdata.h
+@@ -75,7 +75,8 @@ QwtInterval Interval (Qt::Axis x)const {
+ double value (double x, double y) const {
+ //fprintf (stderr, "x = %f, y = %f\n", x, y);
+ x = x - left;
+- x = x / width * datawidth;
++ x = x / width * (datawidth - 1);
++ y = y / height * (dataheight - 1);
+ return data [(int)y * datawidth + (int)x];
+ }
+
+--
+2.31.1
+
diff --git a/PKGBUILD b/PKGBUILD
index c516d66571f4..a9fd0087073a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,32 +6,49 @@
pkgname=qt-dab
_pkgname=Qt-DAB
pkgver=3.71
-pkgrel=2
+pkgrel=3
pkgdesc="Software DAB decoder for use with various SDR devices"
arch=(x86_64)
url="https://www.sdr-j.tk/"
license=('GPL2')
+#options=(!strip) # for debugging
depends=(faad2 fftw hicolor-icon-theme libsamplerate libsndfile portaudio qwt)
optdepends=('airspy: Support for Airspy'
'hackrf: Support for HackRF'
'limesuite: Support for LimeSDR'
- 'libiio: Support for Pluto'
+ 'libad9361: Support for Pluto'
'rtl-sdr: Support for RTL-SDR'
'libsdrplay: Support for SDRplay')
-source=("https://github.com/JvanKatwijk/${pkgname}/archive/refs/tags/${_pkgname}${pkgver}.tar.gz")
-sha256sums=('8a5ec68a7b920ee3b397fa8d9bd2e773f5e95ca5bb5a939dc907f4509d3df84f')
+source=("https://github.com/JvanKatwijk/${pkgname}/archive/refs/tags/${_pkgname}${pkgver}.tar.gz"
+ "0001-Remove-liio-from-linker-flags-when-using-CMAKE.patch"
+ "0002-Fix-illegal-memory-access-in-fibDecoder-FIG1Extensio.patch"
+ "0003-Leave-K-loop-in-reedSolomon-computeLambda-in-time.patch"
+ "0004-Fix-index-computation-in-SpectrogramData-value.patch")
+sha256sums=('8a5ec68a7b920ee3b397fa8d9bd2e773f5e95ca5bb5a939dc907f4509d3df84f'
+ 'eecc7813f00586dc37212971a5106a0ba4c106a3970a79e90fe8de1afd13a35a'
+ '914eff3d5230d161af38ef1f85e3cecd45f2b150efc9ff8460e4be22f175319c'
+ '1e22af5dc6ac8ec4ed512675d3606a8fa68245ba37ecf6a09045cbcf21a1a3c4'
+ 'e2f998ec4495acc1141a9c8afa8a3fcc48de53a9214430443f474b6955c54490')
prepare() {
+ cd "${pkgname}-${_pkgname}${pkgver}"
+
# The program is officially called Qt-DAB.
- sed -i 's/Qt_DAB/Qt-DAB/g' ${pkgname}-${_pkgname}${pkgver}/dab-maxi/${pkgname}.desktop
+ sed -i 's/Qt_DAB/Qt-DAB/g' dab-maxi/${pkgname}.desktop
- # -liio is not required. Remove to make libiio optional.
- sed -i '/list(APPEND extraLibs -liio)/d' ${pkgname}-${_pkgname}${pkgver}/dab-maxi/CMakeLists.txt
+ # Various stability and build system fixes
+ patch -p1 < "${srcdir}/0001-Remove-liio-from-linker-flags-when-using-CMAKE.patch"
+ patch -p1 < "${srcdir}/0002-Fix-illegal-memory-access-in-fibDecoder-FIG1Extensio.patch"
+ patch -p1 < "${srcdir}/0003-Leave-K-loop-in-reedSolomon-computeLambda-in-time.patch"
+ patch -p1 < "${srcdir}/0004-Fix-index-computation-in-SpectrogramData-value.patch"
}
build() {
mkdir -p build-maxi; cd build-maxi
+ # for debugging
+ # CXXFLAGS="$CXXFLAGS -fsanitize=address -g" \
+ # LDFLAGS="$LDFLAGS -fsanitize=address -g" \
cmake \
-Wno-dev \
-DTRY_EPG=ON \