From 254a2f4c9ce1ec6ea11fa9736128c45b78061e18 Mon Sep 17 00:00:00 2001 From: Nuno Teixeira Date: Sat, 15 Feb 2025 21:22:46 +0000 Subject: [PATCH] net-p2p/amule: Unbreak with boost 1.87+ - While here, simplify options helpers --- net-p2p/amule/Makefile | 40 +++---- net-p2p/amule/files/patch-fix-boost1.87+ | 139 +++++++++++++++++++++++ 2 files changed, 159 insertions(+), 20 deletions(-) create mode 100644 net-p2p/amule/files/patch-fix-boost1.87+ diff --git a/net-p2p/amule/Makefile b/net-p2p/amule/Makefile index cd1e7d0ffba6..5cead01f5d75 100644 --- a/net-p2p/amule/Makefile +++ b/net-p2p/amule/Makefile @@ -1,6 +1,6 @@ PORTNAME= amule PORTVERSION= 2.3.3 -PORTREVISION= 13 +PORTREVISION= 14 CATEGORIES= net-p2p MASTER_SITES= SF/${PORTNAME}/aMule/${PORTVERSION} DISTNAME= aMule-${PORTVERSION} @@ -48,49 +48,49 @@ OPTIONS_DEFAULT= ALC ALCC AMULECMD AMULEDAEMON AMULEGUI BOOST CAS ED2K \ FILEVIEW MONOLITHIC WEBSERVER WXCAS XAS OPTIONS_SUB= yes -DEBUG_CONFIGURE_OFF= --disable-debug +DEBUG_CONFIGURE_ENABLE= debug NLS_USES= gettext -NLS_CONFIGURE_OFF= --disable-nls +NLS_CONFIGURE_ENABLE= nls -ALC_CONFIGURE_ON= --enable-alc +ALC_CONFIGURE_ENABLE= alc -ALCC_CONFIGURE_ON= --enable-alcc +ALCC_CONFIGURE_ENABLE= alcc -AMULECMD_CONFIGURE_ON= --enable-amulecmd +AMULECMD_CONFIGURE_ENABLE= amulecmd AMULECMD_USES= readline -AMULEDAEMON_CONFIGURE_ON= --enable-amule-daemon +AMULEDAEMON_CONFIGURE_ENABLE= amule-daemon AMULEDAEMON_USE= RC_SUBR=amuled -AMULEGUI_CONFIGURE_ON= --enable-amule-gui +AMULEGUI_CONFIGURE_ENABLE= amule-gui -BOOST_BROKEN= fails to build with Boost>=1.87 -BOOST_CONFIGURE_ON= --with-boost -BOOST_LIB_DEPENDS+= libboost_system.so:devel/boost-libs +BOOST_CONFIGURE_WITH= boost +BOOST_LIB_DEPENDS= libboost_system.so:devel/boost-libs -CAS_CONFIGURE_ON= --enable-cas +CAS_CONFIGURE_ENABLE= cas CAS_LIB_DEPENDS= libgd.so:graphics/gd -ED2K_CONFIGURE_OFF= --disable-ed2k +ED2K_CONFIGURE_ENABLE= ed2k ED2K_CONFLICTS= ed2k-hash* -FILEVIEW_CONFIGURE_ON= --enable-fileview +FILEVIEW_CONFIGURE_ENABLE= fileview -MMAP_CONFIGURE_ON= --enable-mmap +MMAP_CONFIGURE_ENABLE= mmap -MONOLITHIC_CONFIGURE_OFF= --disable-monolithic +MONOLITHIC_CONFIGURE_ENABLE= monolithic UPNP_LIB_DEPENDS= libupnp.so:devel/upnp -UPNP_CONFIGURE_OFF= --disable-upnp +UPNP_CONFIGURE_ENABLE= upnp -WEBSERVER_CONFIGURE_ON= --enable-webserver +WEBSERVER_CONFIGURE_ENABLE= webserver WEBSERVER_LIB_DEPENDS= libpng.so:graphics/png WEBSERVER_USES= readline -WXCAS_CONFIGURE_ON= --enable-wxcas +# Build fails if only option selected +WXCAS_CONFIGURE_ENABLE= wxcas -XAS_CONFIGURE_ON= --enable-xas +XAS_CONFIGURE_ENABLE= xas XAS_USE= PERL5+=run .include diff --git a/net-p2p/amule/files/patch-fix-boost1.87+ b/net-p2p/amule/files/patch-fix-boost1.87+ new file mode 100644 index 000000000000..b7a406b7faf5 --- /dev/null +++ b/net-p2p/amule/files/patch-fix-boost1.87+ @@ -0,0 +1,139 @@ +commit 212b1891da96750ca602df05b575b4d679ca6f1e +Author: Luigi 'Comio' Mantellini +Date: Mon Dec 16 07:53:11 2024 +0100 + + Fix build with Boost 1.87 that removes deprecated asio methods + +diff --git src/LibSocketAsio.cpp src/LibSocketAsio.cpp +index 5f8b02652..8e15c8635 100644 +--- src/LibSocketAsio.cpp ++++ src/LibSocketAsio.cpp +@@ -70,7 +70,7 @@ + + using namespace boost::asio; + using namespace boost::system; // for error_code +-static io_service s_io_service; ++static io_context s_io_service; + + // Number of threads in the Asio thread pool + const int CAsioService::m_numberOfThreads = 4; +@@ -265,7 +265,7 @@ public: + AddDebugLogLineF(logAsio, CFormat(wxT("Write %d %s")) % nbytes % m_IP); + m_sendBuffer = new char[nbytes]; + memcpy(m_sendBuffer, buf, nbytes); +- m_strand.dispatch(boost::bind(& CAsioSocketImpl::DispatchWrite, this, nbytes)); ++ dispatch(m_strand, boost::bind(& CAsioSocketImpl::DispatchWrite, this, nbytes)); + m_ErrorCode = 0; + return nbytes; + } +@@ -279,7 +279,7 @@ public: + if (m_sync || s_io_service.stopped()) { + DispatchClose(); + } else { +- m_strand.dispatch(boost::bind(& CAsioSocketImpl::DispatchClose, this)); ++ dispatch(m_strand, boost::bind(& CAsioSocketImpl::DispatchClose, this)); + } + } + } +@@ -538,7 +538,7 @@ private: + { + m_readPending = true; + m_readBufferContent = 0; +- m_strand.dispatch(boost::bind(& CAsioSocketImpl::DispatchBackgroundRead, this)); ++ dispatch(m_strand, boost::bind(& CAsioSocketImpl::DispatchBackgroundRead, this)); + } + + void PostReadEvent(int DEBUG_ONLY(from) ) +@@ -618,7 +618,7 @@ private: + uint32 m_readBufferContent; + bool m_eventPending; + char * m_sendBuffer; +- io_service::strand m_strand; // handle synchronisation in io_service thread pool ++ io_context::strand m_strand; // handle synchronisation in io_service thread pool + deadline_timer m_timer; + bool m_connected; + bool m_closed; +@@ -875,7 +875,7 @@ private: + } + // We were not successful. Try again. + // Post the request to the event queue to make sure it doesn't get called immediately. +- m_strand.post(boost::bind(& CAsioSocketServerImpl::StartAccept, this)); ++ post(m_strand, boost::bind(& CAsioSocketServerImpl::StartAccept, this)); + } + + // The wrapper object +@@ -886,7 +886,7 @@ private: + CScopedPtr m_currentSocket; + // Is there a socket available? + bool m_socketAvailable; +- io_service::strand m_strand; // handle synchronisation in io_service thread pool ++ io_context::strand m_strand; // handle synchronisation in io_service thread pool + }; + + +@@ -1021,7 +1021,7 @@ public: + // Collect data, make a copy of the buffer's content + CUDPData * recdata = new CUDPData(buf, nBytes, addr); + AddDebugLogLineF(logAsio, CFormat(wxT("UDP SendTo %d to %s")) % nBytes % addr.IPAddress()); +- m_strand.dispatch(boost::bind(& CAsioUDPSocketImpl::DispatchSendTo, this, recdata)); ++ dispatch(m_strand, boost::bind(& CAsioUDPSocketImpl::DispatchSendTo, this, recdata)); + return nBytes; + } + +@@ -1035,7 +1035,7 @@ public: + if (s_io_service.stopped()) { + DispatchClose(); + } else { +- m_strand.dispatch(boost::bind(& CAsioUDPSocketImpl::DispatchClose, this)); ++ dispatch(m_strand, boost::bind(& CAsioUDPSocketImpl::DispatchClose, this)); + } + } + +@@ -1162,7 +1162,7 @@ private: + ip::udp::socket * m_socket; + CMuleUDPSocket * m_muleSocket; + bool m_OK; +- io_service::strand m_strand; // handle synchronisation in io_service thread pool ++ io_context::strand m_strand; // handle synchronisation in io_service thread pool + deadline_timer m_timer; + amuleIPV4Address m_address; + +@@ -1254,7 +1254,7 @@ public: + void * Entry() + { + AddLogLineNS(CFormat(_("Asio thread %d started")) % m_threadNumber); +- io_service::work worker(s_io_service); // keep io_service running ++ auto worker = make_work_guard(s_io_service); // keep io_service running + s_io_service.run(); + AddDebugLogLineN(logAsio, CFormat(wxT("Asio thread %d stopped")) % m_threadNumber); + +@@ -1342,7 +1342,7 @@ bool amuleIPV4Address::Hostname(const wxString& name) + // This is usually just an IP. + std::string sname(unicode2char(name)); + error_code ec; +- ip::address_v4 adr = ip::address_v4::from_string(sname, ec); ++ ip::address_v4 adr = ip::make_address_v4(sname, ec); + if (!ec) { + m_endpoint->address(adr); + return true; +@@ -1353,17 +1353,16 @@ bool amuleIPV4Address::Hostname(const wxString& name) + error_code ec2; + ip::tcp::resolver res(s_io_service); + // We only want to get IPV4 addresses. +- ip::tcp::resolver::query query(ip::tcp::v4(), sname, ""); +- ip::tcp::resolver::iterator endpoint_iterator = res.resolve(query, ec2); ++ ip::tcp::resolver::results_type endpoint_iterator = res.resolve(sname, "", ec2); + if (ec2) { + AddDebugLogLineN(logAsio, CFormat(wxT("Hostname(\"%s\") resolve failed: %s")) % name % ec2.message()); + return false; + } +- if (endpoint_iterator == ip::tcp::resolver::iterator()) { ++ if (endpoint_iterator == ip::tcp::resolver::results_type()) { + AddDebugLogLineN(logAsio, CFormat(wxT("Hostname(\"%s\") resolve failed: no address found")) % name); + return false; + } +- m_endpoint->address(endpoint_iterator->endpoint().address()); ++ m_endpoint->address(endpoint_iterator.begin()->endpoint().address()); + AddDebugLogLineN(logAsio, CFormat(wxT("Hostname(\"%s\") resolved to %s")) % name % IPAddress()); + return true; + }