Fix build of openal

This commit is contained in:
Jeremy Soller 2025-01-09 09:38:09 -07:00
parent dd43b57f1e
commit c0ca2c2f9e
No known key found for this signature in database
GPG Key ID: D02FD439211AF56F
2 changed files with 98 additions and 11 deletions

View File

@ -1,20 +1,60 @@
#TODO probably wrong script, see https://openal-soft.org/#installing
[source]
tar = "https://openal-soft.org/openal-releases/openal-soft-1.23.1.tar.bz2"
tar = "https://openal-soft.org/openal-releases/openal-soft-1.24.1.tar.bz2"
blake3 = "8aeaa8307d3e14331ad20761c537ffebe70975cb7c3343e8d5c0c0ed7bc16eab"
patch = [
"redox.patch"
]
[build]
template = "custom"
dependencies = [
"liborbital",
"libsndfile",
"llvm18",
"mesa",
"sdl2",
"zlib",
]
script = """
COOKBOOK_CONFIGURE="cmake"
COOKBOOK_CONFIGURE_FLAGS=(
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/SDL2"
export CXXFLAGS="${CXXFLAGS} -I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/SDL2"
cat > redox.cmake <<EOF
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR "${TARGET%%-*}")
# which compilers to use for C and C++
set(CMAKE_C_COMPILER "${TARGET}-gcc")
set(CMAKE_CXX_COMPILER "${TARGET}-g++")
# where is the target environment located
set(CMAKE_FIND_ROOT_PATH "${COOKBOOK_SYSROOT}")
# adjust the default behavior of the FIND_XXX() commands:
# search programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# search headers, libraries, and packages in the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
EOF
COOKBOOK_CONFIGURE="cmake"
COOKBOOK_CONFIGURE_FLAGS=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CROSSCOMPILING=True
-DCMAKE_EXE_LINKER_FLAGS="-static"
-DCMAKE_INSTALL_PREFIX="/"
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}"
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_SYSTEM_PROCESSOR="$(echo "${TARGET}" | cut -d - -f1)"
-DCMAKE_VERBOSE_MAKEFILE=On
"${COOKBOOK_SOURCE}"
-DCMAKE_INSTALL_PREFIX="/usr"
-DCMAKE_TOOLCHAIN_FILE=redox.cmake
-DCMAKE_VERBOSE_MAKEFILE=ON
-DALSOFT_EXAMPLES=OFF
-DALSOFT_INSTALL_EXAMPLES=OFF
-DALSOFT_INSTALL_UTILS=OFF
-DALSOFT_UTILS=OFF
-DLIBTYPE=STATIC
#TODO: enable SDL2 backend
-DALSOFT_BACKEND_SDL2=OFF
-DALSOFT_REQUIRE_SDL2=OFF
"${COOKBOOK_SOURCE}"
)
cookbook_configure
"""

View File

@ -0,0 +1,47 @@
diff -ruwN openal-soft-1.24.1/common/alstring.cpp source/common/alstring.cpp
--- openal-soft-1.24.1/common/alstring.cpp 2024-11-27 20:21:16.000000000 -0700
+++ source/common/alstring.cpp 2025-01-09 09:35:50.263542017 -0700
@@ -40,8 +40,8 @@
auto ch1end = ch1 + std::min(str0.size(), str1.size());
while(ch1 != ch1end)
{
- const auto u0 = std::towupper(Traits::to_int_type(*ch0));
- const auto u1 = std::towupper(Traits::to_int_type(*ch1));
+ const auto u0 = towupper(Traits::to_int_type(*ch0));
+ const auto u1 = towupper(Traits::to_int_type(*ch1));
if(const auto diff = static_cast<int>(u0-u1)) return diff;
++ch0; ++ch1;
}
diff -ruwN openal-soft-1.24.1/common/althreads.h source/common/althreads.h
--- openal-soft-1.24.1/common/althreads.h 2024-11-27 20:21:16.000000000 -0700
+++ source/common/althreads.h 2025-01-09 09:31:58.064326293 -0700
@@ -9,7 +9,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__redox__)
#include <pthread.h>
@@ -79,7 +79,7 @@
[[nodiscard]]
auto get() const noexcept -> T { return from_ptr(TlsGetValue(mTss)); }
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__redox__)
pthread_key_t mTss{};
diff -ruwN openal-soft-1.24.1/core/helpers.cpp source/core/helpers.cpp
--- openal-soft-1.24.1/core/helpers.cpp 2024-11-27 20:21:16.000000000 -0700
+++ source/core/helpers.cpp 2025-01-09 09:36:47.992595649 -0700
@@ -372,7 +372,7 @@
bool SetRTPriorityPthread(int prio [[maybe_unused]])
{
int err{ENOTSUP};
-#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__)
+#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__) && !defined(__redox__)
/* Get the min and max priority for SCHED_RR. Limit the max priority to
* half, for now, to ensure the thread can't take the highest priority and
* go rogue.