From e649013578c066d7ea2f49eec5f4f0a5e4d6d6f9 Mon Sep 17 00:00:00 2001
From: davidkaroly <92124087+davidkaroly@users.noreply.github.com>
Date: Sat, 11 Feb 2023 08:31:53 +0100
Subject: [PATCH] tenacity-1.3~beta: new recipe (#7806)
* tenacity-1.3~beta: new recipe
* tenacity: fix progress indicator refresh issue
---
.../additional-files/tenacity.rdef.in | 16 ++
.../patches/tenacity-1.3~beta.patchset | 226 ++++++++++++++++++
media-sound/tenacity/tenacity-1.3~beta.recipe | 148 ++++++++++++
3 files changed, 390 insertions(+)
create mode 100644 media-sound/tenacity/additional-files/tenacity.rdef.in
create mode 100644 media-sound/tenacity/patches/tenacity-1.3~beta.patchset
create mode 100644 media-sound/tenacity/tenacity-1.3~beta.recipe
diff --git a/media-sound/tenacity/additional-files/tenacity.rdef.in b/media-sound/tenacity/additional-files/tenacity.rdef.in
new file mode 100644
index 000000000..653cacff1
--- /dev/null
+++ b/media-sound/tenacity/additional-files/tenacity.rdef.in
@@ -0,0 +1,16 @@
+
+resource app_flags B_SINGLE_LAUNCH;
+
+resource app_version {
+ major = @MAJOR@,
+ middle = @MIDDLE@,
+ minor = @MINOR@,
+
+ variety = B_APPV_FINAL,
+ internal = 0,
+
+ short_info = "Tenacity",
+ long_info = "@LONG_INFO@"
+};
+
+resource app_signature "@APP_SIGNATURE@";
diff --git a/media-sound/tenacity/patches/tenacity-1.3~beta.patchset b/media-sound/tenacity/patches/tenacity-1.3~beta.patchset
new file mode 100644
index 000000000..245eb9d16
--- /dev/null
+++ b/media-sound/tenacity/patches/tenacity-1.3~beta.patchset
@@ -0,0 +1,226 @@
+From 5bda751f0680b3c83c474f36d338c0c1e71e7aa2 Mon Sep 17 00:00:00 2001
+From: David Karoly
+Date: Tue, 24 Jan 2023 19:45:07 +0100
+Subject: Adjust LIBDIR for Haiku
+
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 71bf60c..0a63fbe 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -362,7 +362,11 @@ endif()
+
+ set( _DEST "${_DESTDIR}" )
+ set( INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
+-set( _LIBDIR "${CMAKE_INSTALL_LIBDIR}" )
++if( CMAKE_SYSTEM_NAME MATCHES "Haiku" )
++ set( _LIBDIR "lib" )
++else()
++ set( _LIBDIR "${CMAKE_INSTALL_LIBDIR}" )
++endif()
+ set( _DATADIR "${CMAKE_INSTALL_DATADIR}" )
+ set( _PKGLIB "${_LIBDIR}/tenacity" )
+ set( _PKGDATA "${_DATADIR}/tenacity/" )
+--
+2.37.3
+
+
+From 1552f3d4a760d10854390c2055ed718803d0dc91 Mon Sep 17 00:00:00 2001
+From: David Karoly
+Date: Tue, 24 Jan 2023 19:45:07 +0100
+Subject: Fix GTK include paths and libs
+
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0a63fbe..23e1e6b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -750,6 +750,11 @@ if(NOT TARGET wxWidgets::wxWidgets)
+ add_library(wxWidgets::wxWidgets INTERFACE IMPORTED)
+ target_link_libraries(wxWidgets::wxWidgets INTERFACE ${wxWidgets_LIBRARIES})
+ target_compile_definitions(wxWidgets::wxWidgets INTERFACE ${wxWidgets_DEFINITIONS} ${wxWidgets_DEFINITIONS_DEBUG})
++
++ target_include_directories( wxWidgets::wxWidgets INTERFACE ${GTK_INCLUDE_DIRS} )
++ target_link_directories( wxWidgets::wxWidgets INTERFACE ${GTK_LIB_DIR} )
++ target_link_libraries( wxWidgets::wxWidgets INTERFACE ${GTK_LIBRARIES} )
++
+ endif()
+
+ add_subdirectory(lib-src/libnyquist)
+--
+2.37.3
+
+
+From dd984e544e8528ac6ce057ebe279e6d001724cd0 Mon Sep 17 00:00:00 2001
+From: David Karoly
+Date: Tue, 24 Jan 2023 19:45:07 +0100
+Subject: Haiku: initialize XDG vars
+
+
+diff --git a/src/TenacityApp.cpp b/src/TenacityApp.cpp
+index 57bff6e..cd02057 100644
+--- a/src/TenacityApp.cpp
++++ b/src/TenacityApp.cpp
+@@ -50,6 +50,12 @@ It handles initialization and termination by subclassing wxApp.
+ #endif
+ #endif
+
++#ifdef __HAIKU__
++#include
++#include
++#include
++#endif
++
+ // chmod, lstat, geteuid
+ #ifdef __UNIX__
+
+@@ -498,6 +504,30 @@ int main(int argc, char *argv[])
+ IMPLEMENT_APP_NO_MAIN(TenacityApp)
+ IMPLEMENT_WX_THEME_SUPPORT
+
++#ifdef __HAIKU__
++void initialize_xdg_paths(void)
++{
++ char dir[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
++ char dirs[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
++ dev_t volume = dev_for_path("/boot");
++
++ if (find_directory(B_SYSTEM_SETTINGS_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK)
++ g_setenv ("XDG_CONFIG_DIRS", dir, FALSE);
++ if (find_directory(B_USER_NONPACKAGED_DATA_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK)
++ g_setenv ("XDG_DATA_HOME", dir, FALSE);
++ if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK)
++ g_setenv ("XDG_CONFIG_HOME", dir, FALSE);
++ if (find_directory(B_USER_CACHE_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK)
++ g_setenv ("XDG_CACHE_HOME", dir, FALSE);
++ if (find_directory(B_SYSTEM_DATA_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK &&
++ find_directory(B_SYSTEM_NONPACKAGED_DATA_DIRECTORY, volume, false, dirs, sizeof(dirs)) == B_OK) {
++ strcat(dirs, ":");
++ strcat(dirs, dir);
++ g_setenv ("XDG_DATA_DIRS", dirs, FALSE);
++ }
++}
++#endif
++
+ int main(int argc, char *argv[])
+ {
+ wxDISABLE_DEBUG_SUPPORT();
+@@ -510,6 +540,10 @@ int main(int argc, char *argv[])
+ stdout = freopen("/dev/null", "w", stdout);
+ stderr = freopen("/dev/null", "w", stderr);
+
++#ifdef __HAIKU__
++ initialize_xdg_paths();
++#endif
++
+ return wxEntry(argc, argv);
+ }
+
+--
+2.37.3
+
+
+From 6d7aa4415e1f8e72840a8b6192ab63ad5da8e932 Mon Sep 17 00:00:00 2001
+From: David Karoly
+Date: Tue, 24 Jan 2023 19:45:07 +0100
+Subject: Release sLocale smart pointer before exit. Fixes crash on exit.
+
+
+diff --git a/libraries/lib-strings/Languages.cpp b/libraries/lib-strings/Languages.cpp
+index 15ac86e..b536cfd 100644
+--- a/libraries/lib-strings/Languages.cpp
++++ b/libraries/lib-strings/Languages.cpp
+@@ -325,6 +325,11 @@ void GetLanguages( FilePaths pathList,
+ static std::unique_ptr sLocale;
+ static wxString sLocaleName;
+
++void UnsetLocale(void)
++{
++ sLocale.reset();
++}
++
+ wxString SetLang( const FilePaths &pathList, const wxString & lang )
+ {
+ wxString result = lang;
+diff --git a/libraries/lib-strings/Languages.h b/libraries/lib-strings/Languages.h
+index 81092d0..d9068f8 100644
+--- a/libraries/lib-strings/Languages.h
++++ b/libraries/lib-strings/Languages.h
+@@ -36,6 +36,9 @@ void GetLanguages( FilePaths pathList,
+ STRINGS_API
+ wxString GetSystemLanguageCode(const FilePaths &pathList);
+
++STRINGS_API
++void UnsetLocale(void);
++
+ /*!
+ @param tenacityPathList paths to search for .mo files, grouped into subdirectories for the different languages
+ @param lang a language code; or if empty or "System", then default to system language.
+diff --git a/src/TenacityApp.cpp b/src/TenacityApp.cpp
+index cd02057..b84ea3f 100644
+--- a/src/TenacityApp.cpp
++++ b/src/TenacityApp.cpp
+@@ -544,7 +544,9 @@ int main(int argc, char *argv[])
+ initialize_xdg_paths();
+ #endif
+
+- return wxEntry(argc, argv);
++ int res = wxEntry(argc, argv);
++ Languages::UnsetLocale();
++ return res;
+ }
+
+ #else
+--
+2.37.3
+
+
+From b88772605e00220d6f1885c34c501b00583fa506 Mon Sep 17 00:00:00 2001
+From: David Karoly
+Date: Tue, 24 Jan 2023 19:45:07 +0100
+Subject: Fix broken link in welcome dialog box
+
+
+diff --git a/src/HelpText.cpp b/src/HelpText.cpp
+index 2d1b86d..0cf239a 100644
+--- a/src/HelpText.cpp
++++ b/src/HelpText.cpp
+@@ -234,7 +234,7 @@ static wxString HelpTextBuiltIn( const wxString & Key )
+ " [[help:Main_Page|Audacity Manual]] - if not installed locally, [[https://manual.audacityteam.org/|view online]]")
+ << wxT("")
+ << XO(
+-" [[https://github.com/tenacitytenacity/tenacity/discussions|Discussions (on GitHub)]] - ask your question directly, online.")
++" [[https://github.com/tenacityteam/tenacity-legacy/discussions|Discussions (on GitHub)]] - ask your question directly, online.")
+ << wxT("
")
+ << wxT("")
+ << XO("More: Visit our [[https://codeberg.org/tenacityteam/tenacity/wiki|Wiki]] for tips, tricks, extra tutorials and effects plug-ins.")
+--
+2.37.3
+
+
+From 14bea3df94b16ebc2b46bfb52a0a5eb09b676da1 Mon Sep 17 00:00:00 2001
+From: David Karoly
+Date: Tue, 7 Feb 2023 19:56:39 +0100
+Subject: OverlayPanel: call RefreshRect from DrawOverlays
+
+
+diff --git a/src/widgets/OverlayPanel.cpp b/src/widgets/OverlayPanel.cpp
+index cfca34d..0fec289 100644
+--- a/src/widgets/OverlayPanel.cpp
++++ b/src/widgets/OverlayPanel.cpp
+@@ -124,6 +124,12 @@ void OverlayPanel::DrawOverlays(bool repaint_all, wxDC *pDC)
+ }
+ ++it2;
+ }
++
++ for (const auto& pair : pairs) {
++ if (repaint_all || pair.second) {
++ RefreshRect(pair.first);
++ }
++ }
+ }
+
+ void OverlayPanel::Compress()
+--
+2.37.3
+
diff --git a/media-sound/tenacity/tenacity-1.3~beta.recipe b/media-sound/tenacity/tenacity-1.3~beta.recipe
new file mode 100644
index 000000000..02eadf6ee
--- /dev/null
+++ b/media-sound/tenacity/tenacity-1.3~beta.recipe
@@ -0,0 +1,148 @@
+SUMMARY="An easy-to-use, cross-platform multi-track audio editor/recorder"
+DESCRIPTION="Tenacity is an easy-to-use, cross-platform multi-track \
+audio editor/recorder for Windows, macOS, Linux and other operating \
+systems and is developed by a group of volunteers as open-source software."
+HOMEPAGE="https://www.tenacityaudio.org"
+COPYRIGHT="2021-2023 by Tenacity Team"
+LICENSE="GNU GPL v2"
+REVISION="1"
+srcGitRev="v1.3-beta"
+srcGitDate="22 Jan 2023"
+SOURCE_URI="https://codeberg.org/tenacityteam/tenacity/archive/${srcGitRev}.tar.gz"
+CHECKSUM_SHA256="10577327867fc5463b72e19f94064feaf541b081ce6c882dbc0801311b80470d"
+SOURCE_DIR="tenacity"
+PATCHES="tenacity-$portVersion.patchset"
+ADDITIONAL_FILES="tenacity.rdef.in"
+
+ARCHITECTURES="?all !x86_gcc2"
+SECONDARY_ARCHITECTURES="?x86"
+
+PROVIDES="
+ tenacity$secondaryArchSuffix = $portVersion
+ app:Tenadacity$secondaryArchSuffix = $portVersion
+ cmd:tenacity
+ "
+REQUIRES="
+ haiku$secondaryArchSuffix
+ wxgtk$secondaryArchSuffix
+ lib:libatk_1.0$secondaryArchSuffix
+ lib:libatomic$secondaryArchSuffix
+ lib:libavcodec$secondaryArchSuffix
+ lib:libavformat$secondaryArchSuffix
+ lib:libavutil$secondaryArchSuffix
+ lib:libcairo$secondaryArchSuffix
+ lib:libexpat$secondaryArchSuffix
+ lib:libflac$secondaryArchSuffix
+ lib:libgdk_pixbuf_2.0$secondaryArchSuffix
+ lib:libglib_2.0$secondaryArchSuffix
+ lib:libgtk_3$secondaryArchSuffix
+ lib:libharfbuzz$secondaryArchSuffix
+ lib:libiconv$secondaryArchSuffix
+ lib:libid3tag$secondaryArchSuffix
+ lib:libintl$secondaryArchSuffix
+ lib:libmad$secondaryArchSuffix
+ lib:libmp3lame$secondaryArchSuffix
+ lib:libogg$secondaryArchSuffix
+ lib:libopus$secondaryArchSuffix
+ lib:libpango_1.0$secondaryArchSuffix
+ lib:libportaudio$secondaryArchSuffix
+ lib:libportmidi$secondaryArchSuffix
+ lib:libportsmf$secondaryArchSuffix
+ lib:libsndfile$secondaryArchSuffix
+ lib:libsoundtouch$secondaryArchSuffix
+ lib:libsoxr$secondaryArchSuffix
+ lib:libsqlite3$secondaryArchSuffix
+ lib:libtwolame$secondaryArchSuffix
+ lib:libuuid$secondaryArchSuffix
+ lib:libvorbis$secondaryArchSuffix
+ lib:libX11$secondaryArchSuffix
+ lib:libz$secondaryArchSuffix
+ "
+
+BUILD_REQUIRES="
+ haiku${secondaryArchSuffix}_devel
+ wxgtk${secondaryArchSuffix}_devel
+ devel:libavcodec$secondaryArchSuffix
+ devel:libavformat$secondaryArchSuffix
+ devel:libavutil$secondaryArchSuffix
+ devel:libexpat$secondaryArchSuffix
+ devel:libflac$secondaryArchSuffix
+ devel:libglib_2.0$secondaryArchSuffix
+ devel:libgtk_3$secondaryArchSuffix
+ devel:libiconv$secondaryArchSuffix
+ devel:libid3tag$secondaryArchSuffix
+ devel:libintl$secondaryArchSuffix
+ devel:libmad$secondaryArchSuffix
+ devel:libmp3lame$secondaryArchSuffix
+ devel:libogg$secondaryArchSuffix
+ devel:libopus$secondaryArchSuffix
+ devel:libportaudio$secondaryArchSuffix
+ devel:libportmidi$secondaryArchSuffix
+ devel:libportsmf$secondaryArchSuffix
+ #devel:libpostproc$secondaryArchSuffix
+ devel:libsndfile$secondaryArchSuffix
+ devel:libsoundtouch$secondaryArchSuffix
+ devel:libsoxr$secondaryArchSuffix
+ devel:libsqlite3$secondaryArchSuffix
+ devel:libtwolame$secondaryArchSuffix
+ devel:libuuid$secondaryArchSuffix
+ devel:libvorbis$secondaryArchSuffix
+ devel:libz$secondaryArchSuffix
+ "
+BUILD_PREREQUIRES="
+ cmd:awk
+ cmd:cmake
+ cmd:diff
+ cmd:find
+ cmd:gcc$secondaryArchSuffix
+ cmd:gettext$secondaryArchSuffix
+ cmd:ld$secondaryArchSuffix
+ cmd:ninja
+ cmd:pkg_config$secondaryArchSuffix
+ cmd:which
+ cmd:wx_config$secondaryArchSuffix
+ "
+
+defineDebugInfoPackage tenacity$secondaryArchSuffix \
+ $prefix/bin/tenacity
+
+BUILD()
+{
+ mkdir -p build/src/private
+ cmake -S . -B build -G Ninja \
+ $cmakeDirArgs \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DAUDACITY_REV_LONG="$srcGitRev" \
+ -DAUDACITY_REV_TIME="$srcGitDate" \
+ -DPCH=no
+ cmake --build build $jobArgs
+}
+
+INSTALL()
+{
+ cmake --install build
+
+ if [ $effectiveTargetArchitecture = x86 ]; then
+ mv $binDir/* $prefix/bin/
+ fi
+
+ mkdir -p $appsDir
+ ln -s $prefix/bin/tenacity $appsDir/Tenacity
+
+ local APP_SIGNATURE="application/x-vnd.tenacity"
+ local MAJOR="`echo "$portVersion" | cut -d~ -f1 | cut -d. -f1`"
+ local MIDDLE="`echo "$portVersion" | cut -d~ -f1 | cut -d. -f2`"
+ #local MINOR="`echo "$portVersion" | cut -d~ -f1 | cut -d. -f3`"
+ local MINOR="0"
+ local LONG_INFO="$SUMMARY"
+ sed \
+ -e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
+ -e "s|@MAJOR@|$MAJOR|" \
+ -e "s|@MIDDLE@|$MIDDLE|" \
+ -e "s|@MINOR@|$MINOR|" \
+ -e "s|@LONG_INFO@|$LONG_INFO|" \
+ $portDir/additional-files/tenacity.rdef.in > $sourceDir/tenacity.rdef
+ addResourcesToBinaries $sourceDir/tenacity.rdef $appsDir/Tenacity
+
+ addAppDeskbarSymlink $appsDir/Tenacity
+}