commit:     f43c215a98e8bb545ab65e84b12d8d765d274b43
Author:     Kacper Słomiński <kacper.slominski72 <AT> gmail <DOT> com>
AuthorDate: Mon Aug 12 07:11:18 2024 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Tue Aug 20 00:48:00 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f43c215a

media-libs/noise-suppression-for-voice: add 1.10-r2

This revision fixes build issues with musl.

Closes: https://bugs.gentoo.org/937536
Signed-off-by: Kacper Słomiński <kacper.slominski72 <AT> gmail.com>
Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>

 ...or-voice-1.10-Patch-out-use-of-execinfo.h.patch | 51 +++++++++++++
 ...on-for-voice-1.10-Patch-out-use-of-stat64.patch | 42 +++++++++++
 ...10-Patch-out-uses-of-nl_langinfo-for-musl.patch | 36 +++++++++
 .../noise-suppression-for-voice-1.10-r2.ebuild     | 88 ++++++++++++++++++++++
 4 files changed, 217 insertions(+)

diff --git 
a/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-use-of-execinfo.h.patch
 
b/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-use-of-execinfo.h.patch
new file mode 100644
index 000000000000..e87fb0ada3f9
--- /dev/null
+++ 
b/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-use-of-execinfo.h.patch
@@ -0,0 +1,51 @@
+From 74ff3c3990e725c6f9ae407e5f28673570fa4645 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Kacper=20S=C5=82omi=C5=84ski?=
+ <kacper.slominsk...@gmail.com>
+Date: Sun, 11 Aug 2024 22:38:58 +0200
+Subject: [PATCH 1/3] Patch out use of execinfo.h
+
+Not available on musl, and the backtrace functionality is unused
+anyway (only called by the leak detector AFAICS).
+---
+ external/JUCE/modules/juce_core/juce_core.cpp            | 4 ----
+ .../JUCE/modules/juce_core/system/juce_SystemStats.cpp   | 9 +--------
+ 2 files changed, 1 insertion(+), 12 deletions(-)
+
+diff --git a/external/JUCE/modules/juce_core/juce_core.cpp 
b/external/JUCE/modules/juce_core/juce_core.cpp
+index 067a189..e3e6254 100644
+--- a/external/JUCE/modules/juce_core/juce_core.cpp
++++ b/external/JUCE/modules/juce_core/juce_core.cpp
+@@ -101,10 +101,6 @@
+  #include <sys/time.h>
+  #include <net/if.h>
+  #include <sys/ioctl.h>
+-
+- #if ! (JUCE_ANDROID || JUCE_WASM)
+-  #include <execinfo.h>
+- #endif
+ #endif
+ 
+ #if JUCE_MAC || JUCE_IOS
+diff --git a/external/JUCE/modules/juce_core/system/juce_SystemStats.cpp 
b/external/JUCE/modules/juce_core/system/juce_SystemStats.cpp
+index 3fe9ac7..840c731 100644
+--- a/external/JUCE/modules/juce_core/system/juce_SystemStats.cpp
++++ b/external/JUCE/modules/juce_core/system/juce_SystemStats.cpp
+@@ -173,14 +173,7 @@ String SystemStats::getStackBacktrace()
+     }
+ 
+    #else
+-    void* stack[128];
+-    auto frames = backtrace (stack, numElementsInArray (stack));
+-    char** frameStrings = backtrace_symbols (stack, frames);
+-
+-    for (int i = 0; i < frames; ++i)
+-        result << frameStrings[i] << newLine;
+-
+-    ::free (frameStrings);
++    jassertfalse; // patched out <execinfo.h>
+    #endif
+ 
+     return result;
+-- 
+2.44.2
+

diff --git 
a/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-use-of-stat64.patch
 
b/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-use-of-stat64.patch
new file mode 100644
index 000000000000..890c33d6197c
--- /dev/null
+++ 
b/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-use-of-stat64.patch
@@ -0,0 +1,42 @@
+From 6b2901929fa7d618bda890adc7ecc15cb18d5b01 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Kacper=20S=C5=82omi=C5=84ski?=
+ <kacper.slominsk...@gmail.com>
+Date: Sun, 11 Aug 2024 23:31:25 +0200
+Subject: [PATCH 2/3] Patch out use of stat64
+
+Not available on musl, and we're better off with using
+-D_FILE_OFFSET_BITS=64 instead anyway.
+---
+ CMakeLists.txt                                                 | 2 ++
+ external/JUCE/modules/juce_core/native/juce_posix_SharedCode.h | 2 +-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2c9ade5..ddbaa16 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,6 +9,8 @@ set(CMAKE_BINARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+ 
+ set(MINGW_ADDITIONAL_LINKING_FLAGS "-static-libgcc -static-libstdc++ 
-Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
+ 
++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64")
++
+ if(NOT BUILD_VERSION)
+     set(BUILD_VERSION 1.99)
+ endif()
+diff --git a/external/JUCE/modules/juce_core/native/juce_posix_SharedCode.h 
b/external/JUCE/modules/juce_core/native/juce_posix_SharedCode.h
+index 700e191..b92f19c 100644
+--- a/external/JUCE/modules/juce_core/native/juce_posix_SharedCode.h
++++ b/external/JUCE/modules/juce_core/native/juce_posix_SharedCode.h
+@@ -167,7 +167,7 @@ int juce_siginterrupt (int sig, int flag)
+ 
//==============================================================================
+ namespace
+ {
+-   #if JUCE_LINUX || (JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T) // (this iOS 
stuff is to avoid a simulator bug)
++   #if (JUCE_IOS && ! __DARWIN_ONLY_63_BIT_INO_T) // (this iOS stuff is to 
avoid a simulator bug)
+     using juce_statStruct = struct stat64;
+     #define JUCE_STAT  stat64
+    #else
+-- 
+2.44.2
+

diff --git 
a/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-uses-of-nl_langinfo-for-musl.patch
 
b/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-uses-of-nl_langinfo-for-musl.patch
new file mode 100644
index 000000000000..04de9f024b69
--- /dev/null
+++ 
b/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.10-Patch-out-uses-of-nl_langinfo-for-musl.patch
@@ -0,0 +1,36 @@
+From b0ab5ab1b140fe76ff2e923e9d6434ad434adb88 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Kacper=20S=C5=82omi=C5=84ski?=
+ <kacper.slominsk...@gmail.com>
+Date: Sun, 11 Aug 2024 23:46:21 +0200
+Subject: [PATCH 3/3] Patch out uses of nl_langinfo for musl
+
+Not available on musl, instead use the alternative code path for BSD.
+---
+ .../JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp  | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/external/JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp 
b/external/JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp
+index 84abf88..a7b3343 100644
+--- a/external/JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp
++++ b/external/JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp
+@@ -198,7 +198,7 @@ String SystemStats::getComputerName()
+ 
+ String SystemStats::getUserLanguage()
+ {
+-   #if JUCE_BSD
++   #if JUCE_BSD || (JUCE_LINUX && !defined(__GLIBC__))
+     if (auto langEnv = getenv ("LANG"))
+         return String::fromUTF8 (langEnv).upToLastOccurrenceOf (".UTF-8", 
false, true);
+ 
+@@ -210,7 +210,7 @@ String SystemStats::getUserLanguage()
+ 
+ String SystemStats::getUserRegion()
+ {
+-   #if JUCE_BSD
++   #if JUCE_BSD || (JUCE_LINUX && !defined(__GLIBC__))
+     return {};
+    #else
+     return getLocaleValue (_NL_IDENTIFICATION_TERRITORY);
+-- 
+2.44.2
+

diff --git 
a/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-1.10-r2.ebuild
 
b/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-1.10-r2.ebuild
new file mode 100644
index 000000000000..89d7719e6af2
--- /dev/null
+++ 
b/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-1.10-r2.ebuild
@@ -0,0 +1,88 @@
+# Copyright 2020-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake flag-o-matic
+
+DESCRIPTION="A real-time noise suppression plugin for voice"
+HOMEPAGE="https://github.com/werman/noise-suppression-for-voice";
+
+if [[ "${PV}" == "9999" ]]; then
+       inherit git-r3
+       
EGIT_REPO_URI="https://github.com/werman/noise-suppression-for-voice.git";
+else
+       
SRC_URI="https://github.com/werman/noise-suppression-for-voice/archive/v${PV}.tar.gz
 -> ${P}.tar.gz"
+       KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+
+IUSE="lv2 vst vst3 test"
+RESTRICT="!test? ( test )"
+
+COMMON_DEPEND="
+       media-libs/freetype
+       x11-libs/libX11
+       x11-libs/libXcursor
+       x11-libs/libXinerama
+       x11-libs/libXrandr
+"
+
+DEPEND="
+       lv2? ( ${COMMON_DEPEND} )
+       vst? ( ${COMMON_DEPEND} )
+       vst3? ( ${COMMON_DEPEND} )
+"
+
+RDEPEND="${DEPEND}"
+
+# Fixes for the JUCE issues the latter 3 patches work around have been
+# submitted upstream, but have not been merged yet:
+# https://github.com/juce-framework/JUCE/pull/1239
+PATCHES=(
+       "${FILESDIR}/${P}-tests.patch"
+       "${FILESDIR}/${P}-Patch-out-use-of-execinfo.h.patch"
+       "${FILESDIR}/${P}-Patch-out-use-of-stat64.patch"
+       "${FILESDIR}/${P}-Patch-out-uses-of-nl_langinfo-for-musl.patch"
+)
+
+src_configure() {
+       # Bug #925672
+       append-atomic-flags
+
+       local mycmakeargs=(
+               -DBUILD_LADSPA_PLUGIN=ON
+               -DBUILD_LV2_PLUGIN=$(usex lv2 ON OFF)
+               -DBUILD_VST_PLUGIN=$(usex vst ON OFF)
+               -DBUILD_VST3_PLUGIN=$(usex vst3 ON OFF)
+               -DBUILD_TESTS=$(usex test ON OFF)
+               -DBUILD_AU_PLUGIN=OFF
+               -DBUILD_AUV3_PLUGIN=OFF
+       )
+       cmake_src_configure
+}
+
+src_test() {
+       cp "${BUILD_DIR}/src/common/CTestTestfile.cmake" 
"${BUILD_DIR}/CTestTestfile.cmake" || die
+       cmake_src_test
+}
+
+src_install() {
+       cmake_src_install
+
+       dodir /usr/share/pipewire/pipewire.conf.avail/
+       sed 
"s|%PATH_TO_LADSPA_PLUGIN%|${EPREFIX}/usr/$(get_libdir)/ladspa/librnnoise_ladspa.so|"
 \
+               "${FILESDIR}/99-input-denoising.conf" \
+               > 
"${D}/${EPREFIX}/usr/share/pipewire/pipewire.conf.avail/99-input-denoising.conf"
 || die
+}
+
+pkg_postinst() {
+       elog "An example PipeWire configuration has been installed into:"
+       elog 
"${EPREFIX}/usr/share/pipewire/pipewire.conf.avail/99-input-denoising.conf"
+       elog ""
+       elog "You can enable it by copying or symlinking the file into:"
+       elog "  ~/.config/pipewire/pipewire.conf.d/ for your user, or"
+       elog "  /etc/pipewire/pipewire.conf.d/ to enable it system-wide."
+}

Reply via email to