Subject: [alpine-aports] [PATCH 1/2] testing/libkeyfinder: new aport

From: Jean-Louis Fuchs <[email-masked]>
Date: Thu, 23 Mar 2017 23:43:01 +0100

---
 testing/libkeyfinder/APKBUILD                     | 50 ++++++++++++++++++
 testing/libkeyfinder/alpine-settings-to-pro.patch | 28 ++++++++++
 testing/libkeyfinder/issue_22.patch               | 63 +++++++++++++++++++++++
 3 files changed, 141 insertions(+)
 create mode 100644 testing/libkeyfinder/APKBUILD
 create mode 100644 testing/libkeyfinder/alpine-settings-to-pro.patch
 create mode 100644 testing/libkeyfinder/issue_22.patch

diff --git a/testing/libkeyfinder/APKBUILD b/testing/libkeyfinder/APKBUILD
new file mode 100644
index 0000000000..b2973a160a
--- /dev/null
+++ b/testing/libkeyfinder/APKBUILD
@@ -0,0 +1,50 @@
+# Contributor: Jean-Louis Fuchs <[email-masked]>
+# Maintainer: Jean-Louis Fuchs <[email-masked]>
+pkgname=libkeyfinder
+pkgver=2.2
+pkgrel=0
+pkgdesc="Musical key detection for digital audio"
+url="http://www.ibrahimshaath.co.uk/keyfinder/"
+arch="all"
+license="GPL"
+# Its just using qmake
+makedepends="qt-dev fftw-dev"
+subpackages="$pkgname-dev $pkgname-doc"
+source="libkeyfinder-$pkgver.tar.gz::https://github.com/ibsh/libKeyFinder/archive/v$pkgver.tar.gz
+	issue_22.patch
+	alpine-settings-to-pro.patch"
+builddir="$srcdir/libKeyFinder-$pkgver"
+
+build() {
+	cd "$builddir"
+	qmake PREFIX=/usr
+	make
+}
+
+package() {
+	cd "$builddir"
+	make INSTALL_ROOT="$pkgdir" install
+}
+
+doc() {
+	mkdir -p "$subpkgdir/usr/share/doc/$pkgname"
+    cp "$builddir/README.md" "$subpkgdir/usr/share/doc/$pkgname/README.md"
+}
+
+check() {
+	cd "$builddir/tests"
+	ln -s "$builddir" keyfinder
+	qmake
+	make
+	LD_LIBRARY_PATH="$builddir" ./tests
+}
+
+md5sums="c19eaf976afe10ba0cf15c0aba45618c  libkeyfinder-2.2.tar.gz
+17d4692e8c39c0f607981058f531970d  issue_22.patch
+2650ed076d43872cc474099021bd84cd  alpine-settings-to-pro.patch"
+sha256sums="cd9337899e0d71bb0fda2726630f72aaf6a05a3ec7b27df7e42fd27409a88c96  libkeyfinder-2.2.tar.gz
+2e570a3d682f365cac5d0c49aaa139cb559cb36ca37e26b7b9b05dccdb9f3a7f  issue_22.patch
+bc2dd2f8948d6565dd90b75074d7f2e61802d9e2f67e315ba92464958e5dc0ea  alpine-settings-to-pro.patch"
+sha512sums="8e35473d34cb715d9eb383733ca07f659fd116f65a923fa3948d99dc4cfb04e43b4cf0bb411345574d42bb40fae8d818253f8cdbcbb5fb3aaab88bcc57f7b687  libkeyfinder-2.2.tar.gz
+a73e24f96708615b8d3073de8eac32a17be6947b3c99f94be57d09577278eedcf668849c75c20fe74a35bd74e8b41f92d08627c5f0fff3198cf60867262bcd6a  issue_22.patch
+580c968da0d24126d92b09cc4a970bb898fe020f2b9a9232d80ef63be8d3f90e618ea0b2f66ccde174a51dcf7160dfd62ab3b9428bf0ae6b11608b7dd7aede23  alpine-settings-to-pro.patch"
diff --git a/testing/libkeyfinder/alpine-settings-to-pro.patch b/testing/libkeyfinder/alpine-settings-to-pro.patch
new file mode 100644
index 0000000000..36cfe6d937
--- /dev/null
+++ b/testing/libkeyfinder/alpine-settings-to-pro.patch
@@ -0,0 +1,28 @@
+diff -ur a/LibKeyFinder.pro b/LibKeyFinder.pro
+--- a/LibKeyFinder.pro	2017-03-12 23:41:10.000000000 +0100
++++ b/LibKeyFinder.pro	2017-03-23 16:49:06.236738498 +0100
+@@ -30,7 +30,8 @@
+ VERSION = 2.2.0
+ 
+ CONFIG += c++11
+-QMAKE_CXXFLAGS += -std=c++11
++QMAKE_CXXFLAGS_RELEASE -= -O2
++QMAKE_CXXFLAGS += -std=c++11 -Os -fomit-frame-pointer
+ 
+ DEFINES += LIBKEYFINDER_LIBRARY
+ 
+diff -ur a/tests/tests.pro b/tests/tests.pro
+--- a/tests/tests.pro	2017-03-23 16:47:17.280248215 +0100
++++ b/tests/tests.pro	2017-03-23 16:48:28.386799769 +0100
+@@ -27,8 +27,9 @@
+ CONFIG -= qt
+ 
+ CONFIG += c++11
+-LIBS += -stdlib=libc++
+-QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++
++LIBS += -L..
++QMAKE_CXXFLAGS_RELEASE -= -O2
++QMAKE_CXXFLAGS += -std=c++11 -Os -fomit-frame-pointer
+ 
+ LIBS += -lkeyfinder
+ 
diff --git a/testing/libkeyfinder/issue_22.patch b/testing/libkeyfinder/issue_22.patch
new file mode 100644
index 0000000000..a21338ccf8
--- /dev/null
+++ b/testing/libkeyfinder/issue_22.patch
@@ -0,0 +1,63 @@
+commit 1be2a3290389b53e1e9f91710bcc6d1ccad2abe9
+Author: Jean-Louis Fuchs <[email-masked]>
+Date:   Thu Mar 23 23:09:14 2017 +0100
+
+    Alpine patch
+
+diff --git a/fftadapter.cpp b/fftadapter.cpp
+index 57e8197..1ec7c6c 100644
+--- a/fftadapter.cpp
++++ b/fftadapter.cpp
+@@ -40,6 +40,7 @@ namespace KeyFinder {
+     frameSize = inFrameSize;
+     priv->inputReal = (double*)fftw_malloc(sizeof(double) * frameSize);
+     priv->outputComplex = (fftw_complex*)fftw_malloc(sizeof(fftw_complex) * frameSize);
++    memset(priv->outputComplex, 0, sizeof(fftw_complex) * frameSize);
+     fftwPlanMutex.lock();
+     priv->plan = fftw_plan_dft_r2c_1d(frameSize, priv->inputReal, priv->outputComplex, FFTW_ESTIMATE);
+     fftwPlanMutex.unlock();
+diff --git a/tests/audiodatatest.cpp b/tests/audiodatatest.cpp
+index 30657a7..a96e0ab 100644
+--- a/tests/audiodatatest.cpp
++++ b/tests/audiodatatest.cpp
+@@ -296,12 +296,12 @@ TEST_CASE ("AudioDataTest/DownsamplerResamplesNonintegralRelationship") {
+   KeyFinder::AudioData a;
+   a.setChannels(1);
+   a.setFrameRate(100);
+-  a.addToSampleCount(12);
++  a.addToSampleCount(15);
+   for (unsigned int i = 0; i < 5; i++)
+     a.setSample(i, 100.0);
+   for (unsigned int i = 5; i < 10; i++)
+     a.setSample(i, 500.0);
+-  for (unsigned int i = 10; i < 12; i++)
++  for (unsigned int i = 10; i < 15; i++)
+     a.setSample(i, 1000.0);
+ 
+   a.downsample(5);
+@@ -309,7 +309,6 @@ TEST_CASE ("AudioDataTest/DownsamplerResamplesNonintegralRelationship") {
+   ASSERT_EQ(3, a.getSampleCount());
+   ASSERT_FLOAT_EQ(100.0, a.getSample(0));
+   ASSERT_FLOAT_EQ(500.0, a.getSample(1));
+-  // this doesn't make total mathematical sense but I'm taking a shortcut for performance
+   ASSERT_FLOAT_EQ(1000.0, a.getSample(2));
+ }
+ 
+diff --git a/tests/lowpassfiltertest.cpp b/tests/lowpassfiltertest.cpp
+index 6135ed0..21220ff 100644
+--- a/tests/lowpassfiltertest.cpp
++++ b/tests/lowpassfiltertest.cpp
+@@ -194,7 +194,6 @@ TEST (LowPassFilterTest, WorksOnRepetitiveWaves) {
+ TEST (LowPassFilterTest, DefaultFilterMatchesFisherCoefficients) {
+   KeyFinder::LowPassFilter* lpf = new KeyFinder::LowPassFilter(160, 44100, 2000.0, 2048);
+   std::vector<double>* myCoeffs = (std::vector<double>*)lpf->getCoefficients();
+-  delete lpf;
+ 
+   float fisherCoeffsFirstHalf[] = {
+     -0.0022979864, -0.0014851155, -0.0005276345, +0.0005287637,
+@@ -224,4 +223,5 @@ TEST (LowPassFilterTest, DefaultFilterMatchesFisherCoefficients) {
+     ASSERT_FLOAT_EQ(fisherCoeffsFirstHalf[i], myCoeffs->at(i));
+     ASSERT_FLOAT_EQ(myCoeffs->at(i), myCoeffs->at(160 - i));
+   }
++  delete lpf;
+ }
-- 
2.11.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Jean-Louis Fuchs <[email-masked]>
Date: Thu, 23 Mar 2017 23:43:02 +0100

---
 testing/keyfinder-cli/APKBUILD | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 testing/keyfinder-cli/APKBUILD

diff --git a/testing/keyfinder-cli/APKBUILD b/testing/keyfinder-cli/APKBUILD
new file mode 100644
index 0000000000..3ef2125bb3
--- /dev/null
+++ b/testing/keyfinder-cli/APKBUILD
@@ -0,0 +1,29 @@
+# Contributor: Jean-Louis Fuchs <[email-masked]>
+# Maintainer: Jean-Louis Fuchs <[email-masked]>
+pkgname=keyfinder-cli
+pkgver=1.0.0
+pkgrel=0
+pkgdesc="Musical key detection for digital audio (command line)"
+url="https://github.com/EvanPurkhiser/keyfinder-cli"
+arch="all"
+license="GPL"
+makedepends="libkeyfinder-dev ffmpeg-dev"
+subpackages="$pkgname-doc"
+source="keyfinder-cli-$pkgver.tar.gz::https://github.com/EvanPurkhiser/keyfinder-cli/archive/v$pkgver.tar.gz"
+builddir="$srcdir/keyfinder-cli-$pkgver"
+
+options="!check"
+
+build() {
+	cd "$builddir"
+	make
+}
+
+package() {
+	cd "$builddir"
+	make PREFIX="/usr" DESTDIR="$pkgdir" install || return 1
+}
+
+md5sums="2dd924d260c33acf54e82208f0385439  keyfinder-cli-1.0.0.tar.gz"
+sha256sums="2279e25131419339029f4e532c606721cda020b4c9a9651cf3cc5ec8822e561f  keyfinder-cli-1.0.0.tar.gz"
+sha512sums="89fe8448c9a8079cb31c9d50c96989a60c1fc342c77d433d5c4eb175e8eb6c54565ea24ad06fb88d5664327ea8517449e3f769d40ba00b523fa41beacf04cc38  keyfinder-cli-1.0.0.tar.gz"
-- 
2.11.1

---