commit:     93e915dd5b6402818089203c77228ad300e3047e
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  1 00:12:15 2020 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Tue Dec  1 00:17:19 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=93e915dd

games-simulation/corsix-th: migrate to lua-single.eclass

LuaJIT is in principle supported upstream but requires one to override
cmake detection of the Lua library, and more importantly
dev-lua/luasocket doesn't support this implementation yet.

PUC Lua 5.4 is known not to be supported yet, see e.g.
http://lua-users.org/lists/lua-l/2020-07/msg00047.html

Closes: https://bugs.gentoo.org/752954
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 .../corsix-th/corsix-th-0.64-r100.ebuild           | 84 ++++++++++++++++++++++
 .../files/corsix-th-0.64-cmake_lua_detection.patch | 11 +++
 profiles/package.mask                              |  1 +
 3 files changed, 96 insertions(+)

diff --git a/games-simulation/corsix-th/corsix-th-0.64-r100.ebuild 
b/games-simulation/corsix-th/corsix-th-0.64-r100.ebuild
new file mode 100644
index 00000000000..0b163556250
--- /dev/null
+++ b/games-simulation/corsix-th/corsix-th-0.64-r100.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{1..3} )
+
+inherit cmake lua-single xdg
+
+MY_PN="CorsixTH"
+MY_PV="$(ver_rs 2 -)"
+
+DESCRIPTION="Open source clone of Theme Hospital"
+HOMEPAGE="https://corsixth.com";
+SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/v${MY_PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="doc +midi +sound +truetype +videos"
+
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+
+RDEPEND="${LUA_DEPS}
+       $(lua_gen_cond_dep '
+               >=dev-lua/luafilesystem-1.5[${LUA_USEDEP}]
+               >=dev-lua/lpeg-0.9[${LUA_USEDEP}]
+               >=dev-lua/luasocket-3.0_rc1-r4[${LUA_USEDEP}]
+       ')
+       media-libs/libsdl2[opengl,video]
+       sound? ( media-libs/sdl2-mixer[midi?] )
+       truetype? ( >=media-libs/freetype-2.5.3:2 )
+       videos? ( >=media-video/ffmpeg-2.2.3:0= )
+"
+
+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:0 conflicts
+# with the other slots of same, try to keep the deptree sane until we get
+# rid of unslotted Lua.
+BDEPEND="
+       virtual/pkgconfig
+       doc? (
+               app-doc/doxygen[dot]
+               ${LUA_DEPS}
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.64-cmake_lua_detection.patch
+)
+
+S="${WORKDIR}/${MY_PN}-${MY_PV}"
+
+src_prepare() {
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DLUA_VERSION=$(lua_get_version)
+               -DWITH_AUDIO=$(usex sound)
+               -DWITH_FREETYPE2=$(usex truetype)
+               -DWITH_MOVIES=$(usex videos)
+       )
+       cmake_src_configure
+}
+
+src_compile() {
+       cmake_src_compile
+       use doc && cmake_src_compile doc
+}
+
+src_install() {
+       cmake_src_install
+       dodoc {changelog,CONTRIBUTING}.txt
+
+       docinto html
+       use doc && dodoc -r "${BUILD_DIR}"/doc/*
+}

diff --git 
a/games-simulation/corsix-th/files/corsix-th-0.64-cmake_lua_detection.patch 
b/games-simulation/corsix-th/files/corsix-th-0.64-cmake_lua_detection.patch
new file mode 100644
index 00000000000..d57fa953ad0
--- /dev/null
+++ b/games-simulation/corsix-th/files/corsix-th-0.64-cmake_lua_detection.patch
@@ -0,0 +1,11 @@
+--- a/CorsixTH/CMakeLists.txt
++++ b/CorsixTH/CMakeLists.txt
+@@ -103,7 +103,7 @@
+ endif()
+ 
+ # Find Lua
+-find_package(Lua REQUIRED)
++find_package(Lua ${LUA_VERSION} EXACT REQUIRED)
+ if(Lua_FOUND)
+   target_link_libraries(CorsixTH ${LUA_LIBRARY})
+   include_directories(${LUA_INCLUDE_DIR})

diff --git a/profiles/package.mask b/profiles/package.mask
index 4335da53185..bbaafb49b59 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -569,6 +569,7 @@ dev-lua/luacrypto
 >=games-roguelike/stone-soup-0.25.1-r100
 >=games-rpg/kqlives-0.99-r100
 >=games-rpg/sumwars-0.5.8-r100
+>=games-simulation/corsix-th-0.64-r100
 >=mail-filter/imapfilter-2.6.16-r100
 >=media-gfx/geeqie-1.5.1-r1
 >=media-sound/aqualung-1.1-r100

Reply via email to