commit:     d3560710d8e3b50c746a1a87ae057882dd77da6d
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 16 22:44:44 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Mon Oct 16 22:44:44 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d3560710

games-simulation/corsix-th: Fix USE=doc with better Lua handling

We need to restrict to the requested Lua version and ensure the necessary
modules are installed for that version.

Closes: https://bugs.gentoo.org/915515
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 games-simulation/corsix-th/corsix-th-0.67.ebuild   | 16 +++++++--------
 .../files/corsix-th-0.66-cmake_lua_detection.patch | 13 ------------
 .../files/corsix-th-0.67-cmake_lua_detection.patch | 24 ++++++++++++++++++++++
 3 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/games-simulation/corsix-th/corsix-th-0.67.ebuild 
b/games-simulation/corsix-th/corsix-th-0.67.ebuild
index fb20bf9d939b..abeaae5f4a0c 100644
--- a/games-simulation/corsix-th/corsix-th-0.67.ebuild
+++ b/games-simulation/corsix-th/corsix-th-0.67.ebuild
@@ -39,23 +39,23 @@ RDEPEND="${LUA_DEPS}
 
 DEPEND="${RDEPEND}"
 
-# Technically, build-time generation of documentation could use any version
-# of Lua (or to be precise: if in src_configure cmake has been told to use
-# LuaJIT documentation generation looks for LuaJIT, otherwise any
-# dev-lang/lua slot will do; see the first few lines of the bundled file
-# CMake/GenerateDoc.cmake for details) - but since dev-lang/lua conflicts
-# with the other slots of same, try to keep the deptree sane until we get
-# rid of unslotted Lua.
+# Although the docs could potentially be built with nearly any Lua version,
+# we need to ensure the necessary Lua modules are installed, so pin to the
+# same single version as runtime.
 BDEPEND="
        virtual/pkgconfig
        doc? (
                app-doc/doxygen[dot]
                ${LUA_DEPS}
+               $(lua_gen_cond_dep '
+                       >=dev-lua/luafilesystem-1.5[${LUA_USEDEP}]
+                       >=dev-lua/lpeg-0.9[${LUA_USEDEP}]
+               ')
        )
 "
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-0.66-cmake_lua_detection.patch
+       "${FILESDIR}"/${PN}-0.67-cmake_lua_detection.patch
 )
 
 src_configure() {

diff --git 
a/games-simulation/corsix-th/files/corsix-th-0.66-cmake_lua_detection.patch 
b/games-simulation/corsix-th/files/corsix-th-0.66-cmake_lua_detection.patch
deleted file mode 100644
index f85d1bfb0b89..000000000000
--- a/games-simulation/corsix-th/files/corsix-th-0.66-cmake_lua_detection.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/CorsixTH/CMakeLists.txt b/CorsixTH/CMakeLists.txt
-index 1544810..05ed3b0 100644
---- a/CorsixTH/CMakeLists.txt
-+++ b/CorsixTH/CMakeLists.txt
-@@ -133,7 +133,7 @@ if(MSVC AND USE_VCPKG_DEPS)
-   target_link_libraries(CorsixTH_lib lua)
-   target_link_libraries(CorsixTH lua)
- else()
--  find_package(Lua REQUIRED)
-+  find_package(Lua ${LUA_VERSION} EXACT REQUIRED)
-   if(Lua_FOUND OR LUA_FOUND)
-     target_link_libraries(CorsixTH ${LUA_LIBRARY})
-     include_directories(${LUA_INCLUDE_DIR})

diff --git 
a/games-simulation/corsix-th/files/corsix-th-0.67-cmake_lua_detection.patch 
b/games-simulation/corsix-th/files/corsix-th-0.67-cmake_lua_detection.patch
new file mode 100644
index 000000000000..b5a62a81a615
--- /dev/null
+++ b/games-simulation/corsix-th/files/corsix-th-0.67-cmake_lua_detection.patch
@@ -0,0 +1,24 @@
+diff -Naur a/CMake/GenerateDoc.cmake b/CMake/GenerateDoc.cmake
+--- a/CMake/GenerateDoc.cmake  2023-08-06 04:02:29.000000000 +0100
++++ b/CMake/GenerateDoc.cmake  2023-10-16 23:26:11.527720737 +0100
+@@ -5,7 +5,7 @@
+   set(LUA_PROGRAM_NAMES lua53 lua5.3 lua-5.3 lua52 lua5.2 lua-5.2 lua51 
lua5.1 lua-5.1 lua)
+ endif()
+ 
+-find_program(LUA_PROGRAM_PATH ${LUA_PROGRAM_NAMES}
++find_program(LUA_PROGRAM_PATH lua${LUA_VERSION}
+   PATHS
+     ENV LUA_DIR
+     /opt
+diff -Naur a/CorsixTH/CMakeLists.txt b/CorsixTH/CMakeLists.txt
+--- a/CorsixTH/CMakeLists.txt  2023-08-06 04:02:29.000000000 +0100
++++ b/CorsixTH/CMakeLists.txt  2023-10-16 23:23:20.119763454 +0100
+@@ -132,7 +132,7 @@
+   target_link_libraries(CorsixTH_lib lua)
+   target_link_libraries(CorsixTH lua)
+ else()
+-  find_package(Lua REQUIRED)
++  find_package(Lua ${LUA_VERSION} EXACT REQUIRED)
+   if(Lua_FOUND OR LUA_FOUND)
+     target_link_libraries(CorsixTH ${LUA_LIBRARY})
+     include_directories(${LUA_INCLUDE_DIR})

Reply via email to