From d81dd47d67e1714a0bec5e812b01101c1dce60ef Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Wed, 14 Feb 2024 03:01:39 +0800 Subject: [PATCH] fmt: add upstream patch Patch `fmt` with fmtlib/fmt@44c3fe1 to unblock `mariadb` 10.11+ updates (#162559, #162558, #162554). See: https://jira.mariadb.org/projects/MDEV/issues/MDEV-32815 --- Formula/f/fmt.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Formula/f/fmt.rb b/Formula/f/fmt.rb index 569bd0f3ccd25..45d96e5edcccd 100644 --- a/Formula/f/fmt.rb +++ b/Formula/f/fmt.rb @@ -4,6 +4,7 @@ class Fmt < Formula url "https://github.com/fmtlib/fmt/archive/refs/tags/10.2.1.tar.gz" sha256 "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811" license "MIT" + revision 1 head "https://github.com/fmtlib/fmt.git", branch: "master" bottle do @@ -18,6 +19,11 @@ class Fmt < Formula depends_on "cmake" => :build + # Fix handling of static separator; cherry-picked from: + # https://github.com/fmtlib/fmt/commit/44c3fe1ebb466ab5c296e1a1a6991c7c7b51b72e + # Remove when included in a release. + patch :DATA + def install system "cmake", "-S", ".", "-B", "build", "-DBUILD_SHARED_LIBS=TRUE", *std_cmake_args system "cmake", "--build", "build" @@ -48,3 +54,30 @@ def install assert_equal "The answer is 42", shell_output("./test") end end + +__END__ +diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h +index 9fc87ecf2027df0346935e7666ea80ec70e65575..872aa9802df1ffa8572a2f0d29f58bdb2b171a1a 100644 +--- a/include/fmt/format-inl.h ++++ b/include/fmt/format-inl.h +@@ -110,7 +110,11 @@ template FMT_FUNC Char decimal_point_impl(locale_ref) { + + FMT_FUNC auto write_loc(appender out, loc_value value, + const format_specs<>& specs, locale_ref loc) -> bool { +-#ifndef FMT_STATIC_THOUSANDS_SEPARATOR ++#ifdef FMT_STATIC_THOUSANDS_SEPARATOR ++ value.visit(loc_writer<>{ ++ out, specs, std::string(1, FMT_STATIC_THOUSANDS_SEPARATOR), "\3", "."}); ++ return true; ++#else + auto locale = loc.get(); + // We cannot use the num_put facet because it may produce output in + // a wrong encoding. +@@ -119,7 +123,6 @@ FMT_FUNC auto write_loc(appender out, loc_value value, + return std::use_facet(locale).put(out, value, specs); + return facet(locale).put(out, value, specs); + #endif +- return false; + } + } // namespace detail +