Files
haikuports/media-sound/audacity/patches/audacity-3.7.1.patchset
2025-03-04 11:29:03 +10:00

474 lines
15 KiB
Plaintext

From ea1276f81c2752d9e36ef96867761d9412d5863f Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Mon, 7 Nov 2022 14:27:23 +0100
Subject: nyquist: fix build on Haiku
diff --git a/lib-src/libnyquist/nyquist/xlisp/xlisp.h b/lib-src/libnyquist/nyquist/xlisp/xlisp.h
index 3b03c09..deba6b2 100644
--- a/lib-src/libnyquist/nyquist/xlisp/xlisp.h
+++ b/lib-src/libnyquist/nyquist/xlisp/xlisp.h
@@ -27,6 +27,10 @@ extern "C" {
#include <ctype.h>
#include <setjmp.h>
+#ifdef __HAIKU__
+#include <stdint.h>
+#endif
+
/* NNODES number of nodes to allocate in each request (1000) */
/* EDEPTH evaluation stack depth (2000) */
/* ADEPTH argument stack depth (1000) */
@@ -197,6 +201,10 @@ extern long ptrtoabs();
#endif
#endif
+#ifdef __HAIKU__
+#define XL_LITTLE_ENDIAN
+#endif
+
/* default important definitions */
#ifndef NNODES
#define NNODES 1000
--
2.48.1
From db4ea8870a0dac3c1d80923cb4fe8be63c9ed988 Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Mon, 7 Nov 2022 14:17:48 +0100
Subject: portmixer: fix build on Haiku
diff --git a/cmake-proxies/cmake-modules/FindOSS.cmake b/cmake-proxies/cmake-modules/FindOSS.cmake
index b6e061a..9c747d0 100644
--- a/cmake-proxies/cmake-modules/FindOSS.cmake
+++ b/cmake-proxies/cmake-modules/FindOSS.cmake
@@ -3,6 +3,10 @@ A module to look for OSS
]]
if( NOT OSS_FOUND )
+ find_path(HAIKU_OSS_INCLUDE_DIR "private/audio/soundcard.h"
+ HINTS "/system/develop/headers"
+ )
+
find_path(LINUX_OSS_INCLUDE_DIR "linux/soundcard.h"
HINTS "/usr/include" "/usr/local/include"
)
@@ -15,11 +19,17 @@ if( NOT OSS_FOUND )
HINTS "/usr/include" "/usr/local/include"
)
+ set( HAVE_HAIKU_SOUNDCARD_H No CACHE BOOL "private/audio/soundcard.h is available" FORCE )
set( HAVE_SYS_SOUNDCARD_H No CACHE BOOL "sys/soundcard.h is available" FORCE )
set( HAVE_LINUX_SOUNDCARD_H No CACHE BOOL "linux/soundcard.h is available" FORCE )
set( HAVE_MACHINE_SOUNDCARD_H No CACHE BOOL "machine/soundcard.h is available" FORCE )
- if( LINUX_OSS_INCLUDE_DIR )
+ if( HAIKU_OSS_INCLUDE_DIR )
+ set( OSS_FOUND True )
+ set( OSS_INCLUDE_DIR ${HAIKU_OSS_INCLUDE_DIR} )
+ set( HAVE_HAIKU_SOUNDCARD_H Yes CACHE BOOL "private/audio/soundcard.h is available" FORCE )
+ list( APPEND OSS_DEFINITIONS HAVE_HAIKU_SOUNDCARD_H=1 )
+ elseif( LINUX_OSS_INCLUDE_DIR )
set( OSS_FOUND True )
set( OSS_INCLUDE_DIR ${LINUX_OSS_INCLUDE_DIR} )
set( HAVE_LINUX_SOUNDCARD_H Yes CACHE BOOL "sys/soundcard.h is available" FORCE )
diff --git a/lib-src/portmixer/src/px_unix_oss.c b/lib-src/portmixer/src/px_unix_oss.c
index 978f27b..eb44dce 100644
--- a/lib-src/portmixer/src/px_unix_oss.c
+++ b/lib-src/portmixer/src/px_unix_oss.c
@@ -46,7 +46,9 @@
#include <sys/ioctl.h>
#include <ctype.h>
-#if defined(HAVE_SYS_SOUNDCARD_H)
+#if defined(HAVE_HAIKU_SOUNDCARD_H)
+# include <private/audio/soundcard.h>
+#elif defined(HAVE_SYS_SOUNDCARD_H)
# include <sys/soundcard.h>
#elif defined(HAVE_LINUX_SOUNDCARD_H)
# include <linux/soundcard.h>
--
2.48.1
From 2fe9bb2a1c48ba9d37b8e315627ade77f101e77a Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Mon, 7 Nov 2022 15:06:14 +0100
Subject: fix GTK include paths and libs
diff --git a/cmake-proxies/cmake-modules/dependencies/wxwidgets.cmake b/cmake-proxies/cmake-modules/dependencies/wxwidgets.cmake
index fa13a81..d48ac85 100644
--- a/cmake-proxies/cmake-modules/dependencies/wxwidgets.cmake
+++ b/cmake-proxies/cmake-modules/dependencies/wxwidgets.cmake
@@ -183,5 +183,9 @@ if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin" )
pkg_check_modules( GTK REQUIRED IMPORTED_TARGET GLOBAL ${gtk} )
pkg_check_modules( GLIB REQUIRED IMPORTED_TARGET GLOBAL ${glib} )
+
+ 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()
--
2.48.1
From 62356e0bc8f7695ce9db77fc8006bd795f0fd6b3 Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Mon, 7 Nov 2022 14:33:10 +0100
Subject: Adjust install rules for Haiku
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 91bc0a0..022f696 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1174,6 +1174,8 @@ elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
POST_BUILD
)
endif()
+elseif( CMAKE_SYSTEM_NAME MATCHES "Haiku" )
+ set_target_property_all( ${TARGET} RUNTIME_OUTPUT_DIRECTORY "${_DEST}" )
else()
set_target_properties(
${TARGET}
@@ -1416,8 +1418,10 @@ else()
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN "*.so*" )
- install( FILES "${_INTDIR}/audacity.desktop"
- DESTINATION "${_DATADIR}/applications" )
+ if( NOT CMAKE_SYSTEM_NAME MATCHES "Haiku" )
+ install( FILES "${_INTDIR}/audacity.desktop"
+ DESTINATION "${_DATADIR}/applications" )
+ endif()
if(${_OPT}has_url_schemes_support)
install( FILES "${_INTDIR}/audacity-url-handler.desktop"
--
2.48.1
From f88a03febd2da551a8863ad885a8eb3594c37afe Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Thu, 17 Nov 2022 20:54:07 +0100
Subject: Use POSIX shared memory and initialize XDG vars
diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp
index ad21187..36822c9 100644
--- a/src/AudacityApp.cpp
+++ b/src/AudacityApp.cpp
@@ -50,12 +50,19 @@ It handles initialization and termination by subclassing wxApp.
#endif
#endif
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#include <glib.h>
+#endif
+
// chmod, lstat, geteuid
#ifdef __UNIX__
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <stdio.h>
+#include <sys/mman.h>
#endif
#if defined(__WXMSW__)
@@ -861,6 +868,30 @@ public:
};
};
+#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
+
#if defined(__WXMAC__)
IMPLEMENT_APP_NO_MAIN(AudacityApp)
@@ -912,7 +943,13 @@ int main(int argc, char *argv[])
freopen("/dev/null", "w", stdout);
freopen("/dev/null", "w", stderr);
- return wxEntry(argc, argv);
+#ifdef __HAIKU__
+ initialize_xdg_paths();
+#endif
+
+ int res = wxEntry(argc, argv);
+ Languages::UnsetLocale();
+ return res;
}
#elif defined(__WXGTK__)
@@ -927,7 +964,13 @@ int main(int argc, char *argv[])
wxDISABLE_DEBUG_SUPPORT();
- return wxEntry(argc, argv);
+#ifdef __HAIKU__
+ initialize_xdg_paths();
+#endif
+
+ int res = wxEntry(argc, argv);
+ Languages::UnsetLocale();
+ return res;
}
wxIMPLEMENT_APP_NO_MAIN(AudacityApp);
@@ -1272,6 +1315,7 @@ bool AudacityApp::OSXIsGUIApplication()
AudacityApp::~AudacityApp()
{
+ shm_unlink("/AudacityShm");
}
void AudacityApp::ShowSplashScreen() {
@@ -2108,7 +2152,6 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
#include <sys/ipc.h>
#include <sys/sem.h>
-#include <sys/shm.h>
// Return true if there are no other instances of Audacity running,
// false otherwise.
@@ -2131,8 +2174,8 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
// Create and map the shared memory segment where the port number
// will be stored.
- int memid = shmget(memkey, sizeof(int), IPC_CREAT | S_IRUSR | S_IWUSR);
- if (memid == -1)
+ int memfd = shm_open("/AudacityShm", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
+ if (memfd == -1)
{
AudacityMessageBox(
XO("Unable to create shared memory segment.\n\n"
@@ -2143,7 +2186,28 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
return false;
}
- int *portnum = (int *) shmat(memid, nullptr, 0);
+ if (ftruncate(memfd, sizeof(int)) != 0)
+ {
+ AudacityMessageBox(
+ XO("Unable to initialize shared memory segment.\n\n"
+ "error code=%d : \"%s\".").Format(errno, strerror(errno)),
+ XO("Audacity Startup Failure"),
+ wxOK | wxICON_ERROR);
+
+ return false;
+ }
+
+ int *portnum = (int *) mmap(nullptr, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED, memfd, 0);
+ if (portnum == MAP_FAILED)
+ {
+ AudacityMessageBox(
+ XO("Unable to map shared memory segment.\n\n"
+ "error code=%d : \"%s\".").Format(errno, strerror(errno)),
+ XO("Audacity Startup Failure"),
+ wxOK | wxICON_ERROR);
+
+ return false;
+ }
// Create (or return) the SERVER semaphore ID
int servid = semget(servkey, 1, IPC_CREAT | S_IRUSR | S_IWUSR);
@@ -2286,6 +2350,8 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
return false;
}
+ munmap(portnum, sizeof(int));
+
// We've successfully created the socket server and the app
// should continue to initialize.
return true;
@@ -2383,6 +2449,8 @@ bool AudacityApp::CreateSingleInstanceChecker(const wxString &dir)
// Send an empty string to force existing Audacity to front
sock->WriteMsg(wxEmptyString, sizeof(wxChar));
+ munmap(portnum, sizeof(int));
+
// We've forwarded all of the filenames, so let the caller know
// to terminate.
return false;
--
2.48.1
From 4d56413a34321876a6f01f0f50fca8d084d6566e Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Sat, 17 Dec 2022 23:26:49 +0100
Subject: adjust paths for Haiku
diff --git a/libraries/lib-files/PathList.cpp b/libraries/lib-files/PathList.cpp
index df04dec..904d2a9 100644
--- a/libraries/lib-files/PathList.cpp
+++ b/libraries/lib-files/PathList.cpp
@@ -49,7 +49,7 @@ void FileNames::InitializePathList()
const auto portablePrefix = wxPathOnly(wxPathOnly(programPath));
// Make sure install prefix is set so wxStandardPath resolves paths properly
- if (wxDirExists(portablePrefix + L"/share/audacity")) {
+ if (wxDirExists(portablePrefix + L"/data/audacity")) {
// use prefix relative to executable location to make Audacity portable
standardPaths.SetInstallPrefix(portablePrefix);
} else {
@@ -117,9 +117,9 @@ void FileNames::InitializePathList()
audacityPathList);
FileNames::AddUniquePathToPathList(FileNames::ModulesDir(),
audacityPathList);
- FileNames::AddUniquePathToPathList(wxString::Format(installPrefix + L"/share/%s", wxT(AUDACITY_NAME)),
+ FileNames::AddUniquePathToPathList(wxString::Format(installPrefix + L"/data/%s", wxT(AUDACITY_NAME)),
audacityPathList);
- FileNames::AddUniquePathToPathList(wxString::Format(installPrefix + L"/share/doc/%s", wxT(AUDACITY_NAME)),
+ FileNames::AddUniquePathToPathList(wxString::Format(installPrefix + L"/data/doc/%s", wxT(AUDACITY_NAME)),
audacityPathList);
#else //AUDACITY_NAME
FileNames::AddUniquePathToPathList(wxString::Format(wxT("%s/.audacity-files"),
@@ -127,13 +127,13 @@ void FileNames::InitializePathList()
audacityPathList);
FileNames::AddUniquePathToPathList(FileNames::ModulesDir(),
audacityPathList);
- FileNames::AddUniquePathToPathList(installPrefix + L"/share/audacity",
+ FileNames::AddUniquePathToPathList(installPrefix + L"/data/audacity",
audacityPathList);
- FileNames::AddUniquePathToPathList(installPrefix + L"/share/doc/audacity",
+ FileNames::AddUniquePathToPathList(installPrefix + L"/data/doc/audacity",
audacityPathList);
#endif //AUDACITY_NAME
- FileNames::AddUniquePathToPathList(installPrefix + L"/share/locale",
+ FileNames::AddUniquePathToPathList(installPrefix + L"/data/locale",
audacityPathList);
FileNames::AddUniquePathToPathList(wxString::Format(wxT("./locale")),
--
2.48.1
From 01d9b2a3c93bf76574494de6892fed9c396d3d30 Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Sun, 18 Dec 2022 22:39:34 +0100
Subject: shutdown hook for locales. fix crash on exit
diff --git a/libraries/lib-strings/Languages.cpp b/libraries/lib-strings/Languages.cpp
index 6cd5775..9249c66 100644
--- a/libraries/lib-strings/Languages.cpp
+++ b/libraries/lib-strings/Languages.cpp
@@ -220,7 +220,7 @@ void GetLanguages( FilePaths pathList,
#if defined(__WXGTK__)
{
- wxFileName pathNorm{ wxStandardPaths::Get().GetInstallPrefix() + L"/share/locale" };
+ wxFileName pathNorm{ wxStandardPaths::Get().GetInstallPrefix() + L"/data/locale" };
pathNorm.Normalize();
const wxString newPath{ pathNorm.GetFullPath() };
if (pathList.end() ==
@@ -321,6 +321,11 @@ void GetLanguages( FilePaths pathList,
static std::unique_ptr<wxLocale> 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 c6707ee..f545484 100644
--- a/libraries/lib-strings/Languages.h
+++ b/libraries/lib-strings/Languages.h
@@ -43,6 +43,9 @@ wxString GetSystemLanguageCode(const FilePaths &pathList);
STRINGS_API
wxString SetLang( const FilePaths &audacityPathList, const wxString & lang );
+STRINGS_API
+void UnsetLocale(void);
+
/*! @return the last language code that was set */
STRINGS_API
wxString GetLang();
--
2.48.1
From 65e37df2f30d29934505343135cfec6416c6369f Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Tue, 2 May 2023 19:53:40 +0200
Subject: Haiku: Build GTK FileDialog
diff --git a/libraries/lib-wx-wrappers/CMakeLists.txt b/libraries/lib-wx-wrappers/CMakeLists.txt
index 4ddb487..442b656 100644
--- a/libraries/lib-wx-wrappers/CMakeLists.txt
+++ b/libraries/lib-wx-wrappers/CMakeLists.txt
@@ -25,7 +25,7 @@ set( SOURCES
FileDialog/mac/FileDialogPrivate.mm
FileDialog/mac/FileDialogPrivate.h
>
- $<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD,CYGWIN>:
+ $<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD,CYGWIN,Haiku>:
FileDialog/gtk/FileDialogPrivate.cpp
FileDialog/gtk/FileDialogPrivate.h
>
--
2.48.1
From 82c7f9616b20fa836832dd3a27843d1e3c427bfb Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 4 Mar 2025 11:00:06 +0000
Subject: Disable SIMD for x86 arch
diff --git a/lib-src/pffft/pfsimd_macros.h b/lib-src/pffft/pfsimd_macros.h
index ee9a0f8..a525c04 100644
--- a/lib-src/pffft/pfsimd_macros.h
+++ b/lib-src/pffft/pfsimd_macros.h
@@ -55,7 +55,9 @@
* better one?
*
*/
-
+#if defined(__HAIKU__) && defined(__i386__)
+#define PFFFT_SIMD_DISABLE
+#endif
/*
Altivec support macros
--
2.48.1