devel/avro-cpp: Update to 1.12.1

- Fix build with Boost 1.89

Changes:	https://github.com/apache/avro/releases
		https://github.com/apache/avro/tree/main/doc/content/en/blog/releases
Obtained from:	2b11dba4fb
This commit is contained in:
Po-Chuan Hsieh
2025-10-27 23:29:16 +08:00
parent 93083605cd
commit be6a0ac78b
7 changed files with 326 additions and 59 deletions

View File

@@ -1,6 +1,5 @@
PORTNAME= avro
PORTVERSION= 1.12.0
PORTREVISION= 6
PORTVERSION= 1.12.1
CATEGORIES= devel
MASTER_SITES= APACHE/avro/avro-${PORTVERSION}/cpp
PKGNAMESUFFIX= -cpp
@@ -16,7 +15,8 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
LIB_DEPENDS= libboost_regex.so:devel/boost-libs \
libfmt.so:devel/libfmt \
libsnappy.so:archivers/snappy
libsnappy.so:archivers/snappy \
libzstd.so:archivers/zstd
USES= cmake compiler:c++17-lang cpe

View File

@@ -1,3 +1,11 @@
TIMESTAMP = 1723201039
SHA256 (avro-cpp-1.12.0.tar.gz) = f2edf77126a75b0ec1ad166772be058351cea3d74448be7e2cef20050c0f98ab
SIZE (avro-cpp-1.12.0.tar.gz) = 174130
TIMESTAMP = 1761446542
SHA256 (avro-cpp-1.12.1.tar.gz) = 18a0d155905a4dab0c2bfd66c742358a7d969bcff58cf6f655bcf602879f4fe7
SIZE (avro-cpp-1.12.1.tar.gz) = 184762
SHA256 (c75e6d59fbacd05df666665d9c8b7e3274cf0399.patch) = e83ca646df822448b9b7a11d018c1c293491f8975ada07a4dbb876d7bc951b99
SIZE (c75e6d59fbacd05df666665d9c8b7e3274cf0399.patch) = 10635
SHA256 (e6c308780e876b4c11a470b9900995947f7b0fb5.patch) = fbdc5ec40bd13eb0c67ef541a29defc3e6badb841d16b386239d527f33474b66
SIZE (e6c308780e876b4c11a470b9900995947f7b0fb5.patch) = 3274
SHA256 (76f2f7fce7695fd5f2a8772595967c7662aa7681.patch) = 911b11348de3c0d218cc57c6351f315d202e5f474b3a6b81800062cbb9384a1e
SIZE (76f2f7fce7695fd5f2a8772595967c7662aa7681.patch) = 1048
SHA256 (2b11dba4fb28c7bb6ff08b40509a6a71fcaf4c21.patch) = 252a05cbb41e916a6e7f74580cede21b4ce077f3fb529d2c873deb9236fc3606
SIZE (2b11dba4fb28c7bb6ff08b40509a6a71fcaf4c21.patch) = 10353

View File

@@ -1,31 +0,0 @@
Reference: https://github.com/apache/avro/commit/9d57bab596b6b3b5c1ca25b06e2c7aede8f32263
--- CMakeLists.txt.orig 2024-07-26 07:46:40 UTC
+++ CMakeLists.txt
@@ -82,15 +82,7 @@ find_package (Boost 1.38 REQUIRED
find_package (Boost 1.38 REQUIRED
COMPONENTS filesystem iostreams program_options regex system)
-include(FetchContent)
-FetchContent_Declare(
- fmt
- GIT_REPOSITORY https://github.com/fmtlib/fmt.git
- GIT_TAG 10.2.1
- GIT_PROGRESS TRUE
- USES_TERMINAL_DOWNLOAD TRUE
-)
-FetchContent_MakeAvailable(fmt)
+find_package (fmt 10.2.1 REQUIRED)
find_package(Snappy)
if (SNAPPY_FOUND)
@@ -217,7 +209,8 @@ unittest (CommonsSchemasTests)
unittest (AvrogencppTestReservedWords)
unittest (CommonsSchemasTests)
-add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh)
+add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh
+ cpp_reserved_words_union_typedef_hh)
add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh
tweet_hh

View File

@@ -0,0 +1,308 @@
Obtained from: https://github.com/apache/avro/commit/2b11dba4fb28c7bb6ff08b40509a6a71fcaf4c21
https://github.com/apache/avro/blob/main/lang/c%2B%2B/cmake/avro-cpp-config.cmake.in
--- CMakeLists.txt.orig 2025-09-05 08:05:13 UTC
+++ CMakeLists.txt
@@ -70,7 +70,6 @@ if (WIN32 AND NOT CYGWIN AND NOT MSYS)
add_definitions (/EHa)
add_definitions (
-DNOMINMAX
- -DBOOST_SYSTEM_DYN_LINK
-DBOOST_ALL_NO_LIB)
endif()
@@ -80,9 +79,8 @@ if (AVRO_BUILD_TESTS OR AVRO_USE_BOOST)
if (AVRO_BUILD_TESTS OR AVRO_USE_BOOST)
# Boost 1.70 and above provide a BoostConfig.cmake package configuration file.
- # It guarantees that Boost::system target exists if found.
# See https://cmake.org/cmake/help/latest/policy/CMP0167.html
- find_package (Boost 1.70 REQUIRED CONFIG COMPONENTS system)
+ find_package (Boost 1.70 REQUIRED CONFIG)
endif ()
find_package(fmt)
@@ -153,11 +151,9 @@ function (setup_avro_lib target lib_type)
$<BUILD_INTERFACE:ZLIB::ZLIB>
$<BUILD_INTERFACE:$<TARGET_NAME_IF_EXISTS:Snappy::snappy>>
$<$<BOOL:${zstd_FOUND}>:$<BUILD_INTERFACE:$<TARGET_NAME_IF_EXISTS:${ZSTD_TARGET}>>>
- $<BUILD_INTERFACE:$<TARGET_NAME_IF_EXISTS:Boost::system>>
$<INSTALL_INTERFACE:ZLIB::ZLIB>
$<INSTALL_INTERFACE:$<TARGET_NAME_IF_EXISTS:Snappy::snappy>>
$<$<BOOL:${zstd_FOUND}>:$<INSTALL_INTERFACE:$<TARGET_NAME_IF_EXISTS:${ZSTD_TARGET}>>>
- $<INSTALL_INTERFACE:$<TARGET_NAME_IF_EXISTS:Boost::system>>
)
target_include_directories (${target} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
@@ -226,7 +222,7 @@ if (AVRO_BUILD_TESTS)
macro (unittest name)
add_executable (${name} test/${name}.cc)
- target_link_libraries (${name} ${AVRO_LINK_LIB} Boost::system ZLIB::ZLIB $<TARGET_NAME_IF_EXISTS:Snappy::snappy> $<$<BOOL:${zstd_FOUND}>:$<TARGET_NAME_IF_EXISTS:${ZSTD_TARGET}>>)
+ target_link_libraries (${name} ${AVRO_LINK_LIB} ZLIB::ZLIB $<TARGET_NAME_IF_EXISTS:Snappy::snappy> $<$<BOOL:${zstd_FOUND}>:$<TARGET_NAME_IF_EXISTS:${ZSTD_TARGET}>>)
add_test (NAME ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name})
endmacro (unittest)
--- cmake/avro-cpp-config.cmake.in.orig 2025-10-27 04:56:52 UTC
+++ cmake/avro-cpp-config.cmake.in
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# This config sets the following variables in your project::
+#
+# avro-cpp_FOUND - true if avro-cpp found on the system
+# avro-cpp_VERSION - version of the found avro-cpp
+#
+# This config sets the following targets in your project::
+#
+# avro-cpp::avrocpp_shared
+# avro-cpp::avrocpp_static
+
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+
+if(DEFINED CMAKE_MODULE_PATH)
+ set(AVRO_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
+else()
+ unset(AVRO_CMAKE_MODULE_PATH_OLD)
+endif()
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
+
+find_dependency(ZLIB REQUIRED)
+find_dependency(fmt REQUIRED)
+if(@Snappy_FOUND@)
+ find_dependency(Snappy REQUIRED)
+endif()
+if(@Boost_FOUND@)
+ find_dependency(Boost 1.70 REQUIRED)
+endif()
+
+if(DEFINED AVRO_CMAKE_MODULE_PATH_OLD)
+ set(CMAKE_MODULE_PATH ${AVRO_CMAKE_MODULE_PATH_OLD})
+ unset(AVRO_CMAKE_MODULE_PATH_OLD)
+else()
+ unset(CMAKE_MODULE_PATH)
+endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/avro-cpp-targets.cmake")
+
+if(@AVRO_BUILD_STATIC@)
+ add_library(avro-cpp::avrocpp_static ALIAS avro-cpp::avrocpp_s)
+endif()
+if(@AVRO_BUILD_SHARED@)
+ add_library(avro-cpp::avrocpp_shared ALIAS avro-cpp::avrocpp)
+endif()
+
+check_required_components(avro-cpp)
--- include/avro/buffer/detail/BufferDetail.hh.orig 2025-09-05 08:05:13 UTC
+++ include/avro/buffer/detail/BufferDetail.hh
@@ -19,9 +19,6 @@
#ifndef avro_BufferDetail_hh__
#define avro_BufferDetail_hh__
-#ifdef HAVE_BOOST_ASIO
-#include <boost/asio/buffer.hpp>
-#endif
#include <cassert>
#include <deque>
#include <exception>
@@ -42,10 +39,6 @@ typedef size_t size_type;
typedef char data_type;
typedef size_t size_type;
-#ifdef HAVE_BOOST_ASIO
-typedef boost::asio::const_buffer ConstAsioBuffer;
-typedef boost::asio::mutable_buffer MutableAsioBuffer;
-#endif
/// The size in bytes for blocks backing buffer chunks.
const size_type kMinBlockSize = 4096;
--- include/avro/buffer/detail/BufferDetailIterator.hh.orig 2025-09-05 08:05:13 UTC
+++ include/avro/buffer/detail/BufferDetailIterator.hh
@@ -57,15 +57,6 @@ struct InputIteratorHelper {
return iter_->dataSize();
}
- /// Conversion operator. It doesn't check for null, because the only
- /// the only time the chunk should be null is when it's the iterator
- /// end(), which should never be dereferenced anyway.
-#ifdef HAVE_BOOST_ASIO
- operator ConstAsioBuffer() const {
- return ConstAsioBuffer(data(), size());
- }
-#endif
-
BufferImpl::ChunkList::const_iterator iter_; ///< the current iterator
};
@@ -94,15 +85,6 @@ struct OutputIteratorHelper {
size_type size() const {
return iter_->freeSize();
}
-
- /// Conversion operator. It doesn't check for null, because the only
- /// the only time the chunk should be null is when it's the iterator
- /// end(), which should never be dereferenced anyway.
-#ifdef HAVE_BOOST_ASIO
- operator MutableAsioBuffer() const {
- return MutableAsioBuffer(data(), size());
- }
-#endif
BufferImpl::ChunkList::const_iterator iter_; ///< the current iterator
};
--- test/buffertest.cc.orig 2025-09-05 08:05:13 UTC
+++ test/buffertest.cc
@@ -20,9 +20,6 @@
#include <boost/bind/bind.hpp>
-#ifdef HAVE_BOOST_ASIO
-#include <boost/asio.hpp>
-#endif
#include "buffer/BufferPrint.hh"
#include "buffer/BufferReader.hh"
#include "buffer/BufferStream.hh"
@@ -607,108 +604,46 @@ void TestIterator() {
}
}
-#ifdef HAVE_BOOST_ASIO
-void server(boost::barrier &b) {
- using boost::asio::ip::tcp;
- boost::asio::io_service io_service;
- tcp::acceptor a(io_service, tcp::endpoint(tcp::v4(), 33333));
- tcp::socket sock(io_service);
- a.listen();
-
- b.wait();
-
- a.accept(sock);
- avro::OutputBuffer buf(100);
-
- size_t length = sock.receive(buf);
- buf.wroteTo(length);
- cout << "Server got " << length << " bytes\n";
-
- InputBuffer rbuf(buf);
-
- std::string res;
-
- avro::InputBuffer::const_iterator iter = rbuf.begin();
- while (iter != rbuf.end()) {
- res.append(boost::asio::buffer_cast<const char *>(*iter), boost::asio::buffer_size(*iter));
- cout << "Received Buffer size: " << boost::asio::buffer_size(*iter) << endl;
- BOOST_CHECK_EQUAL(length, boost::asio::buffer_size(*iter));
- cout << "Received Buffer: \"" << res << '"' << endl;
- ++iter;
- }
-
- BOOST_CHECK_EQUAL(res, "hello world");
-}
-
+// Historical context: Prior to AVRO-4178, InputBuffer and OutputBuffer iterators
+// had implicit conversion operators to boost::asio::const_buffer and
+// boost::asio::mutable_buffer (via ConstAsioBuffer and MutableAsioBuffer typedefs).
+// These conversions were removed to eliminate the Boost::system dependency.
+// This test demonstrates the recommended workaround: users should access the
+// public data() and size() member functions of the dereferenced iterator instead.
+// These functions provide the same underlying buffer pointer and size information
+// that the ASIO conversions provided, allowing integration with any I/O library.
void TestAsioBuffer() {
- using boost::asio::ip::tcp;
BOOST_TEST_MESSAGE("TestAsioBuffer");
{
- boost::barrier b(2);
-
- boost::thread t(boost::bind(server, boost::ref(b)));
-
- b.wait();
-
- // set up the thing
- boost::asio::io_service io_service;
-
- tcp::resolver resolver(io_service);
- tcp::resolver::query query(tcp::v4(), "localhost", "33333");
- tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
- tcp::resolver::iterator end;
-
- tcp::socket socket(io_service);
- boost::system::error_code error = boost::asio::error::host_not_found;
- while (error && endpoint_iterator != end) {
- socket.close();
- socket.connect(*endpoint_iterator++, error);
- }
- if (error) {
- throw error;
- }
-
std::string hello = "hello ";
std::string world = "world";
+
+ // Create a buffer with data
avro::OutputBuffer buf;
buf.writeTo(hello.c_str(), hello.size());
- BOOST_CHECK_EQUAL(buf.size(), hello.size());
-
avro::OutputBuffer buf2;
buf2.writeTo(world.c_str(), world.size());
- BOOST_CHECK_EQUAL(buf2.size(), world.size());
buf.append(buf2);
BOOST_CHECK_EQUAL(buf.size(), hello.size() + world.size());
- cout << "Distance " << std::distance(buf.begin(), buf.end()) << endl;
- BOOST_CHECK_EQUAL(std::distance(buf.begin(), buf.end()), 1);
-
+ // Convert to InputBuffer for reading
const avro::InputBuffer rbuf(buf);
+ // Demonstrate the workaround: instead of relying on implicit ASIO conversions,
+ // users can access data() and size() directly from the dereferenced iterator.
+ std::string reconstructed;
avro::InputBuffer::const_iterator iter = rbuf.begin();
while (iter != rbuf.end()) {
- std::string str(boost::asio::buffer_cast<const char *>(*iter), boost::asio::buffer_size(*iter));
- cout << "Buffer size: " << boost::asio::buffer_size(*iter) << endl;
- cout << "Buffer: \"" << str << '"' << endl;
+ reconstructed.append(iter->data(), iter->size());
++iter;
}
- cout << "Buffer size " << rbuf.size() << endl;
-
- std::size_t wrote = boost::asio::write(socket, rbuf);
- cout << "Wrote " << wrote << endl;
- BOOST_CHECK_EQUAL(wrote, rbuf.size());
-
- t.join();
+ BOOST_CHECK_EQUAL(reconstructed, "hello world");
+ BOOST_CHECK_EQUAL(reconstructed.size(), rbuf.size());
}
}
-#else
-void TestAsioBuffer() {
- cout << "Skipping asio test\n";
-}
-#endif // HAVE_BOOST_ASIO
void TestSplit() {
BOOST_TEST_MESSAGE("TestSplit");

View File

@@ -1,11 +0,0 @@
--- include/avro/Node.hh.orig 2024-07-26 07:46:40 UTC
+++ include/avro/Node.hh
@@ -219,7 +219,7 @@ struct fmt::formatter<avro::Name> : fmt::formatter<std
template<>
struct fmt::formatter<avro::Name> : fmt::formatter<std::string> {
template<typename FormatContext>
- auto format(const avro::Name &n, FormatContext &ctx) {
+ auto format(const avro::Name &n, FormatContext &ctx) const {
return fmt::formatter<std::string>::format(n.fullname(), ctx);
}
};

View File

@@ -1,11 +0,0 @@
--- include/avro/Types.hh.orig 2024-07-26 07:46:40 UTC
+++ include/avro/Types.hh
@@ -113,7 +113,7 @@ struct fmt::formatter<avro::Type> : fmt::formatter<std
template<>
struct fmt::formatter<avro::Type> : fmt::formatter<std::string> {
template<typename FormatContext>
- auto format(avro::Type t, FormatContext &ctx) {
+ auto format(avro::Type t, FormatContext &ctx) const {
return fmt::formatter<std::string>::format(avro::toString(t), ctx);
}
};

View File

@@ -38,6 +38,10 @@ include/avro/buffer/BufferStream.hh
include/avro/buffer/BufferStreambuf.hh
include/avro/buffer/detail/BufferDetail.hh
include/avro/buffer/detail/BufferDetailIterator.hh
lib/cmake/avro-cpp/avro-cpp-config-version.cmake
lib/cmake/avro-cpp/avro-cpp-config.cmake
lib/cmake/avro-cpp/avro-cpp-targets-%%CMAKE_BUILD_TYPE%%.cmake
lib/cmake/avro-cpp/avro-cpp-targets.cmake
lib/libavrocpp.so
lib/libavrocpp.so.1
lib/libavrocpp.so.%%PORTVERSION%%