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,35 +1,39 @@ PORTNAME= libopenshot-audio DISTVERSIONPREFIX= v DISTVERSION= 0.3.2 +PORTREVISION= 1 CATEGORIES= audio multimedia MAINTAINER= tatsuki_makino@hotmail.com COMMENT= OpenShot Audio Library WWW= https://www.openshot.org/ LICENSE= GPLv3+ LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libasound.so:audio/alsa-lib \ libsysinfo.so:devel/libsysinfo RUN_DEPENDS= ${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:audio/alsa-plugins USES= cmake compiler:c++14-lang USE_GITHUB= yes 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 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,90 +1,106 @@ ---- 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 ) +# Thread library +find_package(Threads REQUIRED) +if(Threads_FOUND) + target_link_libraries(openshot-audio PRIVATE ${CMAKE_THREAD_LIBS_INIT}) +endif(Threads_FOUND) + # Require language features we use if(CMAKE_VERSION VERSION_GREATER 3.8) target_compile_features(openshot-audio PUBLIC @@ -202,7 +208,8 @@ endif() # Enable stack-unwinding support in c objects on gcc-based platforms. # Failing to do so will cause your program to be terminated when a png # or a jpeg exception is thrown on linux or macosx. -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR + CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(openshot-audio PRIVATE -fexceptions) endif() @@ -265,8 +272,8 @@ if(UNIX AND NOT APPLE) INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIR} INTERFACE_LINK_LIBRARIES ${ALSA_LIBRARIES}) endif() - target_compile_definitions(openshot-audio PUBLIC LINUX) - target_link_libraries(openshot-audio PUBLIC ALSA::ALSA) + #target_compile_definitions(openshot-audio PUBLIC LINUX) + target_link_libraries(openshot-audio PRIVATE ALSA::ALSA) 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) -target_link_libraries(openshot-audio PUBLIC ZLIB::ZLIB) +target_link_libraries(openshot-audio PRIVATE ZLIB::ZLIB) +# 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) + find_package(PkgConfig QUIET) + if(NOT PKG_CONFIG_FOUND) + message(FATAL_ERROR "PKG_CONFIG_FOUND: ${PKG_CONFIG_FOUND}") + endif(NOT PKG_CONFIG_FOUND) + pkg_check_modules(JACK REQUIRED jack) + if(NOT JACK_FOUND) + message(FATAL_ERROR "JACK_FOUND: ${JACK_FOUND}") + endif(NOT JACK_FOUND) + if(NOT TARGET JACK::JACK) + add_library(JACK::JACK INTERFACE IMPORTED) + set_target_properties(JACK::JACK PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${JACK_INCLUDE_DIRS} + INTERFACE_LINK_LIBRARIES ${JACK_LINK_LIBRARIES}) + 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 -target_link_libraries(openshot-audio PUBLIC ${CMAKE_DL_LIBS}) +target_link_libraries(openshot-audio PRIVATE ${CMAKE_DL_LIBS}) # Create an alias so our EXPORT target name works internally, as well add_library(OpenShot::Audio ALIAS openshot-audio) 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]); + } + } +