Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-strategy/megaglest/files/, profiles/, games-strategy/megaglest/
Date: Wed, 23 Dec 2020 14:52:24
Message-Id: 1608735129.00faca18e3b5d8a30bc3550195038f8a6b681b10.marecki@gentoo
1 commit: 00faca18e3b5d8a30bc3550195038f8a6b681b10
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 23 14:49:17 2020 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 23 14:52:09 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00faca18
7
8 games-strategy/megaglest: migrate to EAPI-7 and lua-single.eclass
9
10 Lua migration: simple enough, needed the usual version-override patch.
11 Upstream build scripts only use Lua up to and including 5.2, have
12 confirmed that building against 5.3 fails.
13
14 EAPI migration: don't talk to me about the old version of this ebuild.
15 EVER.
16
17 Closes: https://bugs.gentoo.org/752717
18 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
19
20 .../files/megaglest-3.11.1-cmake-lua.patch | 25 ++++
21 .../megaglest/megaglest-3.11.1-r100.ebuild | 166 +++++++++++++++++++++
22 profiles/package.mask | 1 +
23 3 files changed, 192 insertions(+)
24
25 diff --git a/games-strategy/megaglest/files/megaglest-3.11.1-cmake-lua.patch b/games-strategy/megaglest/files/megaglest-3.11.1-cmake-lua.patch
26 new file mode 100644
27 index 00000000000..c8d30e3d096
28 --- /dev/null
29 +++ b/games-strategy/megaglest/files/megaglest-3.11.1-cmake-lua.patch
30 @@ -0,0 +1,25 @@
31 +Use the standard FindLua.cmake instead of the modified bundled FindLUA.cmake,
32 +and force the use of an exact Lua version.
33 +
34 +--- a/source/glest_game/CMakeLists.txt
35 ++++ b/source/glest_game/CMakeLists.txt
36 +@@ -64,7 +64,7 @@
37 + ENDIF()
38 + ENDIF()
39 +
40 +- FIND_PACKAGE(LUA REQUIRED)
41 ++ FIND_PACKAGE(Lua ${FORCE_LUA_VERSION} EXACT REQUIRED)
42 + INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
43 + IF(UNIX)
44 + SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${LUA_LIBRARIES})
45 +--- a/source/shared_lib/CMakeLists.txt
46 ++++ b/source/shared_lib/CMakeLists.txt
47 +@@ -132,7 +132,7 @@
48 + SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${OPENAL_LIBRARY})
49 + ENDIF()
50 +
51 +- FIND_PACKAGE(LUA REQUIRED)
52 ++ FIND_PACKAGE(Lua ${FORCE_LUA_VERSION} EXACT REQUIRED)
53 + INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
54 + IF(UNIX)
55 + SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${LUA_LIBRARIES} ${CMAKE_DL_LIBS})
56
57 diff --git a/games-strategy/megaglest/megaglest-3.11.1-r100.ebuild b/games-strategy/megaglest/megaglest-3.11.1-r100.ebuild
58 new file mode 100644
59 index 00000000000..796b7822f5e
60 --- /dev/null
61 +++ b/games-strategy/megaglest/megaglest-3.11.1-r100.ebuild
62 @@ -0,0 +1,166 @@
63 +# Copyright 2010-2020 Gentoo Authors
64 +# Distributed under the terms of the GNU General Public License v2
65 +
66 +# google-breakpad
67 +# TODO: fribidi, libvorbis static
68 +
69 +EAPI=7
70 +
71 +# src_install() currently requires this
72 +CMAKE_MAKEFILE_GENERATOR="emake"
73 +
74 +LUA_COMPAT=( lua5-{1..2} )
75 +
76 +# Only needed by certain features
77 +VIRTUALX_REQUIRED="manual"
78 +
79 +inherit cmake desktop flag-o-matic lua-single virtualx wxwidgets xdg-utils
80 +
81 +DESCRIPTION="Cross-platform 3D realtime strategy game"
82 +HOMEPAGE="https://megaglest.org/ https://github.com/MegaGlest/megaglest-source"
83 +SRC_URI="https://github.com/MegaGlest/megaglest-source/releases/download/${PV}/megaglest-source-${PV}.tar.xz"
84 +
85 +LICENSE="GPL-3 BitstreamVera"
86 +SLOT="0"
87 +KEYWORDS="~amd64 ~x86"
88 +IUSE="debug +editor fribidi cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 static +streflop +tools +unicode wxuniversal +model-viewer videos"
89 +
90 +REQUIRED_USE="${LUA_REQUIRED_USE}"
91 +
92 +# Older versions of megaglest-data install into /usr/games
93 +RDEPEND="${LUA_DEPS}
94 + ~games-strategy/${PN}-data-${PV}
95 + >=games-strategy/${PN}-data-3.11.1-r1
96 + dev-libs/libxml2
97 + media-libs/fontconfig
98 + media-libs/freetype
99 + media-libs/libsdl[X,sound,joystick,opengl,video]
100 + media-libs/libvorbis
101 + media-libs/openal
102 + net-libs/gnutls
103 + sys-libs/zlib
104 + virtual/opengl
105 + virtual/glu
106 + x11-libs/libX11
107 + x11-libs/libXext
108 + editor? ( x11-libs/wxGTK:3.0[X,opengl] )
109 + fribidi? ( dev-libs/fribidi )
110 + model-viewer? ( x11-libs/wxGTK:3.0[X] )
111 + !static? (
112 + dev-libs/xerces-c[icu]
113 + media-libs/ftgl
114 + media-libs/glew
115 + media-libs/libpng:0
116 + net-libs/libircclient
117 + >=net-libs/miniupnpc-1.8
118 + net-misc/curl
119 + virtual/jpeg:0
120 + )
121 + videos? ( media-video/vlc )"
122 +DEPEND="${RDEPEND}
123 + static? (
124 + dev-libs/icu[static-libs]
125 + dev-libs/xerces-c[icu,static-libs]
126 + media-libs/ftgl[static-libs]
127 + media-libs/glew[static-libs]
128 + media-libs/libpng:0[static-libs]
129 + net-libs/libircclient[static-libs]
130 + net-libs/miniupnpc[static-libs]
131 + net-misc/curl[static-libs]
132 + virtual/jpeg:0[static-libs]
133 + )"
134 +BDEPEND="sys-apps/help2man
135 + virtual/pkgconfig
136 + editor? ( ${VIRTUALX_DEPEND} )
137 + model-viewer? ( ${VIRTUALX_DEPEND} )"
138 +
139 +PATCHES=(
140 + "${FILESDIR}"/${P}-static-build.patch
141 + "${FILESDIR}"/${P}-cmake.patch
142 + "${FILESDIR}"/${P}-cmake-lua.patch
143 + "${FILESDIR}"/${P}-miniupnpc.patch
144 + "${FILESDIR}"/${P}-miniupnpc-api-version-16.patch
145 +)
146 +
147 +src_prepare() {
148 + cmake_src_prepare
149 +
150 + if use editor || use model-viewer ; then
151 + WX_GTK_VER="3.0"
152 + setup-wxwidgets
153 + fi
154 +}
155 +
156 +src_configure() {
157 + if use cpu_flags_x86_sse3; then
158 + SSE=3
159 + elif use cpu_flags_x86_sse2; then
160 + SSE=2
161 + elif use cpu_flags_x86_sse; then
162 + SSE=1
163 + else
164 + SSE=0
165 + fi
166 +
167 + local mycmakeargs=(
168 + -DBUILD_MEGAGLEST_MAP_EDITOR=$(usex editor)
169 + -DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=$(usex tools)
170 + -DBUILD_MEGAGLEST_MODEL_VIEWER=$(usex model-viewer)
171 + -DENABLE_FRIBIDI=$(usex fribidi)
172 + -DFORCE_LUA_VERSION="$(lua_get_version)"
173 + -DMAX_SSE_LEVEL_DESIRED="${SSE}"
174 + -DUSE_FTGL=ON
175 + -DWANT_STATIC_LIBS=$(usex static)
176 + -DWANT_STREFLOP=$(usex streflop)
177 + -DWITH_VLC=$(usex videos)
178 + -DwxWidgets_USE_STATIC=$(usex static)
179 + -DwxWidgets_USE_UNICODE=$(usex unicode)
180 + -DwxWidgets_USE_UNIVERSAL=$(usex wxuniversal)
181 +
182 + $(usex debug "-DBUILD_MEGAGLEST_UPNP_DEBUG=ON -DwxWidgets_USE_DEBUG=ON" "")
183 + )
184 +
185 + cmake_src_configure
186 +}
187 +
188 +src_compile() {
189 + if use editor || use model-viewer; then
190 + # work around parallel make issues - bug #561380
191 + MAKEOPTS="-j1 ${MAKEOPTS}" \
192 + virtx cmake_src_compile
193 + else
194 + cmake_src_compile
195 + fi
196 +}
197 +
198 +src_install() {
199 + # rebuilds some targets randomly without fast option
200 + emake -C "${BUILD_DIR}" DESTDIR="${D}" "$@" install/fast
201 +
202 + dodoc docs/{AUTHORS.source_code,CHANGELOG,README}.txt
203 + doicon -s 48 ${PN}.png
204 +
205 + use editor &&
206 + make_desktop_entry ${PN}_editor "MegaGlest Map Editor"
207 + use model-viewer &&
208 + make_desktop_entry ${PN}_g3dviewer "MegaGlest Model Viewer"
209 +}
210 +
211 +pkg_postinst() {
212 + einfo
213 + elog 'Note about Configuration:'
214 + elog 'DO NOT directly edit glest.ini and glestkeys.ini but rather glestuser.ini'
215 + elog 'and glestuserkeys.ini in ~/.megaglest/ and create your user over-ride'
216 + elog 'values in these files.'
217 + elog
218 + elog 'If you have an older graphics card which only supports OpenGL 1.2, and the'
219 + elog 'game crashes when you try to play, try starting with "megaglest --disable-vbo"'
220 + elog 'Some graphics cards may require setting Max Lights to 1.'
221 + einfo
222 +
223 + xdg_icon_cache_update
224 +}
225 +
226 +pkg_postrm() {
227 + xdg_icon_cache_update
228 +}
229
230 diff --git a/profiles/package.mask b/profiles/package.mask
231 index 94a353fc484..e6fa10d4290 100644
232 --- a/profiles/package.mask
233 +++ b/profiles/package.mask
234 @@ -487,6 +487,7 @@ kde-apps/kdebase-meta:5
235 >=games-simulation/corsix-th-0.64-r100
236 >=games-sports/xmoto-0.6.1-r100
237 >=games-strategy/hedgewars-1.0.0-r100
238 +>=games-strategy/megaglest-3.11.1-r100
239 >=games-strategy/naev-0.7.0-r100
240 >=games-strategy/openra-20190314-r100
241 >=games-strategy/s25rttr-0.9.0_pre20200723-r100