Skip to content

Commit 91de90a

Browse files
BrewTestBotdaeho-ro
authored andcommitted
avro-cpp 1.12.1
avro-cpp: remove build patch Signed-off-by: Rui Chen <[email protected]>
1 parent 4f3b09e commit 91de90a

File tree

1 file changed

+23
-74
lines changed

1 file changed

+23
-74
lines changed

Formula/a/avro-cpp.rb

Lines changed: 23 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
class AvroCpp < Formula
22
desc "Data serialization system"
33
homepage "https://avro.apache.org/"
4-
url "https://www.apache.org/dyn/closer.lua?path=avro/avro-1.12.0/cpp/avro-cpp-1.12.0.tar.gz"
5-
mirror "https://archive.apache.org/dist/avro/avro-1.12.0/cpp/avro-cpp-1.12.0.tar.gz"
6-
sha256 "f2edf77126a75b0ec1ad166772be058351cea3d74448be7e2cef20050c0f98ab"
4+
url "https://www.apache.org/dyn/closer.lua?path=avro/avro-1.12.1/cpp/avro-cpp-1.12.1.tar.gz"
5+
mirror "https://archive.apache.org/dist/avro/avro-1.12.1/cpp/avro-cpp-1.12.1.tar.gz"
6+
sha256 "18a0d155905a4dab0c2bfd66c742358a7d969bcff58cf6f655bcf602879f4fe7"
77
license "Apache-2.0"
8-
revision 1
98

109
bottle do
1110
sha256 cellar: :any, arm64_tahoe: "6704d6e89acb0c747ea276845a9931aba6be8ccb0555ea7333f6fd871d33ef74"
@@ -22,14 +21,28 @@ class AvroCpp < Formula
2221
depends_on "fmt" => [:build, :test] # needed for headers
2322
depends_on "pkgconf" => :build
2423
depends_on "boost"
24+
depends_on "zstd"
2525

26-
# Fix compatibility with `fmt` 11, https://github.com/apache/avro/pull/3444
27-
# Fix to use system installed `fmt`, https://github.com/apache/avro/pull/3447
28-
# Both patches are not applicable to the source splitted tarball
29-
# Also add workaround for Boost 1.89.0 until next release that drops Boost dep
30-
patch :DATA
26+
uses_from_macos "zlib"
27+
28+
# Add missing cmake file from git
29+
resource "avro-cpp-config.cmake.in" do
30+
url "https://github.com/apache/avro/raw/refs/tags/release-1.12.1/lang/c++/cmake/avro-cpp-config.cmake.in"
31+
sha256 "2f100bed5a5ec300bc16e618ef17c64056c165a3dba8dde590a3ef65352440fa"
32+
end
3133

3234
def install
35+
(buildpath/"cmake").install resource("avro-cpp-config.cmake.in")
36+
37+
# Boost 1.89+ no longer requires the 'system' component
38+
boost_replacements = /Boost\s1.70\sREQUIRED\s(CONFIG\s)?COMPONENTS\s?system/
39+
inreplace "CMakeLists.txt" do |s|
40+
s.gsub! boost_replacements, "Boost REQUIRED"
41+
s.gsub! "$<INSTALL_INTERFACE:$<TARGET_NAME_IF_EXISTS:Boost::system>>", ""
42+
s.gsub! "Boost::system ZLIB::ZLIB", "$<TARGET_NAME_IF_EXISTS:Boost::system> ZLIB::ZLIB"
43+
end
44+
inreplace "cmake/avro-cpp-config.cmake.in", boost_replacements, "Boost REQUIRED"
45+
3346
system "cmake", "-S", ".", "-B", "build", *std_cmake_args
3447
system "cmake", "--build", "build"
3548
system "cmake", "--install", "build"
@@ -57,71 +70,7 @@ def install
5770
CPP
5871

5972
system bin/"avrogencpp", "-i", "cpx.json", "-o", "cpx.hh", "-n", "cpx"
60-
system ENV.cxx, "test.cpp", "-std=c++14", "-o", "test"
73+
system ENV.cxx, "test.cpp", "-std=c++17", "-o", "test"
6174
system "./test"
6275
end
6376
end
64-
65-
__END__
66-
diff --git a/CMakeLists.txt b/CMakeLists.txt
67-
index 19059a4..afdfdf5 100644
68-
--- a/CMakeLists.txt
69-
+++ b/CMakeLists.txt
70-
@@ -80,17 +80,20 @@ endif ()
71-
72-
73-
find_package (Boost 1.38 REQUIRED
74-
- COMPONENTS filesystem iostreams program_options regex system)
75-
-
76-
-include(FetchContent)
77-
-FetchContent_Declare(
78-
- fmt
79-
- GIT_REPOSITORY https://github.com/fmtlib/fmt.git
80-
- GIT_TAG 10.2.1
81-
- GIT_PROGRESS TRUE
82-
- USES_TERMINAL_DOWNLOAD TRUE
83-
-)
84-
-FetchContent_MakeAvailable(fmt)
85-
+ COMPONENTS filesystem iostreams program_options regex)
86-
+
87-
+find_package(fmt)
88-
+if (NOT fmt_FOUND)
89-
+ include(FetchContent)
90-
+ FetchContent_Declare(
91-
+ fmt
92-
+ GIT_REPOSITORY https://github.com/fmtlib/fmt.git
93-
+ GIT_TAG 10.2.1
94-
+ GIT_PROGRESS TRUE
95-
+ USES_TERMINAL_DOWNLOAD TRUE
96-
+ )
97-
+ FetchContent_MakeAvailable(fmt)
98-
+endif (NOT fmt_FOUND)
99-
100-
find_package(Snappy)
101-
if (SNAPPY_FOUND)
102-
diff --git a/include/avro/Node.hh b/include/avro/Node.hh
103-
index f76078b..7226d05 100644
104-
--- a/include/avro/Node.hh
105-
+++ b/include/avro/Node.hh
106-
@@ -219,7 +219,7 @@ inline std::ostream &operator<<(std::ostream &os, const avro::Node &n) {
107-
template<>
108-
struct fmt::formatter<avro::Name> : fmt::formatter<std::string> {
109-
template<typename FormatContext>
110-
- auto format(const avro::Name &n, FormatContext &ctx) {
111-
+ auto format(const avro::Name &n, FormatContext &ctx) const {
112-
return fmt::formatter<std::string>::format(n.fullname(), ctx);
113-
}
114-
};
115-
diff --git a/include/avro/Types.hh b/include/avro/Types.hh
116-
index 84a3397..c0533f3 100644
117-
--- a/include/avro/Types.hh
118-
+++ b/include/avro/Types.hh
119-
@@ -113,7 +113,7 @@ std::ostream &operator<<(std::ostream &os, const Null &null);
120-
template<>
121-
struct fmt::formatter<avro::Type> : fmt::formatter<std::string> {
122-
template<typename FormatContext>
123-
- auto format(avro::Type t, FormatContext &ctx) {
124-
+ auto format(avro::Type t, FormatContext &ctx) const {
125-
return fmt::formatter<std::string>::format(avro::toString(t), ctx);
126-
}
127-
};

0 commit comments

Comments
 (0)