commit: bad79aaa7d06e885cdde80058f56ce58264b0d31 Author: Matt Jolly <kangie <AT> gentoo <DOT> org> AuthorDate: Mon Feb 23 11:00:17 2026 +0000 Commit: Matt Jolly <kangie <AT> gentoo <DOT> org> CommitDate: Mon Feb 23 12:10:38 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bad79aaa
games-strategy/ja2-stracciatella: add 0.22.1-r1 This adds compat with magic_enum 0.9.7 and bumps the dependency to that version due to the include path changing. Closes: https://bugs.gentoo.org/970483 Signed-off-by: Matt Jolly <kangie <AT> gentoo.org> .../ja2-stracciatella-0.22.1-magic_enum.patch | 154 +++++++++++ .../ja2-stracciatella-0.22.1-r1.ebuild | 293 +++++++++++++++++++++ 2 files changed, 447 insertions(+) diff --git a/games-strategy/ja2-stracciatella/files/ja2-stracciatella-0.22.1-magic_enum.patch b/games-strategy/ja2-stracciatella/files/ja2-stracciatella-0.22.1-magic_enum.patch new file mode 100644 index 000000000000..2cd82a048b33 --- /dev/null +++ b/games-strategy/ja2-stracciatella/files/ja2-stracciatella-0.22.1-magic_enum.patch @@ -0,0 +1,154 @@ +https://github.com/ja2-stracciatella/ja2-stracciatella/pull/2357 +From: Matt Jolly <[email protected]> +Date: Mon, 23 Feb 2026 10:24:01 +1000 +Subject: [PATCH] magic_enum: 0.9.7 changes + +Upstream, in 2024, magic_enum changed the include path. + +<= 0.9.6: /usr/include/magic_enum.hpp +>= 0.9.7: /usr/include/magic_enum/magic_enum.hpp + +This means that any downstreams that want to use a recent magic_enum +without using a vendored copy will be unable to build the software. + +It would be trivial to work around that downstream using +`MAGICENUM_INCLUDE_DIR`, however looking at the package we can do +better; this commit: + +- bumps the vendored magic_enum to 0.9.7 +- uses sha256 instead of md5 to validate the download +- replaces hand-rolled header detection logic with `find_package` +- adds a fallback for meson builds which only include pkg-config +- drops `MAGICENUM_INCLUDE_DIR` +- updates `#include` directives for consistency. + +Bug: https://bugs.gentoo.org/970483 +Signed-off-by: Matt Jolly <[email protected]> + +wip: ci-fix? +Signed-off-by: Matt Jolly <[email protected]> +--- a/dependencies/lib-magic_enum/CMakeLists.txt ++++ b/dependencies/lib-magic_enum/CMakeLists.txt +@@ -8,42 +8,50 @@ if(NOT WITH_MAGICENUM) + return() + endif() + +-function(verify_header test_dir) +- include(CheckIncludeFileCXX) +- set(CMAKE_REQUIRED_INCLUDES "${test_dir}") +- unset(MAGICENUM_FOUND CACHE) +- CHECK_INCLUDE_FILE_CXX("magic_enum.hpp" MAGICENUM_FOUND) +- if (NOT MAGICENUM_FOUND) +- message(FATAL_ERROR "magic_enum.hpp not found") +- endif() +- target_include_directories(${JA2_BINARY} SYSTEM PRIVATE "${test_dir}") +-endfunction() +- + if (NOT LOCAL_MAGICENUM_LIB) + message(STATUS "Using system magic_enum") + +- if (NOT DEFINED MAGICENUM_INCLUDE_DIR) +- message(FATAL_ERROR "MAGICENUM_INCLUDE_DIR var not set") ++ # Try CMake config first (standard install via CMake) ++ find_package(magic_enum 0.9.7 CONFIG QUIET) ++ ++ if(NOT magic_enum_FOUND) ++ # Fallback to pkg-config (e.g., Meson installs) ++ find_package(PkgConfig REQUIRED) ++ pkg_check_modules(magic_enum REQUIRED IMPORTED_TARGET magic_enum>=0.9.7) ++ target_link_libraries(${JA2_BINARY} PRIVATE PkgConfig::magic_enum) ++ return() + endif() + +- verify_header("${MAGICENUM_INCLUDE_DIR}") ++ target_link_libraries(${JA2_BINARY} PRIVATE magic_enum::magic_enum) + return() + endif() + + message(STATUS "<magic_enum>") + + # create getter +-set(SRC_DIR "${CMAKE_BINARY_DIR}/lib-magic_enum/src") ++set(GETTER_DIR "${CMAKE_BINARY_DIR}/dependencies/lib-magic_enum/getter") ++set(SRC_DIR "${GETTER_DIR}/get-magic_enum-prefix/src/get-magic_enum") + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/getter/CMakeLists.txt.in" +- "${CMAKE_CURRENT_BINARY_DIR}/getter/CMakeLists.txt" ++ "${GETTER_DIR}/CMakeLists.txt" + @ONLY + ) + + # execute getter +-execute_process(COMMAND ${CMAKE_COMMAND} . "-G${CMAKE_GENERATOR}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/getter") +-execute_process(COMMAND ${CMAKE_COMMAND} --build "${CMAKE_CURRENT_BINARY_DIR}/getter") ++execute_process(COMMAND ${CMAKE_COMMAND} . "-G${CMAKE_GENERATOR}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}" WORKING_DIRECTORY "${GETTER_DIR}" RESULT_VARIABLE result) ++if(NOT result EQUAL 0) ++ message(FATAL_ERROR "Failed to configure magic_enum getter: ${result}") ++endif() ++ ++execute_process(COMMAND ${CMAKE_COMMAND} --build "${GETTER_DIR}" RESULT_VARIABLE result) ++if(NOT result EQUAL 0) ++ message(FATAL_ERROR "Failed to build magic_enum getter: ${result}") ++endif() ++ ++if(NOT EXISTS "${SRC_DIR}/include/magic_enum/magic_enum.hpp") ++ message(FATAL_ERROR "magic_enum headers not found at ${SRC_DIR}/include/magic_enum/magic_enum.hpp after extraction") ++endif() + +-verify_header("${SRC_DIR}/include") ++target_include_directories(${JA2_BINARY} SYSTEM PRIVATE "${SRC_DIR}/include") + + message(STATUS "</magic_enum>") +--- a/dependencies/lib-magic_enum/getter/CMakeLists.txt.in ++++ b/dependencies/lib-magic_enum/getter/CMakeLists.txt.in +@@ -6,20 +6,16 @@ + # * SRC_DIR - where to extract the archive + # * BUILD_DIR - where the integrated sources are built + +-cmake_minimum_required(VERSION 3.18...3.25) ++cmake_minimum_required(VERSION 3.18...3.31) + + project(getter NONE) + + include(ExternalProject) + externalproject_add(get-magic_enum +- URL "https://github.com/Neargye/magic_enum/archive/v0.8.2.zip" +- URL_MD5 "3e684af4d7073c2d86f6ecf2f78b4120" +- CMAKE_ARGS +- "-G@CMAKE_GENERATOR@" +- SOURCE_DIR "@SRC_DIR@" +- BINARY_DIR "@BUILD_DIR@" +- CONFIGURE_COMMAND "" +- BUILD_COMMAND "" +- INSTALL_COMMAND "" +- TEST_COMMAND "" ++ URL "https://github.com/Neargye/magic_enum/archive/v0.9.7.zip" ++ URL_HASH SHA256=e293afdaf4d5918bc145903bccff06d28b3ed437f1ac8414ace9e8a769a9e470 ++ CONFIGURE_COMMAND "" ++ BUILD_COMMAND "" ++ INSTALL_COMMAND "" ++ TEST_COMMAND "" + ) +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -25,7 +25,6 @@ target_include_directories(${JA2_BINARY} SYSTEM PRIVATE + ${SOL_INCLUDE_DIR} + ${LUA_INCLUDE_DIRS} + ${MINIAUDIO_INCLUDE_DIRS} +- ${MAGICENUM_INCLUDE_DIR} + ) + + add_subdirectory(launcher) +--- a/src/externalized/scripting/EnumCodeGen.h ++++ b/src/externalized/scripting/EnumCodeGen.h +@@ -1,7 +1,7 @@ + #pragma once + + #ifndef NO_MAGICENUM_LIB +-#include <magic_enum.hpp> ++#include <magic_enum/magic_enum.hpp> + #ifdef MAGIC_ENUM_SUPPORTED + #ifdef MAGIC_ENUM_SUPPORTED_ALIASES + #define HAS_ENUMGEN_SUPPORT (1) +-- +2.52.0 diff --git a/games-strategy/ja2-stracciatella/ja2-stracciatella-0.22.1-r1.ebuild b/games-strategy/ja2-stracciatella/ja2-stracciatella-0.22.1-r1.ebuild new file mode 100644 index 000000000000..de15a5ab2a38 --- /dev/null +++ b/games-strategy/ja2-stracciatella/ja2-stracciatella-0.22.1-r1.ebuild @@ -0,0 +1,293 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +CRATES=" + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected]+23.1.7779620 + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected]+wasi-snapshot-preview1 + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] + [email protected] +" + +# There's something screwy that means this doesn't build with nightly +# but 1.94.0 beta seems fine; I'm assuming this is a bad version check +# in a dependent crate. +RUST_MIN_VER=1.85.1 + +# See dependencies/lib-lua/CMakeLists.txt +LUA_COMPAT=( lua5-3 ) + +inherit cargo cmake lua-single xdg + +DESCRIPTION="An improved, cross-platform, stable Jagged Alliance 2 runtime" +HOMEPAGE="https://ja2-stracciatella.github.io/" +SRC_URI=" + https://github.com/ja2-stracciatella/ja2-stracciatella/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz + editor? ( + https://github.com/ja2-stracciatella/free-ja2-resources/releases/download/v1/editor.slf -> ${PN}-editor.slf + ) + ${CARGO_CRATE_URIS} +" + +LICENSE="public-domain SFI-SCLA" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86" +IUSE="cdinstall editor +launcher ru-gold test" +# ./ja2 -unittest can't find save files +RESTRICT="!test? ( test ) test" +REQUIRED_USE="${LUA_REQUIRED_USE}" + +DEPEND=" + ${LUA_DEPS} + >=dev-cpp/magic_enum-0.9.7 + >=dev-cpp/sol2-3.3.0 + >=dev-cpp/string-theory-3.1 + >=dev-games/libsmacker-1.2.0_p43-r1 + >=dev-libs/miniaudio-0.11.11 + media-libs/libsdl2[X,sound,video] + launcher? ( x11-libs/fltk:1= ) +" +RDEPEND=" + ${DEPEND} + cdinstall? ( games-strategy/ja2-stracciatella-data ) +" + +pkg_setup() { + lua-single_pkg_setup + rust_pkg_setup +} + +src_prepare() { + PATCHES=( + "${FILESDIR}"/${P}-system-smacker.patch + "${FILESDIR}"/${P}-magic_enum.patch + "${FILESDIR}"/${PN}-0.20.0-lua-cmake.patch + ) + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DLUA_VERSION="${ELUA#lua}" + -DUSE_SCCACHE=OFF + + # Local means vendored, not system. + -DLOCAL_FLTK_LIB=OFF + -DLOCAL_GTEST_LIB=OFF + -DLOCAL_LUA_LIB=OFF + -DLOCAL_MAGICENUM_LIB=OFF + -DLOCAL_MINIAUDIO_LIB=OFF + -DLOCAL_SDL_LIB=OFF + -DLOCAL_SMACKER_LIB=OFF + -DLOCAL_SOL_LIB=OFF + -DLOCAL_STRING_THEORY_LIB=OFF + + -DWITH_MAGICENUM=ON + -DWITH_RUST_BINARIES=OFF + -DWITH_UNITTESTS=$(usex test) + + -DBUILD_LAUNCHER=$(usex launcher) + + -DINSTALL_LIB_DIR="${EPREFIX}/usr/$(get_libdir)" + -DEXTRA_DATA_DIR="${EPREFIX}/usr/share/ja2" + -DMINIAUDIO_INCLUDE_DIR="${EPREFIX}/usr/include/miniaudio" + ) + + cargo_gen_config + cmake_src_configure +} + +src_install() { + if use editor; then + insinto /usr/share/ja2 + doins "${DISTDIR}/${PN}-editor.slf" + dosym "${PN}-editor.slf" "/usr/share/ja2/editor.slf" + fi + + cmake_src_install +} + +src_test() { + "${BUILD_DIR}"/ja2 -unittests || die +} + +pkg_postinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] && use !cdinstall; then + elog "You need to copy all files from the Data directory of" + elog "Jagged Alliance 2 installation to" + elog "e.g. /opt/ja2/data and set game_dir in .ja2/ja2.json" + elog "accordingly." + elog "Make sure the filenames are lowercase." + fi + + xdg_pkg_postinst +}
