Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 May 2024 15:06:00 GMT
From:      Vladimir Druzenko <vvd@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 69132b6a36d2 - main - audio/libopenshot-audio: fix OPTIONS
Message-ID:  <202405061506.446F60x8004410@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=69132b6a36d2e845e09165330f1112379a2c4df3

commit 69132b6a36d2e845e09165330f1112379a2c4df3
Author:     Tatsuki Makino <tatsuki_makino@hotmail.com>
AuthorDate: 2024-05-06 14:57:18 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-05-06 15:05:32 +0000

    audio/libopenshot-audio: fix OPTIONS
    
    Documents that require doxygen have been separated into DOXYGEN option.
    It is off by default.
    JACK option has been changed. It seems to be no longer experimental,
    but there will be bugs
    
    PR:     277647
---
 audio/libopenshot-audio/Makefile                   |  20 ++--
 audio/libopenshot-audio/files/patch-CMakeLists.txt |  44 ++++++---
 ...udio__devices_native_juce__linux__JackAudio.cpp | 104 +++++++++++++++++++++
 3 files changed, 146 insertions(+), 22 deletions(-)

diff --git a/audio/libopenshot-audio/Makefile b/audio/libopenshot-audio/Makefile
index 9ce7ee009c86..efc550615284 100644
--- a/audio/libopenshot-audio/Makefile
+++ b/audio/libopenshot-audio/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	libopenshot-audio
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.3.2
+PORTREVISION=	1
 CATEGORIES=	audio multimedia
 
 MAINTAINER=	tatsuki_makino@hotmail.com
@@ -20,16 +21,19 @@ GH_ACCOUNT=	OpenShot
 USE_LDCONFIG=	yes
 CMAKE_ON=	AUTO_INSTALL_DOCS
 CMAKE_OFF=	APPIMAGE_BUILD
+DEBUG_FLAGS?=	-g
+DEBUG_FLAGS+=	-D_DEBUG -DJUCE_FORCE_DEBUG=1
 
-OPTIONS_DEFINE=	DOCS JACK
-JACK_DESC=	JACK audio server support (experimental)
-DOCS_BUILD_DEPENDS=	doxygen:devel/doxygen
-DOCS_CMAKE_BOOL=	ENABLE_AUDIO_DOCS
-DOCS_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_Doxygen
-DOCS_CMAKE_ON=	-DCMAKE_INSTALL_DOCDIR:PATH=${DOCSDIR_REL:Q}
-DOCS_PORTDOCS=	*
+OPTIONS_DEFINE=		DOCS DOXYGEN JACK
+DOCS_CMAKE_ON=		-DCMAKE_INSTALL_DOCDIR:PATH=${DOCSDIR_REL:Q}
+DOCS_PORTDOCS=		*
+DOXYGEN_IMPLIES=	DOCS
+DOXYGEN_BUILD_DEPENDS=	doxygen:devel/doxygen
+DOXYGEN_CMAKE_BOOL=	ENABLE_AUDIO_DOCS
+DOXYGEN_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_Doxygen
 JACK_LIB_DEPENDS=	libjack.so:audio/jack
-JACK_USES=	pkgconfig
+JACK_USES=		pkgconfig
 JACK_CMAKE_BOOL=	ENABLE_JACK
+JACK_CMAKE_ON=		-DJUCE_JACK_CLIENT_NAME:STRING=
 
 .include <bsd.port.mk>
diff --git a/audio/libopenshot-audio/files/patch-CMakeLists.txt b/audio/libopenshot-audio/files/patch-CMakeLists.txt
index 77d703632177..803837b54fbe 100644
--- a/audio/libopenshot-audio/files/patch-CMakeLists.txt
+++ b/audio/libopenshot-audio/files/patch-CMakeLists.txt
@@ -1,4 +1,4 @@
---- CMakeLists.txt.orig	2023-03-21 22:56:18 UTC
+--- CMakeLists.txt.orig	2023-04-17 13:00:42 UTC
 +++ CMakeLists.txt
 @@ -184,6 +184,12 @@ set_target_properties(openshot-audio PROPERTIES
    EXPORT_NAME Audio  # Exports as OpenShot::Audio target
@@ -34,7 +34,7 @@
  else()
    # For EXPORTED Config
    set(NEED_ALSA FALSE)
-@@ -274,10 +281,51 @@ endif()
+@@ -274,10 +281,67 @@ endif()
  
  # ZLIB -- uses IMPORTED target ZLIB::ZLIB which has existed since CMake 3.1
  find_package(ZLIB REQUIRED)
@@ -43,24 +43,35 @@
  
 +# EXECINFO, SYSINFO
 +include(CheckFunctionExists)
-+check_function_exists("backtrace" FUNCTION_BACKTRACE_FOUND)
++include(CheckLibraryExists)
++check_function_exists(backtrace FUNCTION_BACKTRACE_FOUND)
 +if(NOT FUNCTION_BACKTRACE_FOUND)
 +	find_library(EXECINFO_LIBRARY NAMES execinfo)
-+	if(NOT EXECINFO_LIBRARY)
-+		message(FATAL_ERROR "${EXECINFO_LIBRARY}")
-+	endif(NOT EXECINFO_LIBRARY)
-+	target_link_libraries(openshot-audio PRIVATE ${EXECINFO_LIBRARY})
++	if(EXECINFO_LIBRARY)
++		unset(FUNCTION_BACKTRACE_FOUND CACHE)
++		check_library_exists(${EXECINFO_LIBRARY} backtrace "" FUNCTION_BACKTRACE_FOUND)
++	endif(EXECINFO_LIBRARY)
++endif(NOT FUNCTION_BACKTRACE_FOUND)
++if(NOT FUNCTION_BACKTRACE_FOUND)
++	message(FATAL_ERROR "backtrace - ${FUNCTION_BACKTRACE_FOUND}")
 +endif(NOT FUNCTION_BACKTRACE_FOUND)
-+unset(FUNCTION_BACKTRACE_FOUND)
-+check_function_exists("sysinfo" FUNCTION_SYSINFO_FOUND)
++if(EXECINFO_LIBRARY)
++	target_link_libraries(openshot-audio PRIVATE ${EXECINFO_LIBRARY})
++endif(EXECINFO_LIBRARY)
++check_function_exists(sysinfo FUNCTION_SYSINFO_FOUND)
 +if(NOT FUNCTION_SYSINFO_FOUND)
 +	find_library(SYSINFO_LIBRARY NAMES sysinfo)
-+	if(NOT SYSINFO_LIBRARY)
-+		message(FATAL_ERROR "${SYSINFO_LIBRARY}")
-+	endif(NOT SYSINFO_LIBRARY)
-+	target_link_libraries(openshot-audio PRIVATE ${SYSINFO_LIBRARY})
++	if(SYSINFO_LIBRARY)
++		unset(FUNCTION_SYSINFO_FOUND CACHE)
++		check_library_exists(${SYSINFO_LIBRARY} sysinfo "" FUNCTION_SYSINFO_FOUND)
++	endif(SYSINFO_LIBRARY)
++endif(NOT FUNCTION_SYSINFO_FOUND)
++if(NOT FUNCTION_SYSINFO_FOUND)
++	message(FATAL_ERROR "sysinfo - ${FUNCTION_SYSINFO_FOUND}")
 +endif(NOT FUNCTION_SYSINFO_FOUND)
-+unset(FUNCTION_SYSINFO_FOUND)
++if(SYSINFO_LIBRARY)
++	target_link_libraries(openshot-audio PRIVATE ${SYSINFO_LIBRARY})
++endif(SYSINFO_LIBRARY)
 +
 +# JACK
 +if(ENABLE_JACK)
@@ -80,6 +91,11 @@
 +	endif(NOT TARGET JACK::JACK)
 +	target_link_libraries(openshot-audio PRIVATE JACK::JACK)
 +	target_compile_definitions(openshot-audio PRIVATE JUCE_JACK=1)
++	if(DEFINED JUCE_JACK_CLIENT_NAME AND NOT JUCE_JACK_CLIENT_NAME STREQUAL "")
++		target_compile_definitions(openshot-audio PRIVATE "JUCE_JACK_CLIENT_NAME=\"${JUCE_JACK_CLIENT_NAME}\"")
++	else(DEFINED JUCE_JACK_CLIENT_NAME AND NOT JUCE_JACK_CLIENT_NAME STREQUAL "")
++		target_compile_definitions(openshot-audio PRIVATE "JUCE_JACK_CLIENT_NAME=\"${PROJECT_NAME}\"")
++	endif(DEFINED JUCE_JACK_CLIENT_NAME AND NOT JUCE_JACK_CLIENT_NAME STREQUAL "")
 +endif(ENABLE_JACK)
 +
  # Link with dynamic loader for platform
diff --git a/audio/libopenshot-audio/files/patch-JuceLibraryCode_modules_juce__audio__devices_native_juce__linux__JackAudio.cpp b/audio/libopenshot-audio/files/patch-JuceLibraryCode_modules_juce__audio__devices_native_juce__linux__JackAudio.cpp
new file mode 100644
index 000000000000..f64208c6b74a
--- /dev/null
+++ b/audio/libopenshot-audio/files/patch-JuceLibraryCode_modules_juce__audio__devices_native_juce__linux__JackAudio.cpp
@@ -0,0 +1,104 @@
+--- JuceLibraryCode/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp.orig	2023-04-17 13:00:42 UTC
++++ JuceLibraryCode/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp
+@@ -175,6 +175,8 @@ class JackAudioIODevice   : public AudioIODevice (publ
+         {
+             juce::jack_set_error_function (errorCallback);
+ 
++            if (inputId.isNotEmpty())
++            {
+             // open input ports
+             const StringArray inputChannels (getInputChannelNames());
+             for (int i = 0; i < inputChannels.size(); ++i)
+@@ -185,7 +187,10 @@ class JackAudioIODevice   : public AudioIODevice (publ
+                 inputPorts.add (juce::jack_port_register (client, inputName.toUTF8(),
+                                                           JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0));
+             }
++            }
+ 
++            if (outputId.isNotEmpty())
++            {
+             // open output ports
+             const StringArray outputChannels (getOutputChannelNames());
+             for (int i = 0; i < outputChannels.size(); ++i)
+@@ -196,6 +201,7 @@ class JackAudioIODevice   : public AudioIODevice (publ
+                 outputPorts.add (juce::jack_port_register (client, outputName.toUTF8(),
+                                                            JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0));
+             }
++            }
+ 
+             inChans.calloc (totalNumberOfInputChannels + 2);
+             outChans.calloc (totalNumberOfOutputChannels + 2);
+@@ -273,26 +279,40 @@ class JackAudioIODevice   : public AudioIODevice (publ
+ 
+         if (! inputChannels.isZero())
+         {
+-            for (JackPortIterator i (client, true); i.next();)
++            int idx = 0;
++            for (JackPortIterator i (client, true); i.next() && idx < inputPorts.size();)
+             {
+-                if (inputChannels [i.index] && i.clientName == getName())
++                if (i.clientName != getName())
++                    continue;
++                if (inputChannels [idx])
+                 {
+-                    int error = juce::jack_connect (client, i.ports[i.index], juce::jack_port_name ((jack_port_t*) inputPorts[i.index]));
++                    int error = juce::jack_connect (client, i.ports[i.index], juce::jack_port_name ((jack_port_t*) inputPorts[idx]));
+                     if (error != 0)
++                    {
+                         JUCE_JACK_LOG ("Cannot connect input port " + String (i.index) + " (" + i.name + "), error " + String (error));
++                    }
++                    else
++                        ++idx;
+                 }
+             }
+         }
+ 
+         if (! outputChannels.isZero())
+         {
+-            for (JackPortIterator i (client, false); i.next();)
++            int idx = 0;
++            for (JackPortIterator i (client, false); i.next() && idx < outputPorts.size();)
+             {
+-                if (outputChannels [i.index] && i.clientName == getName())
++                if (i.clientName != getName())
++                    continue;
++                if (outputChannels [idx])
+                 {
+-                    int error = juce::jack_connect (client, juce::jack_port_name ((jack_port_t*) outputPorts[i.index]), i.ports[i.index]);
++                    int error = juce::jack_connect (client, juce::jack_port_name ((jack_port_t*) outputPorts[idx]), i.ports[i.index]);
+                     if (error != 0)
++                    {
+                         JUCE_JACK_LOG ("Cannot connect output port " + String (i.index) + " (" + i.name + "), error " + String (error));
++                    }
++                    else
++                        ++idx;
+                 }
+             }
+         }
+@@ -536,20 +556,20 @@ class JackAudioIODeviceType  : public AudioIODeviceTyp
+             // scan for output devices
+             for (JackPortIterator i (client, false); i.next();)
+             {
+-                if (i.clientName != (JUCE_JACK_CLIENT_NAME) && ! inputNames.contains (i.clientName))
++                if (i.clientName != (JUCE_JACK_CLIENT_NAME) && ! outputNames.contains (i.clientName))
+                 {
+-                    inputNames.add (i.clientName);
+-                    inputIds.add (i.ports [i.index]);
++                    outputNames.add (i.clientName);
++                    outputIds.add (i.ports [i.index]);
+                 }
+             }
+ 
+             // scan for input devices
+             for (JackPortIterator i (client, true); i.next();)
+             {
+-                if (i.clientName != (JUCE_JACK_CLIENT_NAME) && ! outputNames.contains (i.clientName))
++                if (i.clientName != (JUCE_JACK_CLIENT_NAME) && ! inputNames.contains (i.clientName))
+                 {
+-                    outputNames.add (i.clientName);
+-                    outputIds.add (i.ports [i.index]);
++                    inputNames.add (i.clientName);
++                    inputIds.add (i.ports [i.index]);
+                 }
+             }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405061506.446F60x8004410>