commit:     f4d468080b9873499d1a14a5025527b7735de30b
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Sat Jul 26 15:51:50 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug  7 22:54:57 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4d46808

media-libs/openal: fix build of bundled libfmt on libc++ 21

Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Part-of: https://github.com/gentoo/gentoo/pull/43171
Closes: https://github.com/gentoo/gentoo/pull/43171
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/openal-1.24.3-libfmt-libcxx-21.patch     | 37 ++++++++++++++++++++++
 media-libs/openal/openal-1.24.3.ebuild             |  7 +++-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/media-libs/openal/files/openal-1.24.3-libfmt-libcxx-21.patch 
b/media-libs/openal/files/openal-1.24.3-libfmt-libcxx-21.patch
new file mode 100644
index 000000000000..16c502dfafbb
--- /dev/null
+++ b/media-libs/openal/files/openal-1.24.3-libfmt-libcxx-21.patch
@@ -0,0 +1,37 @@
+From 
https://github.com/fmtlib/fmt/commit/f4345467fce7edbc6b36c3fa1cf197a67be617e2 
Mon Sep 17 00:00:00 2001
+From: Remy Jette <[email protected]>
+Date: Sat, 21 Jun 2025 07:28:14 -0700
+Subject: [PATCH] Fix compilation on clang-21 / libc++-21 (#4477)
+
+`<cstdlib>` was not being included, so malloc and free were only declared
+via transitive includes. Some includes changed in the latest libc++-21
+build which broke fmt.
+
+Also changed `malloc`/`free` to `std::malloc` and `std::free`, as
+putting those symbols in the global namespace is optional for the
+implementation when including `<cstdlib>`.
+--- a/fmt-11.1.1/include/fmt/format.h
++++ b/fmt-11.1.1/include/fmt/format.h
+@@ -44,6 +44,7 @@
+ #  include <cmath>    // std::signbit
+ #  include <cstddef>  // std::byte
+ #  include <cstdint>  // uint32_t
++#  include <cstdlib>  // std::malloc, std::free
+ #  include <cstring>  // std::memcpy
+ #  include <limits>   // std::numeric_limits
+ #  include <new>      // std::bad_alloc
+@@ -755,12 +756,12 @@ template <typename T> struct allocator : private 
std::decay<void> {
+ 
+   T* allocate(size_t n) {
+     FMT_ASSERT(n <= max_value<size_t>() / sizeof(T), "");
+-    T* p = static_cast<T*>(malloc(n * sizeof(T)));
++    T* p = static_cast<T*>(std::malloc(n * sizeof(T)));
+     if (!p) FMT_THROW(std::bad_alloc());
+     return p;
+   }
+ 
+-  void deallocate(T* p, size_t) { free(p); }
++  void deallocate(T* p, size_t) { std::free(p); }
+ };
+ 
+ }  // namespace detail

diff --git a/media-libs/openal/openal-1.24.3.ebuild 
b/media-libs/openal/openal-1.24.3.ebuild
index 892ebc1d4b05..5988b0fd1e13 100644
--- a/media-libs/openal/openal-1.24.3.ebuild
+++ b/media-libs/openal/openal-1.24.3.ebuild
@@ -46,7 +46,12 @@ DEPEND="${RDEPEND}
 
 DOCS=( alsoftrc.sample docs/env-vars.txt docs/hrtf.txt ChangeLog README.md )
 
-PATCHES=( "${FILESDIR}/${P}-qt6.patch" ) # bug 955274; git master
+PATCHES=(
+       # bug 955274; git master
+       "${FILESDIR}/${P}-qt6.patch"
+       # backport of 
https://github.com/fmtlib/fmt/commit/f4345467fce7edbc6b36c3fa1cf197a67be617e2 
for bundled libfmt
+       "${FILESDIR}/${PN}-1.24.3-libfmt-libcxx-21.patch"
+)
 
 multilib_src_configure() {
        local mycmakeargs=(

Reply via email to