summaryrefslogtreecommitdiff
path: root/devel/avro-cpp/files/patch-boost
blob: 7adb774e650da00aafe675ebeee89fc11700f992 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
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");