git: 4db2ed6923cc - main - net/kea: Fix build following boost 1.87 import

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Sun, 16 Feb 2025 01:04:41 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4db2ed6923cc5fd9bc5cc0ed19c87e2f398aa297

commit 4db2ed6923cc5fd9bc5cc0ed19c87e2f398aa297
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2025-02-15 14:57:54 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2025-02-16 01:04:18 +0000

    net/kea: Fix build following boost 1.87 import
    
    Fix build following a4245a4c6ce1.
    
    Obtained from:  upstream 81edc181f8 -  Update asiolink for boost 1.87
---
 net/kea/Makefile                                   |  2 -
 .../files/patch-src_lib_asiolink_io__address.cc    | 20 ++++++
 .../files/patch-src_lib_asiolink_io__service.cc    | 35 ++++++++++
 .../files/patch-src_lib_asiolink_tcp__endpoint.h   | 11 ++++
 .../files/patch-src_lib_asiolink_udp__endpoint.h   | 11 ++++
 .../patch-src_lib_asiolink_unix__domain__socket.cc | 74 ++++++++++++++++++++++
 net/kea/files/patch-src_lib_dhcp_iface__mgr.cc     | 11 ++++
 7 files changed, 162 insertions(+), 2 deletions(-)

diff --git a/net/kea/Makefile b/net/kea/Makefile
index c55d9e15bef8..153b710bae17 100644
--- a/net/kea/Makefile
+++ b/net/kea/Makefile
@@ -11,8 +11,6 @@ WWW=		https://kea.isc.org/
 LICENSE=	MPL20
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-BROKEN=		fails to build with Boost>=1.87
-
 LIB_DEPENDS=	libboost_system.so:devel/boost-libs \
 		liblog4cplus.so:devel/log4cplus
 
diff --git a/net/kea/files/patch-src_lib_asiolink_io__address.cc b/net/kea/files/patch-src_lib_asiolink_io__address.cc
new file mode 100644
index 000000000000..a61e7460eebd
--- /dev/null
+++ b/net/kea/files/patch-src_lib_asiolink_io__address.cc
@@ -0,0 +1,20 @@
+--- src/lib/asiolink/io_address.cc.orig	2024-07-25 08:50:58 UTC
++++ src/lib/asiolink/io_address.cc
+@@ -37,7 +37,7 @@ IOAddress::IOAddress(const std::string& address_str) {
+ // because we'd like to throw our own exception on failure.
+ IOAddress::IOAddress(const std::string& address_str) {
+     boost::system::error_code err;
+-    asio_address_ = ip::address::from_string(address_str, err);
++    asio_address_ = ip::make_address(address_str, err);
+     if (err) {
+         isc_throw(IOError, "Failed to convert string to address '"
+                   << address_str << "': " << err.message());
+@@ -116,7 +116,7 @@ IOAddress::toUint32() const {
+ uint32_t
+ IOAddress::toUint32() const {
+     if (asio_address_.is_v4()) {
+-        return (asio_address_.to_v4().to_ulong());
++        return (asio_address_.to_v4().to_uint());
+     } else {
+         isc_throw(BadValue, "Can't convert " << toText()
+                   << " address to IPv4.");
diff --git a/net/kea/files/patch-src_lib_asiolink_io__service.cc b/net/kea/files/patch-src_lib_asiolink_io__service.cc
new file mode 100644
index 000000000000..21e451eb0648
--- /dev/null
+++ b/net/kea/files/patch-src_lib_asiolink_io__service.cc
@@ -0,0 +1,35 @@
+--- src/lib/asiolink/io_service.cc.orig	2024-07-25 08:50:58 UTC
++++ src/lib/asiolink/io_service.cc
+@@ -30,7 +30,7 @@ class IOServiceImpl { (public)
+     /// @brief The constructor.
+     IOServiceImpl() :
+         io_service_(),
+-        work_(new boost::asio::io_service::work(io_service_)) {
++        work_(boost::asio::make_work_guard(io_service_)) {
+     };
+ 
+     /// @brief The destructor.
+@@ -92,7 +92,7 @@ class IOServiceImpl { (public)
+ 
+     /// @brief Restarts the IOService in preparation for a subsequent @ref run() invocation.
+     void restart() {
+-        io_service_.reset();
++        io_service_.restart();
+     }
+ 
+     /// @brief Removes IO service work object to let it finish running
+@@ -115,12 +115,12 @@ class IOServiceImpl { (public)
+     ///
+     /// @param callback The callback to be run on the IO service.
+     void post(const std::function<void ()>& callback) {
+-        io_service_.post(callback);
++        boost::asio::post(io_service_, callback);
+     }
+ 
+ private:
+     boost::asio::io_service io_service_;
+-    boost::shared_ptr<boost::asio::io_service::work> work_;
++    boost::asio::executor_work_guard<boost::asio::io_service::executor_type> work_;
+ };
+ 
+ IOService::IOService() : io_impl_(new IOServiceImpl()) {
diff --git a/net/kea/files/patch-src_lib_asiolink_tcp__endpoint.h b/net/kea/files/patch-src_lib_asiolink_tcp__endpoint.h
new file mode 100644
index 000000000000..c2c0d7d80442
--- /dev/null
+++ b/net/kea/files/patch-src_lib_asiolink_tcp__endpoint.h
@@ -0,0 +1,11 @@
+--- src/lib/asiolink/tcp_endpoint.h.orig	2024-07-25 08:50:58 UTC
++++ src/lib/asiolink/tcp_endpoint.h
+@@ -42,7 +42,7 @@ class TCPEndpoint : public IOEndpoint { (public)
+     /// \param port The TCP port number of the endpoint.
+     TCPEndpoint(const IOAddress& address, const unsigned short port) :
+         asio_endpoint_placeholder_(
+-            new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(address.toText()),
++            new boost::asio::ip::tcp::endpoint(boost::asio::ip::make_address(address.toText()),
+                               port)),
+         asio_endpoint_(*asio_endpoint_placeholder_)
+     {}
diff --git a/net/kea/files/patch-src_lib_asiolink_udp__endpoint.h b/net/kea/files/patch-src_lib_asiolink_udp__endpoint.h
new file mode 100644
index 000000000000..c528b76f5ce1
--- /dev/null
+++ b/net/kea/files/patch-src_lib_asiolink_udp__endpoint.h
@@ -0,0 +1,11 @@
+--- src/lib/asiolink/udp_endpoint.h.orig	2024-07-25 08:50:58 UTC
++++ src/lib/asiolink/udp_endpoint.h
+@@ -42,7 +42,7 @@ class UDPEndpoint : public IOEndpoint { (public)
+     /// \param port The UDP port number of the endpoint.
+     UDPEndpoint(const IOAddress& address, const unsigned short port) :
+         asio_endpoint_placeholder_(
+-            new boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(address.toText()),
++            new boost::asio::ip::udp::endpoint(boost::asio::ip::make_address(address.toText()),
+                               port)),
+         asio_endpoint_(*asio_endpoint_placeholder_)
+     {}
diff --git a/net/kea/files/patch-src_lib_asiolink_unix__domain__socket.cc b/net/kea/files/patch-src_lib_asiolink_unix__domain__socket.cc
new file mode 100644
index 000000000000..b540cacb5890
--- /dev/null
+++ b/net/kea/files/patch-src_lib_asiolink_unix__domain__socket.cc
@@ -0,0 +1,74 @@
+--- src/lib/asiolink/unix_domain_socket.cc.orig	2024-07-25 08:50:58 UTC
++++ src/lib/asiolink/unix_domain_socket.cc
+@@ -83,7 +83,7 @@ class UnixDomainSocketImpl : public boost::enable_shar
+     /// @param buffer Buffers holding the data to be sent.
+     /// @param handler User supplied callback to be invoked when data have
+     /// been sent or sending error is signalled.
+-    void doSend(const boost::asio::const_buffers_1& buffer,
++    void doSend(const boost::asio::const_buffer& buffer,
+                 const UnixDomainSocket::Handler& handler);
+ 
+ 
+@@ -103,7 +103,7 @@ class UnixDomainSocketImpl : public boost::enable_shar
+     /// @param ec Error code returned as a result of sending the data.
+     /// @param length Length of the data sent.
+     void sendHandler(const UnixDomainSocket::Handler& remote_handler,
+-                     const boost::asio::const_buffers_1& buffer,
++                     const boost::asio::const_buffer& buffer,
+                      const boost::system::error_code& ec,
+                      size_t length);
+ 
+@@ -127,7 +127,7 @@ class UnixDomainSocketImpl : public boost::enable_shar
+     /// @param buffer A buffer into which the data should be received.
+     /// @param handler User supplied callback invoked when data have been
+     /// received on an error is signalled.
+-    void doReceive(const boost::asio::mutable_buffers_1& buffer,
++    void doReceive(const boost::asio::mutable_buffer& buffer,
+                    const UnixDomainSocket::Handler& handler);
+ 
+     /// @brief Local handler invoked as a result of asynchronous receive.
+@@ -146,7 +146,7 @@ class UnixDomainSocketImpl : public boost::enable_shar
+     /// @param ec Error code returned as a result of asynchronous receive.
+     /// @param length Size of the received data.
+     void receiveHandler(const UnixDomainSocket::Handler& remote_handler,
+-                        const boost::asio::mutable_buffers_1& buffer,
++                        const boost::asio::mutable_buffer& buffer,
+                         const boost::system::error_code& ec,
+                         size_t length);
+ 
+@@ -197,7 +197,7 @@ void
+ }
+ 
+ void
+-UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer,
++UnixDomainSocketImpl::doSend(const boost::asio::const_buffer& buffer,
+                              const UnixDomainSocket::Handler& handler) {
+     auto local_handler = std::bind(&UnixDomainSocketImpl::sendHandler,
+                                    shared_from_this(),
+@@ -207,7 +207,7 @@ UnixDomainSocketImpl::sendHandler(const UnixDomainSock
+ 
+ void
+ UnixDomainSocketImpl::sendHandler(const UnixDomainSocket::Handler& remote_handler,
+-                                  const boost::asio::const_buffers_1& buffer,
++                                  const boost::asio::const_buffer& buffer,
+                                   const boost::system::error_code& ec,
+                                   size_t length) {
+     // The asynchronous send may return EWOULDBLOCK or EAGAIN on some
+@@ -230,7 +230,7 @@ void
+ }
+ 
+ void
+-UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer,
++UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffer& buffer,
+                                 const UnixDomainSocket::Handler& handler) {
+     auto local_handler = std::bind(&UnixDomainSocketImpl::receiveHandler,
+                                    shared_from_this(),
+@@ -240,7 +240,7 @@ UnixDomainSocketImpl::receiveHandler(const UnixDomainS
+ 
+ void
+ UnixDomainSocketImpl::receiveHandler(const UnixDomainSocket::Handler& remote_handler,
+-                                     const boost::asio::mutable_buffers_1& buffer,
++                                     const boost::asio::mutable_buffer& buffer,
+                                      const boost::system::error_code& ec,
+                                      size_t length) {
+     // The asynchronous receive may return EWOULDBLOCK or EAGAIN on some
diff --git a/net/kea/files/patch-src_lib_dhcp_iface__mgr.cc b/net/kea/files/patch-src_lib_dhcp_iface__mgr.cc
new file mode 100644
index 000000000000..e0347d0cb59e
--- /dev/null
+++ b/net/kea/files/patch-src_lib_dhcp_iface__mgr.cc
@@ -0,0 +1,11 @@
+--- src/lib/dhcp/iface_mgr.cc.orig	2024-07-25 08:50:58 UTC
++++ src/lib/dhcp/iface_mgr.cc
+@@ -1034,7 +1034,7 @@ IfaceMgr::getLocalAddress(const IOAddress& remote_addr
+     }
+ 
+     // Create socket that will be used to connect to remote endpoint.
+-    boost::asio::io_service io_service;
++    boost::asio::io_context io_service;
+     boost::asio::ip::udp::socket sock(io_service);
+ 
+     boost::system::error_code err_code;