commit:     d905b33fc3e07842e6d0440b820e41d132baab78
Author:     Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr>
AuthorDate: Fri Jul  4 07:03:39 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul  4 20:02:33 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d905b33f

games-roguelike/crossfire-client: add 1.75.3

move to cmake build system
add vala and xdg eclasses

deps :
opengl and sdl renders have been removed with 1.75.2
but libsdl2 is still required for sound (sdl2-mixer) that is not optional
add rdeps inherited from gtk+

patches :
fix an overflow, from upstream
bump cmake_min, from upstream
fix the SDL search
fix a staticlib

bug #945644 fixed since 1.72.0

Bug: https://bugs.gentoo.org/945644
Closes: https://bugs.gentoo.org/628074
Closes: https://bugs.gentoo.org/934806
Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/42858
Closes: https://github.com/gentoo/gentoo/pull/42858
Signed-off-by: Sam James <sam <AT> gentoo.org>

 games-roguelike/crossfire-client/Manifest          |  1 +
 .../crossfire-client-1.75.3.ebuild                 | 61 ++++++++++++++++++++++
 .../files/crossfire-client-1.75.3-cmake4.patch     | 11 ++++
 .../crossfire-client-1.75.3-fix_overflow.patch     | 32 ++++++++++++
 .../files/crossfire-client-1.75.3-sdl.patch        | 26 +++++++++
 .../files/crossfire-client-1.75.3-staticlib.patch  | 15 ++++++
 6 files changed, 146 insertions(+)

diff --git a/games-roguelike/crossfire-client/Manifest 
b/games-roguelike/crossfire-client/Manifest
index cfd2df26fa15..e45929588dd6 100644
--- a/games-roguelike/crossfire-client/Manifest
+++ b/games-roguelike/crossfire-client/Manifest
@@ -1 +1,2 @@
 DIST crossfire-client-1.71.0.tar.bz2 761156 BLAKE2B 
6a5938ca8d9c7060f43f5b6a54ff2ed65521ec8ffbc76c10be25ae8802e95d77242edb6d52852410ccd352b51d5fc9edcdb9b85dc618cecfa79cd37ff0212c0f
 SHA512 
86710d684fd7908ea9aaf5ba20bff0f1ba01ff0ba90c3e2847afff9d0db6f60c7b671413c8888b513c992fbf27474e744b79df185d5e2c04afc9d2dce3d8665e
+DIST crossfire-client-1.75.3.tar.gz 1052116 BLAKE2B 
a093cba8bc5cf6719454ce80b6f55a918ca283c80fbf063b74fe74e751d95a8f22bab3e276b10f8d657456c8081d4d973515335c99a564db978b23480537ea4a
 SHA512 
e838b3484f9637ccc01678559c7e7a1a7e29cdb37a850fa19b62dc64e2164345cfe3279c073c7b640ccb3ead54e5e6c0f16787d69257c36534730e72b7165a3e

diff --git a/games-roguelike/crossfire-client/crossfire-client-1.75.3.ebuild 
b/games-roguelike/crossfire-client/crossfire-client-1.75.3.ebuild
new file mode 100644
index 000000000000..80419f778517
--- /dev/null
+++ b/games-roguelike/crossfire-client/crossfire-client-1.75.3.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-1 )
+
+inherit cmake lua-single vala xdg
+
+DESCRIPTION="Client for the nethack-style but more in the line of UO"
+HOMEPAGE="https://crossfire.real-time.com/";
+SRC_URI="https://downloads.sourceforge.net/project/crossfire/${PN}/${PV}/${P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="lua"
+REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )"
+
+RDEPEND="
+       dev-libs/glib:2
+       media-libs/libpng:=
+       media-libs/libsdl2
+       media-libs/sdl2-mixer[vorbis,wav]
+       net-misc/curl
+       x11-libs/cairo
+       x11-libs/gdk-pixbuf:2
+       x11-libs/gtk+:2
+       x11-libs/pango
+       lua? ( ${LUA_DEPS} )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       $(vala_depend)
+       dev-lang/perl
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-sdl.patch
+       "${FILESDIR}"/${P}-staticlib.patch
+       "${FILESDIR}"/${P}-fix_overflow.patch
+       "${FILESDIR}"/${P}-cmake4.patch
+)
+
+pkg_setup() {
+       use lua && lua-single_pkg_setup
+       vala_setup
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DLUA=$(usex lua)
+               -DMETASERVER2=ON
+               # libsdl2 and sdl2-mixer are required anyway
+               -DSOUND=ON
+               -DVALA_EXECUTABLE="${VALAC}"
+       )
+
+       cmake_src_configure
+}

diff --git 
a/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-cmake4.patch 
b/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-cmake4.patch
new file mode 100644
index 000000000000..76240d33d1ad
--- /dev/null
+++ 
b/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-cmake4.patch
@@ -0,0 +1,11 @@
+Bump for cmake4 compat, patch from upstream
+https://sourceforge.net/p/crossfire/crossfire-client/ci/672ad8a6f5f499b7ac36b1fb8938267c5ff57e3d/
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 3.1)
++cmake_minimum_required(VERSION 3.5)
+ project(crossfire-client C)
+ set(VERSION 1.75.3)
+ 

diff --git 
a/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-fix_overflow.patch
 
b/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-fix_overflow.patch
new file mode 100644
index 000000000000..08612fbcf5ed
--- /dev/null
+++ 
b/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-fix_overflow.patch
@@ -0,0 +1,32 @@
+Fix overflow, from upstream
+https://sourceforge.net/p/crossfire/crossfire-client/ci/4c98710209e39e379fccd6aa9db96978df21fe4b/
+
+> inlined from ‘cs_print_string’ at common/newsocket.c:260:15:
+> /usr/include/bits/stdio2.h:100:10:
+> warning: ‘__builtin___vsnprintf_chk’ specified bound 256 exceeds destination 
size 254 [-Wstringop-overflow=]
+
+--- a/common/newsocket.c
++++ b/common/newsocket.c
+@@ -20,6 +20,7 @@
+ 
+ #include "client.h"
+ 
++#include <assert.h>
+ #include <errno.h>
+ 
+ #include "script.h"
+@@ -257,12 +258,9 @@
+ 
+     SockList_Init(&sl, buf);
+     va_start(args, str);
+-    sl.len += vsnprintf((char*)sl.buf + sl.len, MAX_BUF-sl.len, str, args);
++    sl.len += vsnprintf((char*)sl.buf + sl.len, MAX_BUF-sl.len-3, str, args); 
// need 2 bytes for length, 1 for null termination
+     va_end(args);
+-    // Adjust sl.len to account for when we overflow the buffer.
+-    if (sl.len > MAX_BUF - 3) {
+-        sl.len = MAX_BUF - 3;
+-    }
++    assert(sl.len <= MAX_BUF - 3);
+ 
+     script_monitor_str((char*)sl.buf);
+ 

diff --git 
a/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-sdl.patch 
b/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-sdl.patch
new file mode 100644
index 000000000000..02dd4cbcd8f6
--- /dev/null
+++ b/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-sdl.patch
@@ -0,0 +1,26 @@
+Fix finding and including for SDL2
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e346c49..0461e8a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,6 +26,7 @@ set(CMAKE_INSTALL_DATADIR 
${CMAKE_INSTALL_DATAROOTDIR}/crossfire-client)
+ find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(GTK gtk+-2.0 gio-2.0 REQUIRED)
++pkg_check_modules(SDL sdl2 REQUIRED)
+ find_package(PNG REQUIRED)
+ find_package(Perl REQUIRED)
+ find_package(Vala REQUIRED)
+diff --git a/gtk-v2/src/CMakeLists.txt b/gtk-v2/src/CMakeLists.txt
+index f9d3b30..a8ae5f2 100644
+--- a/gtk-v2/src/CMakeLists.txt
++++ b/gtk-v2/src/CMakeLists.txt
+@@ -45,7 +45,7 @@ target_include_directories(crossfire-client-gtk2
+             ${GTK_INCLUDE_DIRS}
+             ${PNG_INCLUDE_DIRS}
+             ${SDLMIXER_INCLUDE_DIRS}
+-            ${SDL_INCLUDE_DIR}
++          ${SDL_INCLUDE_DIRS}
+ )
+ 
+ target_link_libraries(crossfire-client-gtk2 cfclient

diff --git 
a/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-staticlib.patch
 
b/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-staticlib.patch
new file mode 100644
index 000000000000..20ddbf7c0f46
--- /dev/null
+++ 
b/games-roguelike/crossfire-client/files/crossfire-client-1.75.3-staticlib.patch
@@ -0,0 +1,15 @@
+This library is not installed otherwise.
+Make it shared has no interest.
+diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
+index 1110890..081a245 100644
+--- a/common/CMakeLists.txt
++++ b/common/CMakeLists.txt
+@@ -13,7 +13,7 @@ add_custom_command(
+ #    DEPENDS item-types
+ #)
+ 
+-add_library(cfclient
++add_library(cfclient STATIC
+     client.c
+     client.h
+     commands.c

Reply via email to