Skip to content

Commit

Permalink
openal-soft: Downgrade to 1.23.1 for macOS <= 11
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandesign committed Nov 19, 2024
1 parent 9e51f35 commit 9b4903f
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 4 deletions.
37 changes: 33 additions & 4 deletions audio/openal-soft/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,31 @@ PortGroup legacysupport 1.1
legacysupport.newest_darwin_requires_legacy 14

name openal-soft
version 1.24.0
revision 0
checksums rmd160 10e511398a23539d4f441c12657cb466e0d47ccd \
if {${os.platform} ne "darwin" || ${os.major} >= 21} {
version 1.24.0
revision 0
checksums rmd160 10e511398a23539d4f441c12657cb466e0d47ccd \
sha256 46cedbf46213d5f5ea255b7489a8b1a234c07c5d77bfb8e70f1c64ce09c8b765 \
size 763289
} else {
# macOS 11:
# https://build.macports.org/builders/ports-11_x86_64-builder/builds/172017/steps/install-port/logs/stdio
# alc/backends/coreaudio.cpp:307:46: error: use of undeclared identifier 'kAudioObjectPropertyElementMain'; did you mean 'kAudioObjectPropertyElementName'?

This comment has been minimized.

Copy link
@jmroot

jmroot Nov 20, 2024

Member

kAudioObjectPropertyElementMain can be defined to kAudioObjectPropertyElementMaster if undefined.

This comment has been minimized.

Copy link
@ryandesign

ryandesign Nov 20, 2024

Author Contributor

This is now filed as kcat/openal-soft#1063.

# alc/backends/coreaudio.cpp:315:46: error: use of undeclared identifier 'kAudioObjectPropertyElementMain'; did you mean 'kAudioObjectPropertyElementName'?
#
# macOS 10.15:
# https://build.macports.org/builders/ports-10.15_x86_64-builder/builds/200661/steps/install-port/logs/stdio
# alc/alu.cpp:2148:9: error: member reference base type 'al::span' is not a structure or union

This comment has been minimized.

Copy link
@jmroot

jmroot Nov 20, 2024

Member

Apple clang 11 seems to have a bug where it can't deduce types sometimes. See for example: https://github.com/dmlc/xgboost/pull/9684/files

This comment has been minimized.

Copy link
@ryandesign

ryandesign Nov 20, 2024

Author Contributor

This is now filed as kcat/openal-soft#1064.

#
# macOS 10.14:
# https://build.macports.org/builders/ports-10.14_x86_64-builder/builds/223612/steps/install-port/logs/stdio
# utils/makemhr/loaddef.cpp:33:10: fatal error: 'filesystem' file not found

This comment has been minimized.

Copy link
@jmroot

jmroot Nov 20, 2024

Member

filesystem was added in Xcode 11. Version 5.0 and later of macports-clang have it, so just blacklisting the older Xcode clangs should work.

This comment has been minimized.

Copy link
@ryandesign

ryandesign Nov 20, 2024

Author Contributor

This is now filed as kcat/openal-soft#1065.

filesystem requires support from libc++. Using a newer clang is not sufficient. The legacysupport portgroup contains a way to use a newer MacPorts libc++. I have not investigated that for this issue yet.

version 1.23.1
revision 1
checksums rmd160 5ca2531cc9e7476d122ddc9ab3a1b3e568d62175 \
sha256 796f4b89134c4e57270b7f0d755f0fa3435b90da437b745160a49bd41c845b21 \
size 699330
}

categories audio devel
maintainers {ryandesign @ryandesign} openmaintainer
Expand Down Expand Up @@ -43,7 +63,16 @@ depends_build-append path:bin/pkg-config:pkgconfig
depends_lib-append port:libmysofa \
port:zlib

compiler.cxx_standard 2017
if {[vercmp ${version} < 1.24.0]} {
# See: https://github.com/kcat/openal-soft/pull/851
patchfiles-append 0001-Define-__STDC_FORMAT_MACROS-on-systems-that-need-it.patch \
0002-threads-do-not-use-libdispatch-where-it-is-not-prese.patch \
patch-cinttypes.diff

compiler.cxx_standard 2014
} else {
compiler.cxx_standard 2017
}
compiler.thread_local_storage yes

# error: inline declaration of 'configValue<...>' follows non-inline definition
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 118c729680d6664f793f8d88ff0b7548137847d3 Mon Sep 17 00:00:00 2001
From: Chris Robinson <[email protected]>
Date: Sat, 27 May 2023 09:38:12 -0700
Subject: [PATCH 1/2] Define __STDC_FORMAT_MACROS on systems that need it

---
CMakeLists.txt | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git CMakeLists.txt CMakeLists.txt
index eeef181f..0bc8f2e2 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -186,6 +186,20 @@ set(LIB_VERSION_NUM ${LIB_MAJOR_VERSION},${LIB_MINOR_VERSION},${LIB_REVISION},0)
set(EXPORT_DECL "")


+# Some systems erroneously require the __STDC_FORMAT_MACROS macro to be defined
+# to get the fixed-width integer type formatter macros.
+check_cxx_source_compiles("#include <cinttypes>
+#include <cstdio>
+int main()
+{
+ int64_t i64{};
+ std::printf(\"%\" PRId64, i64);
+}"
+HAVE_STDC_FORMAT_MACROS)
+if(NOT HAVE_STDC_FORMAT_MACROS)
+ set(CPP_DEFS ${CPP_DEFS} __STDC_FORMAT_MACROS)
+endif()
+
if(NOT WIN32)
# Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions
check_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT)
--
2.40.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From cd781b1511d437816aac65f89646bd80dbf7c040 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Sun, 28 May 2023 14:28:00 +0800
Subject: [PATCH 2/2] threads: do not use libdispatch where it is not present
(#851)

Fixes: https://github.com/kcat/openal-soft/issues/850
---
common/threads.cpp | 3 ++-
common/threads.h | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git common/threads.cpp common/threads.cpp
index 136c4813..76a13d9d 100644
--- common/threads.cpp
+++ common/threads.cpp
@@ -128,7 +128,8 @@ void althrd_setname(const char *name [[maybe_unused]])
#endif
}

-#ifdef __APPLE__
+/* Do not try using libdispatch on systems where it is absent. */
+#if defined(__APPLE__) && ((MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__))

namespace al {

diff --git common/threads.h common/threads.h
index 59fccd12..2592e5b0 100644
--- common/threads.h
+++ common/threads.h
@@ -15,7 +15,12 @@
#endif

#if defined(__APPLE__)
+#include <AvailabilityMacros.h>
+#if (MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__)
#include <dispatch/dispatch.h>
+#else
+#include <semaphore.h> /* Fallback option for Apple without a working libdispatch */
+#endif
#elif !defined(_WIN32)
#include <semaphore.h>
#endif
@@ -27,7 +32,7 @@ namespace al {
class semaphore {
#ifdef _WIN32
using native_type = void*;
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) && ((MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__))
using native_type = dispatch_semaphore_t;
#else
using native_type = sem_t;
--
2.40.1

55 changes: 55 additions & 0 deletions audio/openal-soft/files/patch-cinttypes.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# https://github.com/kcat/openal-soft/commit/6752d5516c8b30fe7db559c7f3a1423705d2a4fd

--- al/source.cpp.orig 2023-04-12 03:46:23.000000000 +0800
+++ al/source.cpp 2023-06-29 15:13:22.000000000 +0800
@@ -27,11 +27,11 @@
#include <atomic>
#include <cassert>
#include <chrono>
+#include <cinttypes>
#include <climits>
#include <cmath>
#include <cstdint>
#include <functional>
-#include <inttypes.h>
#include <iterator>
#include <limits>
#include <memory>

--- alc/backends/coreaudio.cpp.orig 2023-04-12 03:46:23.000000000 +0800
+++ alc/backends/coreaudio.cpp 2023-06-29 15:12:58.000000000 +0800
@@ -22,7 +22,7 @@

#include "coreaudio.h"

-#include <inttypes.h>
+#include <cinttypes>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

--- alc/backends/sndio.cpp.orig 2023-04-12 03:46:23.000000000 +0800
+++ alc/backends/sndio.cpp 2023-06-29 15:12:20.000000000 +0800
@@ -22,8 +22,8 @@

#include "sndio.h"

+#include <cinttypes>
#include <functional>
-#include <inttypes.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>

--- utils/uhjencoder.cpp.orig 2023-04-12 03:46:23.000000000 +0800
+++ utils/uhjencoder.cpp 2023-06-29 15:11:54.000000000 +0800
@@ -25,8 +25,8 @@
#include "config.h"

#include <array>
+#include <cinttypes>
#include <cstring>
-#include <inttypes.h>
#include <memory>
#include <stddef.h>
#include <string>

0 comments on commit 9b4903f

Please sign in to comment.