games-strategy/megaglest: migrate to EAPI-7 and lua-single.eclass

Lua migration: simple enough, needed the usual version-override patch.
Upstream build scripts only use Lua up to and including 5.2, have
confirmed that building against 5.3 fails.

EAPI migration: don't talk to me about the old version of this ebuild.
EVER.

Closes: https://bugs.gentoo.org/752717
Signed-off-by: Marek Szuba <marecki@gentoo.org>
This commit is contained in:
Marek Szuba
2020-12-23 14:49:17 +00:00
parent 963327d7be
commit 00faca18e3
3 changed files with 192 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
Use the standard FindLua.cmake instead of the modified bundled FindLUA.cmake,
and force the use of an exact Lua version.
--- a/source/glest_game/CMakeLists.txt
+++ b/source/glest_game/CMakeLists.txt
@@ -64,7 +64,7 @@
ENDIF()
ENDIF()
- FIND_PACKAGE(LUA REQUIRED)
+ FIND_PACKAGE(Lua ${FORCE_LUA_VERSION} EXACT REQUIRED)
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
IF(UNIX)
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${LUA_LIBRARIES})
--- a/source/shared_lib/CMakeLists.txt
+++ b/source/shared_lib/CMakeLists.txt
@@ -132,7 +132,7 @@
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${OPENAL_LIBRARY})
ENDIF()
- FIND_PACKAGE(LUA REQUIRED)
+ FIND_PACKAGE(Lua ${FORCE_LUA_VERSION} EXACT REQUIRED)
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
IF(UNIX)
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${LUA_LIBRARIES} ${CMAKE_DL_LIBS})

View File

@@ -0,0 +1,166 @@
# Copyright 2010-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# google-breakpad
# TODO: fribidi, libvorbis static
EAPI=7
# src_install() currently requires this
CMAKE_MAKEFILE_GENERATOR="emake"
LUA_COMPAT=( lua5-{1..2} )
# Only needed by certain features
VIRTUALX_REQUIRED="manual"
inherit cmake desktop flag-o-matic lua-single virtualx wxwidgets xdg-utils
DESCRIPTION="Cross-platform 3D realtime strategy game"
HOMEPAGE="https://megaglest.org/ https://github.com/MegaGlest/megaglest-source"
SRC_URI="https://github.com/MegaGlest/megaglest-source/releases/download/${PV}/megaglest-source-${PV}.tar.xz"
LICENSE="GPL-3 BitstreamVera"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug +editor fribidi cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 static +streflop +tools +unicode wxuniversal +model-viewer videos"
REQUIRED_USE="${LUA_REQUIRED_USE}"
# Older versions of megaglest-data install into /usr/games
RDEPEND="${LUA_DEPS}
~games-strategy/${PN}-data-${PV}
>=games-strategy/${PN}-data-3.11.1-r1
dev-libs/libxml2
media-libs/fontconfig
media-libs/freetype
media-libs/libsdl[X,sound,joystick,opengl,video]
media-libs/libvorbis
media-libs/openal
net-libs/gnutls
sys-libs/zlib
virtual/opengl
virtual/glu
x11-libs/libX11
x11-libs/libXext
editor? ( x11-libs/wxGTK:3.0[X,opengl] )
fribidi? ( dev-libs/fribidi )
model-viewer? ( x11-libs/wxGTK:3.0[X] )
!static? (
dev-libs/xerces-c[icu]
media-libs/ftgl
media-libs/glew
media-libs/libpng:0
net-libs/libircclient
>=net-libs/miniupnpc-1.8
net-misc/curl
virtual/jpeg:0
)
videos? ( media-video/vlc )"
DEPEND="${RDEPEND}
static? (
dev-libs/icu[static-libs]
dev-libs/xerces-c[icu,static-libs]
media-libs/ftgl[static-libs]
media-libs/glew[static-libs]
media-libs/libpng:0[static-libs]
net-libs/libircclient[static-libs]
net-libs/miniupnpc[static-libs]
net-misc/curl[static-libs]
virtual/jpeg:0[static-libs]
)"
BDEPEND="sys-apps/help2man
virtual/pkgconfig
editor? ( ${VIRTUALX_DEPEND} )
model-viewer? ( ${VIRTUALX_DEPEND} )"
PATCHES=(
"${FILESDIR}"/${P}-static-build.patch
"${FILESDIR}"/${P}-cmake.patch
"${FILESDIR}"/${P}-cmake-lua.patch
"${FILESDIR}"/${P}-miniupnpc.patch
"${FILESDIR}"/${P}-miniupnpc-api-version-16.patch
)
src_prepare() {
cmake_src_prepare
if use editor || use model-viewer ; then
WX_GTK_VER="3.0"
setup-wxwidgets
fi
}
src_configure() {
if use cpu_flags_x86_sse3; then
SSE=3
elif use cpu_flags_x86_sse2; then
SSE=2
elif use cpu_flags_x86_sse; then
SSE=1
else
SSE=0
fi
local mycmakeargs=(
-DBUILD_MEGAGLEST_MAP_EDITOR=$(usex editor)
-DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=$(usex tools)
-DBUILD_MEGAGLEST_MODEL_VIEWER=$(usex model-viewer)
-DENABLE_FRIBIDI=$(usex fribidi)
-DFORCE_LUA_VERSION="$(lua_get_version)"
-DMAX_SSE_LEVEL_DESIRED="${SSE}"
-DUSE_FTGL=ON
-DWANT_STATIC_LIBS=$(usex static)
-DWANT_STREFLOP=$(usex streflop)
-DWITH_VLC=$(usex videos)
-DwxWidgets_USE_STATIC=$(usex static)
-DwxWidgets_USE_UNICODE=$(usex unicode)
-DwxWidgets_USE_UNIVERSAL=$(usex wxuniversal)
$(usex debug "-DBUILD_MEGAGLEST_UPNP_DEBUG=ON -DwxWidgets_USE_DEBUG=ON" "")
)
cmake_src_configure
}
src_compile() {
if use editor || use model-viewer; then
# work around parallel make issues - bug #561380
MAKEOPTS="-j1 ${MAKEOPTS}" \
virtx cmake_src_compile
else
cmake_src_compile
fi
}
src_install() {
# rebuilds some targets randomly without fast option
emake -C "${BUILD_DIR}" DESTDIR="${D}" "$@" install/fast
dodoc docs/{AUTHORS.source_code,CHANGELOG,README}.txt
doicon -s 48 ${PN}.png
use editor &&
make_desktop_entry ${PN}_editor "MegaGlest Map Editor"
use model-viewer &&
make_desktop_entry ${PN}_g3dviewer "MegaGlest Model Viewer"
}
pkg_postinst() {
einfo
elog 'Note about Configuration:'
elog 'DO NOT directly edit glest.ini and glestkeys.ini but rather glestuser.ini'
elog 'and glestuserkeys.ini in ~/.megaglest/ and create your user over-ride'
elog 'values in these files.'
elog
elog 'If you have an older graphics card which only supports OpenGL 1.2, and the'
elog 'game crashes when you try to play, try starting with "megaglest --disable-vbo"'
elog 'Some graphics cards may require setting Max Lights to 1.'
einfo
xdg_icon_cache_update
}
pkg_postrm() {
xdg_icon_cache_update
}

View File

@@ -487,6 +487,7 @@ kde-apps/kdebase-meta:5
>=games-simulation/corsix-th-0.64-r100
>=games-sports/xmoto-0.6.1-r100
>=games-strategy/hedgewars-1.0.0-r100
>=games-strategy/megaglest-3.11.1-r100
>=games-strategy/naev-0.7.0-r100
>=games-strategy/openra-20190314-r100
>=games-strategy/s25rttr-0.9.0_pre20200723-r100