commit:     a16bad273658ff883161a04974026a3d5a4dab5f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 12 14:20:16 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 12 14:20:16 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a16bad27

dev-libs/spdlog: backport further libfmt-11.1.0 fixups

Not that we seem to have hit any of these extra issues...

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/spdlog-1.15.0-libfmt-11.1.0-fixups.patch | 69 ++++++++++++++++++++++
 dev-libs/spdlog/spdlog-1.15.0-r1.ebuild            | 56 ++++++++++++++++++
 2 files changed, 125 insertions(+)

diff --git a/dev-libs/spdlog/files/spdlog-1.15.0-libfmt-11.1.0-fixups.patch 
b/dev-libs/spdlog/files/spdlog-1.15.0-libfmt-11.1.0-fixups.patch
new file mode 100644
index 000000000000..afada8092f37
--- /dev/null
+++ b/dev-libs/spdlog/files/spdlog-1.15.0-libfmt-11.1.0-fixups.patch
@@ -0,0 +1,69 @@
+https://github.com/gabime/spdlog/commit/7f8060d5b280eac9786f92ac74d263cc8359c5ed
+https://github.com/gabime/spdlog/commit/96a8f6250cbf4e8c76387c614f666710a2fa9bad
+
+From 7f8060d5b280eac9786f92ac74d263cc8359c5ed Mon Sep 17 00:00:00 2001
+From: Christian Blichmann <[email protected]>
+Date: Tue, 7 Jan 2025 23:59:12 +0100
+Subject: [PATCH] fix: Compatibility with external fmtlib 11.1.1 (#3312)
+
+Include fmtlib's `xchar` header to include `fmt::basic_format_string`.
+Otherwise, compilation with an external fmtlib 11.1.1 fails with
+
+```
+In file included from include/spdlog/spdlog.h:12:
+include/spdlog/common.h:369:49: error: no template named 'basic_format_string' 
in namespace 'fmt'; did you mean 'std::basic_format_string'?
+  369 | inline fmt::basic_string_view<T> 
to_string_view(fmt::basic_format_string<T, Args...> fmt) {
+      |                                                 ^~~~~
+```
+
+Signed-off-by: Christian Blichmann <[email protected]>
+---
+ include/spdlog/fmt/fmt.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/spdlog/fmt/fmt.h b/include/spdlog/fmt/fmt.h
+index 7fa6b0933..2f09c15ed 100644
+--- a/include/spdlog/fmt/fmt.h
++++ b/include/spdlog/fmt/fmt.h
+@@ -27,4 +27,5 @@
+ #else  // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib
+     #include <fmt/core.h>
+     #include <fmt/format.h>
++    #include <fmt/xchar.h>
+ #endif
+
+From 96a8f6250cbf4e8c76387c614f666710a2fa9bad Mon Sep 17 00:00:00 2001
+From: jdrouhard <[email protected]>
+Date: Thu, 9 Jan 2025 16:58:46 -0600
+Subject: [PATCH] fix: remove unused to_string_view overload in fmt >= 11.1
+ (#3314)
+
+---
+ include/spdlog/common.h | 14 +-------------
+ 1 file changed, 1 insertion(+), 13 deletions(-)
+
+diff --git a/include/spdlog/common.h b/include/spdlog/common.h
+index 2d73f8300..71ffd2403 100644
+--- a/include/spdlog/common.h
++++ b/include/spdlog/common.h
+@@ -364,19 +364,7 @@ SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t 
to_string_view(spdlog::wstring_view
+ }
+ #endif
+ 
+-#ifndef SPDLOG_USE_STD_FORMAT
+-#if FMT_VERSION >= 110100
+-template <typename T, typename... Args>
+-inline fmt::basic_string_view<T> to_string_view(fmt::basic_format_arg<T> fmt) 
{
+-    return fmt;
+-}
+-#else
+-template <typename T, typename... Args>
+-inline fmt::basic_string_view<T> to_string_view(fmt::basic_format_string<T, 
Args...> fmt) {
+-    return fmt;
+-}
+-#endif
+-#elif __cpp_lib_format >= 202207L
++#if defined(SPDLOG_USE_STD_FORMAT) &&  __cpp_lib_format >= 202207L
+ template <typename T, typename... Args>
+ SPDLOG_CONSTEXPR_FUNC std::basic_string_view<T> to_string_view(
+     std::basic_format_string<T, Args...> fmt) SPDLOG_NOEXCEPT {

diff --git a/dev-libs/spdlog/spdlog-1.15.0-r1.ebuild 
b/dev-libs/spdlog/spdlog-1.15.0-r1.ebuild
new file mode 100644
index 000000000000..cefd2edefc7e
--- /dev/null
+++ b/dev-libs/spdlog/spdlog-1.15.0-r1.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake-multilib
+
+DESCRIPTION="Fast C++ logging library"
+HOMEPAGE="https://github.com/gabime/spdlog";
+
+if [[ ${PV} == *9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/gabime/${PN}";
+else
+       SRC_URI="https://github.com/gabime/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+fi
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="test static-libs"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+       virtual/pkgconfig
+       test? (
+               >=dev-cpp/catch-3.4.0
+       )
+"
+DEPEND="
+       dev-libs/libfmt:=[${MULTILIB_USEDEP}]
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-force_external_fmt.patch"
+       "${FILESDIR}/${PN}-1.15.0-libfmt-11.1.0.patch"
+       "${FILESDIR}/${PN}-1.15.0-libfmt-11.1.0-fixups.patch"
+)
+
+multilib_src_prepare() {
+       cmake_src_prepare
+       rm -r include/spdlog/fmt/bundled || die "Failed to delete bundled 
libfmt"
+}
+
+multilib_src_configure() {
+       local mycmakeargs=(
+               -DSPDLOG_BUILD_BENCH=no
+               -DSPDLOG_BUILD_EXAMPLE=no
+               -DSPDLOG_FMT_EXTERNAL=yes
+               -DSPDLOG_BUILD_SHARED=$(usex static-libs)
+               -DSPDLOG_BUILD_TESTS=$(usex test)
+       )
+
+       cmake_src_configure
+}

Reply via email to