commit:     b0a1df87fba2e9f8057b5b16529ee0dcd49c8ae2
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Thu May  1 10:46:34 2025 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Thu May  1 10:57:58 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0a1df87

games-strategy/widelands: fix build with gcc-15 and asio-1.34

Using -std=gnu17 to have just a litte less to backport
until next version.

Closes: https://bugs.gentoo.org/938230
Closes: https://bugs.gentoo.org/955174
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../widelands/files/widelands-1.2.1-asio1.34.patch | 127 +++++++++++++++++++++
 .../widelands/files/widelands-1.2.1-cstdint.patch  |  16 +++
 games-strategy/widelands/widelands-1.2.1.ebuild    |  11 +-
 3 files changed, 152 insertions(+), 2 deletions(-)

diff --git a/games-strategy/widelands/files/widelands-1.2.1-asio1.34.patch 
b/games-strategy/widelands/files/widelands-1.2.1-asio1.34.patch
new file mode 100644
index 000000000000..f1a014e0cfcd
--- /dev/null
+++ b/games-strategy/widelands/files/widelands-1.2.1-asio1.34.patch
@@ -0,0 +1,127 @@
+https://bugs.gentoo.org/955174
+https://github.com/widelands/widelands/pull/6665
+--- a/src/network/bufferedconnection.cc
++++ b/src/network/bufferedconnection.cc
+@@ -143,8 +143,8 @@
+       // Stop the thread
+-      io_service_.stop();
+-      // Not sure if that is required, wait up to one second for the 
io_service to stop
+-      for (int i = 0; i < 1000 && !io_service_.stopped(); i++) {
++      io_context_.stop();
++      // Not sure if that is required, wait up to one second for the 
io_context to stop
++      for (int i = 0; i < 1000 && !io_context_.stopped(); i++) {
+               std::this_thread::sleep_for(std::chrono::milliseconds(1));
+       }
+-      assert(io_service_.stopped());
++      assert(io_context_.stopped());
+       if (asio_thread_.joinable()) {
+@@ -336,3 +336,3 @@
+ BufferedConnection::BufferedConnection(const NetAddress& host)
+-   : socket_(io_service_), currently_sending_(false) {
++   : socket_(io_context_), currently_sending_(false) {
+ 
+@@ -355,3 +355,3 @@
+                       verb_log_info("[BufferedConnection] Starting networking 
thread\n");
+-                      io_service_.run();
++                      io_context_.run();
+                       verb_log_info("[BufferedConnection] Stopping networking 
thread\n");
+@@ -366,3 +366,3 @@
+ 
+-BufferedConnection::BufferedConnection() : socket_(io_service_) {
++BufferedConnection::BufferedConnection() : socket_(io_context_) {
+ }
+@@ -381,3 +381,3 @@
+               verb_log_info("[BufferedConnection] Starting networking 
thread");
+-              io_service_.run();
++              io_context_.run();
+               verb_log_info("[BufferedConnection] Stopping networking 
thread");
+--- a/src/network/bufferedconnection.h
++++ b/src/network/bufferedconnection.h
+@@ -314,4 +314,4 @@
+ 
+-      /// An io_service needed by asio. Primarily needed for asynchronous 
operations.
+-      asio::io_service io_service_;
++      /// An io_context needed by asio. Primarily needed for asynchronous 
operations.
++      asio::io_context io_context_;
+ 
+--- a/src/network/nethost.cc
++++ b/src/network/nethost.cc
+@@ -69,7 +69,7 @@
+       // Stop the thread
+-      io_service_.stop();
+-      for (int i = 0; i < 1000 && !io_service_.stopped(); i++) {
++      io_context_.stop();
++      for (int i = 0; i < 1000 && !io_context_.stopped(); i++) {
+               std::this_thread::sleep_for(std::chrono::milliseconds(1));
+       }
+-      assert(io_service_.stopped());
++      assert(io_context_.stopped());
+       if (asio_thread_.joinable()) {
+@@ -185,3 +185,3 @@
+ 
+-NetHost::NetHost(const uint16_t port) : acceptor_v4_(io_service_), 
acceptor_v6_(io_service_) {
++NetHost::NetHost(const uint16_t port) : acceptor_v4_(io_context_), 
acceptor_v6_(io_context_) {
+ 
+@@ -200,3 +200,3 @@
+               verb_log_info("[NetHost] Starting networking thread");
+-              io_service_.run();
++              io_context_.run();
+               verb_log_info("[NetHost] Stopping networking thread");
+@@ -216,3 +216,3 @@
+               acceptor->bind(endpoint);
+-              acceptor->listen(asio::socket_base::max_connections);
++              acceptor->listen(asio::socket_base::max_listen_connections);
+               return true;
+--- a/src/network/nethost.h
++++ b/src/network/nethost.h
+@@ -103,4 +103,4 @@
+       NetHostInterface::ConnectionId next_id_{1};
+-      /// An io_service needed by asio. Primary needed for async operations.
+-      asio::io_service io_service_;
++      /// An io_context needed by asio. Primary needed for async operations.
++      asio::io_context io_context_;
+       /// The acceptor we get IPv4 connection requests to.
+--- a/src/network/network.cc
++++ b/src/network/network.cc
+@@ -32,7 +32,7 @@
+       try {
+-              asio::io_service io_service;
+-              asio::ip::tcp::resolver resolver(io_service);
+-              asio::ip::tcp::resolver::query query(protocol, hostname, 
as_string(port));
+-              asio::ip::tcp::resolver::iterator iter = 
resolver.resolve(query);
+-              if (iter == asio::ip::tcp::resolver::iterator()) {
++              asio::io_context io_context;
++              asio::ip::tcp::resolver resolver(io_context);
++              asio::ip::tcp::resolver::results_type iter =
++                 resolver.resolve(protocol, hostname, as_string(port));
++              if (iter.empty()) {
+                       // Resolution failed
+@@ -42,3 +42,3 @@
+               }
+-              addr->ip = iter->endpoint().address();
++              addr->ip = iter.begin()->endpoint().address();
+               addr->port = port;
+@@ -66,3 +66,3 @@
+       std::error_code ec;
+-      asio::ip::address new_addr = asio::ip::address::from_string(ip, ec);
++      asio::ip::address new_addr = asio::ip::make_address(ip, ec);
+       if (ec) {
+--- a/src/network/network_lan_promotion.cc
++++ b/src/network/network_lan_promotion.cc
+@@ -77,3 +77,3 @@
+  */
+-LanBase::LanBase(uint16_t port) : socket_v4(io_service), 
socket_v6(io_service) {
++LanBase::LanBase(uint16_t port) : socket_v4(io_context), 
socket_v6(io_context) {
+ 
+@@ -252,3 +252,3 @@
+                       std::error_code ec;
+-                      asio::ip::udp::endpoint 
destination(asio::ip::address::from_string(address), port);
++                      asio::ip::udp::endpoint 
destination(asio::ip::make_address(address), port);
+                       socket.send_to(asio::buffer(buf, len), destination, 0, 
ec);
+--- a/src/network/network_lan_promotion.h
++++ b/src/network/network_lan_promotion.h
+@@ -135,3 +135,3 @@
+       /// No idea what this does. I think it is only really used when 
asynchronous operations are done.
+-      asio::io_service io_service;
++      asio::io_context io_context;
+       /// The socket for IPv4.

diff --git a/games-strategy/widelands/files/widelands-1.2.1-cstdint.patch 
b/games-strategy/widelands/files/widelands-1.2.1-cstdint.patch
new file mode 100644
index 000000000000..1181f468a5dd
--- /dev/null
+++ b/games-strategy/widelands/files/widelands-1.2.1-cstdint.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/938230
+https://github.com/widelands/widelands/pull/6522
+--- a/src/base/format/abstract_node.h
++++ b/src/base/format/abstract_node.h
+@@ -21,2 +21,4 @@
+ 
++#include <cstdint>
++
+ namespace format_impl {
+--- a/src/logic/map_objects/tribes/training_attribute.h
++++ b/src/logic/map_objects/tribes/training_attribute.h
+@@ -21,2 +21,4 @@
+ 
++#include <cstdint>
++
+ namespace Widelands {

diff --git a/games-strategy/widelands/widelands-1.2.1.ebuild 
b/games-strategy/widelands/widelands-1.2.1.ebuild
index c3f0df651d6b..bec32406ee65 100644
--- a/games-strategy/widelands/widelands-1.2.1.ebuild
+++ b/games-strategy/widelands/widelands-1.2.1.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
 PYTHON_COMPAT=( python3_{10..13} )
-inherit cmake python-any-r1 xdg
+inherit cmake flag-o-matic python-any-r1 xdg
 
 if [[ ${PV} == 9999 ]]; then
        inherit git-r3
@@ -46,7 +46,14 @@ BDEPEND="
        sys-devel/gettext
 "
 
+PATCHES=(
+       "${FILESDIR}"/${P}-asio1.34.patch
+       "${FILESDIR}"/${P}-cstdint.patch
+)
+
 src_configure() {
+       append-cflags -std=gnu17
+
        local mycmakeargs=(
                -DWL_INSTALL_BASEDIR="${EPREFIX}"/usr/share/doc/${PF}
                -DWL_INSTALL_BINDIR="${EPREFIX}"/usr/bin

Reply via email to