commit:     1982708ff7a71cac8b0ccf8cd6314aa01683fe21
Author:     Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr>
AuthorDate: Sat Sep  6 05:00:58 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep  6 14:32:50 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1982708f

games-sports/xmoto: add 0.6.3

update HOMEPAGE (redirect)

release with SDL2 and cmake_min=3.12

update EAPI 7->8
update LUA_COMPAT w/ lua5-4
add pkgconfig

patches :
use pkg_check glu instead of find_package(OpenGL) which requires libglvnd[X]
upstream removed support for system ode to prevent incompatibility w/ >=ode0.16
because it's not in tree, restore system-ode w/ a version blocker,
otherwise use the bundled lib.
missing includes

add optfeature for the chinese font

Closes: https://bugs.gentoo.org/831879
Closes: https://bugs.gentoo.org/923904
Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/43688
Closes: https://github.com/gentoo/gentoo/pull/43688
Signed-off-by: Sam James <sam <AT> gentoo.org>

 games-sports/xmoto/Manifest                        |  1 +
 .../xmoto/files/xmoto-0.6.3-find_opengl.patch      | 13 ++++
 .../xmoto/files/xmoto-0.6.3-missing_includes.patch | 53 +++++++++++++
 .../xmoto/files/xmoto-0.6.3-system_ode.patch       | 54 +++++++++++++
 games-sports/xmoto/metadata.xml                    |  1 +
 games-sports/xmoto/xmoto-0.6.3.ebuild              | 89 ++++++++++++++++++++++
 6 files changed, 211 insertions(+)

diff --git a/games-sports/xmoto/Manifest b/games-sports/xmoto/Manifest
index f6cf3dd9ef23..9ced224477fa 100644
--- a/games-sports/xmoto/Manifest
+++ b/games-sports/xmoto/Manifest
@@ -1 +1,2 @@
 DIST xmoto-0.6.1.tar.gz 41623870 BLAKE2B 
a26b89266b05513f2a48a2516ffdd39f05d584e70aa1fb18d463c754acd438cef0b0f1664cc577ebb89012f86dc37e2d52cd9d1310217941f16c9a4085dc3894
 SHA512 
809e5f149e5679adc2f82313afe654dbd027c0c10292c90e6c1982bdd3f7d0f1305e30b974bba94a92e18aeeff5faa6f0d24be225d4755ae73ad03274adaf60b
+DIST xmoto-0.6.3.tar.gz 42113475 BLAKE2B 
b820c79c65113bab4d349e1251316b608f00ee16c60f587205b4181673783602e6bd7a5079482c5f5ffbf4d7ac1ca673e38f94f4a961610bccc0e4f887d0289b
 SHA512 
7c261058059cd4495fc79cd48fbf729f02bbc5678cbbb340baf2691d52cb8a5a30af89b788facb51991323f9630cff7416388d218f1713033dc4ea58e0727c3e

diff --git a/games-sports/xmoto/files/xmoto-0.6.3-find_opengl.patch 
b/games-sports/xmoto/files/xmoto-0.6.3-find_opengl.patch
new file mode 100644
index 000000000000..33c756231d57
--- /dev/null
+++ b/games-sports/xmoto/files/xmoto-0.6.3-find_opengl.patch
@@ -0,0 +1,13 @@
+avoid find_package(OpenGL) that requires GLX
+check glu because that's what xmoto uses
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -39,7 +39,7 @@ find_package(LibLZMA)
+ find_package(LibXml2 REQUIRED)
+ 
+ if(USE_OPENGL)
+-  find_package(OpenGL REQUIRED)
++  pkg_check_modules(OPENGL glu REQUIRED)
+ endif()
+ 
+ if(APPLE)

diff --git a/games-sports/xmoto/files/xmoto-0.6.3-missing_includes.patch 
b/games-sports/xmoto/files/xmoto-0.6.3-missing_includes.patch
new file mode 100644
index 000000000000..b1822e5896c7
--- /dev/null
+++ b/games-sports/xmoto/files/xmoto-0.6.3-missing_includes.patch
@@ -0,0 +1,53 @@
+merged in upstream
+https://bugs.gentoo.org/923904
+https://github.com/xmoto/xmoto/pull/213.patch
+From 6a54426ce112a585238c3feca0b7ab5a3ac0fe51 Mon Sep 17 00:00:00 2001
+From: nikekson <[email protected]>
+Date: Wed, 27 Aug 2025 13:56:30 +0300
+Subject: [PATCH] Add missing <cstdint> includes
+
+Fixes MSYS2 build
+---
+ src/common/DBuffer.cpp | 2 ++
+ src/common/VFileIO.cpp | 1 +
+ src/helpers/utf8.h     | 1 +
+ 3 files changed, 4 insertions(+)
+
+diff --git a/src/common/DBuffer.cpp b/src/common/DBuffer.cpp
+index a49d28dc..093726c5 100644
+--- a/src/common/DBuffer.cpp
++++ b/src/common/DBuffer.cpp
+@@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  
02111-1307  USA
+  */
+ #include "DBuffer.h"
+ #include "helpers/SwapEndian.h"
++
+ #include <algorithm>
++#include <cstdint>
+ 
+ void DBuffer::_FreeDBuffer(void) {
+   /* Free stuff if anything */
+diff --git a/src/common/VFileIO.cpp b/src/common/VFileIO.cpp
+index 42a4d367..75f8d03c 100644
+--- a/src/common/VFileIO.cpp
++++ b/src/common/VFileIO.cpp
+@@ -49,6 +49,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  
02111-1307  USA
+ #include "XMSession_default.h"
+ #include "xmoto/UserConfig.h"
+ 
++#include <cstdint>
+ #include <iostream>
+ 
+ #ifdef WIN32
+diff --git a/src/helpers/utf8.h b/src/helpers/utf8.h
+index 9a58dd93..6dddb49a 100644
+--- a/src/helpers/utf8.h
++++ b/src/helpers/utf8.h
+@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  
02111-1307  USA
+ #ifndef __XMOTO_UTF8_H__
+ #define __XMOTO_UTF8_H__
+ 
++#include <cstdint>
+ #include <string>
+ #include <vector>
+ 

diff --git a/games-sports/xmoto/files/xmoto-0.6.3-system_ode.patch 
b/games-sports/xmoto/files/xmoto-0.6.3-system_ode.patch
new file mode 100644
index 000000000000..084929b1cd90
--- /dev/null
+++ b/games-sports/xmoto/files/xmoto-0.6.3-system_ode.patch
@@ -0,0 +1,54 @@
+see 
https://github.com/xmoto/xmoto/commit/bd78a394174df2737da5e90153e6e7e198b0272a
+restore system-ode because versions in tree are <0.16
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -4,6 +4,7 @@ option(USE_SDLGFX "Build with SDL2 for g
+ option(USE_GETTEXT "Build with Gettext for internationalization" ON)
+ option(PREFER_SYSTEM_BZip2 "Prefer system BZip2" ON)
+ option(PREFER_SYSTEM_Lua "Prefer system Lua" ON)
++option(PREFER_SYSTEM_ODE "Prefer system ODE" ON)
+ option(PREFER_SYSTEM_XDG "Prefer system XDG" ON)
+ option(ALLOW_DEV "Enable some development/debug features" OFF)
+ option(BUILD_MACOS_BUNDLE "Build xmoto as a macOS Bundle" OFF)
+@@ -38,6 +39,8 @@ find_package(JPEG REQUIRED)
+ find_package(LibLZMA)
+ find_package(LibXml2 REQUIRED)
+ 
++find_package(ODE)
++set(USE_SYSTEM_ODE $<AND:$<BOOL:${PREFER_SYSTEM_ODE}>,$<BOOL:${ODE_FOUND}>>)
+ if(USE_OPENGL)
+   find_package(OpenGL REQUIRED)
+ endif()
+@@ -98,10 +101,12 @@ check_prototype_definition(mkdir
+   MS_MKDIR
+ )
+ 
+-add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/libccd" libccd)
++if(NOT PREFER_SYSTEM_ODE)
++  add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/libccd" libccd)
++  add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/ode" ode)
++endif()
+ add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/chipmunk" chipmunk)
+ add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/md5sum" md5sum)
+-add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/ode" ode)
+ add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/glad" glad)
+ 
+ configure_file(common/XMBuildConfig.h.in common/XMBuildConfig.h)
+@@ -510,7 +515,8 @@ target_link_libraries(xmoto PUBLIC
+   "$<${USE_SYSTEM_Lua}:${LUA_LIBRARIES}>"
+   $<$<NOT:${USE_SYSTEM_Lua}>:lua>
+   md5sum
+-  ode
++  $<${USE_SYSTEM_ODE}:${ODE_LIBRARY}>
++  $<$<NOT:${USE_SYSTEM_ODE}>:ode>
+   glad
+   ${CMAKE_DL_LIBS}
+   ${OPENGL_LIBRARIES}
+@@ -714,6 +720,7 @@ message("Jpeg       libraries: ${JPEG_LI
+ message("LibXml2    libraries: ${LIBXML2_LIBRARIES}")
+ message("LibLZMA    libraries: ${LIBLZMA_LIBRARIES}")
+ message("Lua        libraries: ${LUA_LIBRARIES}")
++message("Ode        libraries: ${ODE_LIBRARY}")
+ message("OpenGL     libraries: ${OPENGL_LIBRARIES}")
+ message("Png        libraries: ${PNG_LIBRARIES}")
+ message("SDL2       libraries: ${SDL2_LIBRARIES}")

diff --git a/games-sports/xmoto/metadata.xml b/games-sports/xmoto/metadata.xml
index bd68dad20a5d..3b626f96a6d4 100644
--- a/games-sports/xmoto/metadata.xml
+++ b/games-sports/xmoto/metadata.xml
@@ -7,6 +7,7 @@
   </maintainer>
   <use>
     <flag name="double-precision">more precise calculations at the expense of 
speed</flag>
+    <flag name="system-ode">Use system <pkg>dev-games/ode</pkg> instead of the 
bundled one</flag>
   </use>
   <upstream>
     <remote-id type="github">xmoto/xmoto</remote-id>

diff --git a/games-sports/xmoto/xmoto-0.6.3.ebuild 
b/games-sports/xmoto/xmoto-0.6.3.ebuild
new file mode 100644
index 000000000000..2d70150215a1
--- /dev/null
+++ b/games-sports/xmoto/xmoto-0.6.3.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{1..4} )
+
+inherit cmake lua-single optfeature
+
+DESCRIPTION="A challenging 2D motocross platform game, where physics play an 
important role"
+HOMEPAGE="https://xmoto.org";
+SRC_URI="https://github.com/xmoto/xmoto/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="double-precision +nls +system-ode"
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+
+RDEPEND="
+       ${LUA_DEPS}
+       app-arch/bzip2
+       dev-db/sqlite:3
+       dev-libs/libxdg-basedir
+       dev-libs/libxml2:=
+       media-fonts/dejavu
+       media-libs/glu
+       media-libs/libglvnd
+       media-libs/libjpeg-turbo:=
+       media-libs/libpng:0=
+       media-libs/libsdl2[joystick,opengl]
+       media-libs/sdl2-mixer[vorbis]
+       media-libs/sdl2-net
+       media-libs/sdl2-ttf
+       net-misc/curl
+       sys-libs/zlib:=
+       nls? ( virtual/libintl )
+       system-ode? ( <dev-games/ode-0.16[double-precision=] )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       app-arch/xz-utils
+       virtual/pkgconfig
+       nls? ( sys-devel/gettext )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.6.3-system_ode.patch
+       "${FILESDIR}"/${PN}-0.6.3-find_opengl.patch
+       "${FILESDIR}"/${PN}-0.6.3-missing_includes.patch
+)
+
+src_prepare() {
+       # fix fonts path
+       sed -e 
's:ASIAN_TTF_FILE=.*)$:ASIAN_TTF_FILE=\\\"'"${EPREFIX}"'/usr/share/fonts/arphicfonts/bkai00mp.ttf\\\"):'
 \
+               -i src/CMakeLists.txt || die
+       sed -e 
's:Textures/Fonts/DejaVu:'"${EPREFIX}"'/usr/share/fonts/dejavu/DejaVu:' \
+               -i src/drawlib/DrawLib.cpp || die
+
+       sed -e "/add_subdirectory.*\(bzip2\|lua\|xdgbasedir\)/d" -i 
src/CMakeLists.txt || die
+       rm -r vendor/{bzip2,lua,xdgbasedir} || die
+
+       if use system-ode; then
+               rm -r vendor/{ode,libccd} || die
+       fi
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DLUA_INCLUDE_DIR="$(lua_get_include_dir)"
+               -DPREFER_SYSTEM_ODE=$(usex system-ode)
+               -DUSE_GETTEXT=$(usex nls)
+       )
+
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+
+       # remove bundled fonts
+       rm -f "${ED}/usr/share/xmoto"/Textures/Fonts/DejaVuSans{Mono,}.ttf || 
die
+}
+
+pkg_postinst() {
+       optfeature "Chinese font support" media-fonts/arphicfonts
+}

Reply via email to