Rebuild for fmt 11

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Signed-off-by: Michel Lind <salimma@fedoraproject.org>
This commit is contained in:
Kefu Chai 2024-07-26 11:04:28 -05:00 committed by Michel Lind
parent 474ace809b
commit fe012d61e0
No known key found for this signature in database
GPG Key ID: 8B229D2F7CCC04F2
3 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 71f772e9d3d4f8045cfa7bccd03bd21c1e8fbef1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <holger@applied-asynchrony.com>
Date: Tue, 2 Jul 2024 15:46:44 +0200
Subject: [PATCH] build: Try harder to determine FMT_VERSION (#1478)
fmt-11.0 moved the FMT_VERSION from core.h to base.h, so try the
new header first and then fall back to the old one.
Closes: #1477
---
cmake/FindFmt.cmake | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/cmake/FindFmt.cmake b/cmake/FindFmt.cmake
index 55126a3172..0619f4615e 100644
--- a/cmake/FindFmt.cmake
+++ b/cmake/FindFmt.cmake
@@ -3,11 +3,19 @@ mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY)
if(DEP_FMT STREQUAL "BUNDLED")
message(STATUS "Using bundled Fmt as requested")
else()
- find_path(FMT_INCLUDE_DIR fmt/core.h)
+ find_path(FMT_INCLUDE_DIR fmt/base.h fmt/core.h)
find_library(FMT_LIBRARY fmt)
if(FMT_INCLUDE_DIR AND FMT_LIBRARY)
- file(READ "${FMT_INCLUDE_DIR}/fmt/core.h" _fmt_core_h)
- string(REGEX MATCH "#define FMT_VERSION ([0-9]+)" _ "${_fmt_core_h}")
+ file(READ "${FMT_INCLUDE_DIR}/fmt/base.h" _fmt_base_h)
+ string(REGEX MATCH "#define FMT_VERSION ([0-9]+)" _ "${_fmt_base_h}")
+ if("${CMAKE_MATCH_0}" STREQUAL "")
+ file(READ "${FMT_INCLUDE_DIR}/fmt/core.h" _fmt_core_h)
+ string(REGEX MATCH "#define FMT_VERSION ([0-9]+)" _ "${_fmt_core_h}")
+ endif()
+ if("${CMAKE_MATCH_0}" STREQUAL "")
+ message(FATAL_ERROR "FMT_VERSION not found")
+ return()
+ endif()
math(EXPR _fmt_major "${CMAKE_MATCH_1} / 10000")
math(EXPR _fmt_minor "${CMAKE_MATCH_1} / 100 % 100")
math(EXPR _fmt_patch "${CMAKE_MATCH_1} % 100")

View File

@ -0,0 +1,37 @@
From 3b09afc5f792f0bd0a15cf6b8408ea40eb069787 Mon Sep 17 00:00:00 2001
From: Joel Rosdahl <joel@rosdahl.net>
Date: Tue, 2 Jul 2024 17:05:43 +0200
Subject: [PATCH] build: Fix detection of Fmt version for Fmt<11
Fixes regression in 71f772e9d3d4f8045cfa7bccd03bd21c1e8fbef1.
---
cmake/FindFmt.cmake | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/cmake/FindFmt.cmake b/cmake/FindFmt.cmake
index 0619f4615e..7c39291eca 100644
--- a/cmake/FindFmt.cmake
+++ b/cmake/FindFmt.cmake
@@ -3,15 +3,16 @@ mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY)
if(DEP_FMT STREQUAL "BUNDLED")
message(STATUS "Using bundled Fmt as requested")
else()
- find_path(FMT_INCLUDE_DIR fmt/base.h fmt/core.h)
+ find_path(FMT_INCLUDE_DIR NAMES fmt/base.h fmt/core.h)
find_library(FMT_LIBRARY fmt)
if(FMT_INCLUDE_DIR AND FMT_LIBRARY)
- file(READ "${FMT_INCLUDE_DIR}/fmt/base.h" _fmt_base_h)
- string(REGEX MATCH "#define FMT_VERSION ([0-9]+)" _ "${_fmt_base_h}")
- if("${CMAKE_MATCH_0}" STREQUAL "")
- file(READ "${FMT_INCLUDE_DIR}/fmt/core.h" _fmt_core_h)
- string(REGEX MATCH "#define FMT_VERSION ([0-9]+)" _ "${_fmt_core_h}")
+ if(EXISTS "${FMT_INCLUDE_DIR}/fmt/base.h")
+ set(_fmt_h base.h)
+ else()
+ set(_fmt_h core.h)
endif()
+ file(READ "${FMT_INCLUDE_DIR}/fmt/${_fmt_h}" _fmt_h_content)
+ string(REGEX MATCH "#define FMT_VERSION ([0-9]+)" _ "${_fmt_h_content}")
if("${CMAKE_MATCH_0}" STREQUAL "")
message(FATAL_ERROR "FMT_VERSION not found")
return()

View File

@ -13,7 +13,7 @@
Name: ccache
Version: 4.10.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: C/C++ compiler cache
# See LICENSE.adoc for licenses of bundled codes
@ -25,6 +25,10 @@ URL: http://ccache.dev/
Source0: https://github.com/ccache/ccache/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1: %{name}.sh.in
Source2: %{name}.csh.in
# https://github.com/ccache/ccache/commit/83190fff9ab7298b1c5332f7d1332440763998f7
Patch0: 0001-build-try-harder-to-determine-fmt.patch
# https://github.com/ccache/ccache/commit/3b09afc5f792f0bd0a15cf6b8408ea40eb069787
Patch1: 0002-build-fix-detection-of-fmt-version.patch
BuildRequires: /usr/bin/asciidoctor
BuildRequires: cmake
@ -57,6 +61,7 @@ being done again. The main focus is to handle the GNU C/C++ compiler
%prep
%setup -q
%autopatch -p1
# win32-compat gets imported, but not used
rm -r src/third_party/{[ad-lo-tvy-z]*,cpp-httplib}
sed -e 's|@LIBDIR@|%{_libdir}|g' -e 's|@CACHEDIR@|%{_var}/cache/ccache|g' \
@ -231,6 +236,9 @@ getent group ccache >/dev/null || groupadd -r ccache || :
%changelog
* Fri Jul 26 2024 Kefu Chai <tchaikov@gmail.com> - 4.10.1-3
- Rebuilt for fmt 11
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.10.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild