1 |
commit: f2797c5e9235f969e7c3aee900b7669821c69827 |
2 |
Author: Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Aug 6 23:19:28 2020 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 17 21:59:05 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2797c5e |
7 |
|
8 |
games-sports/xmoto: fix #730346 |
9 |
|
10 |
Applied upstream patch for removing uses of deprecated lua 5.0 code. |
11 |
Closes: https://bugs.gentoo.org/730346 |
12 |
Package-Manager: Portage-2.3.103, Repoman-2.3.23 |
13 |
Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com> |
14 |
Closes: https://github.com/gentoo/gentoo/pull/17037 |
15 |
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> |
16 |
|
17 |
.../xmoto/files/xmoto-0.6.1_lua_deprecated.patch | 79 ++++++++++++++++++++++ |
18 |
games-sports/xmoto/metadata.xml | 3 + |
19 |
games-sports/xmoto/xmoto-0.6.1-r1.ebuild | 66 ++++++++++++++++++ |
20 |
3 files changed, 148 insertions(+) |
21 |
|
22 |
diff --git a/games-sports/xmoto/files/xmoto-0.6.1_lua_deprecated.patch b/games-sports/xmoto/files/xmoto-0.6.1_lua_deprecated.patch |
23 |
new file mode 100644 |
24 |
index 00000000000..078fa91aaab |
25 |
--- /dev/null |
26 |
+++ b/games-sports/xmoto/files/xmoto-0.6.1_lua_deprecated.patch |
27 |
@@ -0,0 +1,79 @@ |
28 |
+From fb004501a6387bb7ba5182b60ec305e9947dc545 Mon Sep 17 00:00:00 2001 |
29 |
+From: _yui <imbatman0xff@×××××.com> |
30 |
+Date: Tue, 7 Jul 2020 21:44:49 +0300 |
31 |
+Subject: [PATCH 1/2] Fix building with Lua with deprecated functions removed |
32 |
+ |
33 |
+--- |
34 |
+ src/CMakeLists.txt | 5 +++++ |
35 |
+ src/xmoto/LuaLibBase.cpp | 6 ++++++ |
36 |
+ 2 files changed, 11 insertions(+) |
37 |
+ |
38 |
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt |
39 |
+index a3f328f9..3618360e 100644 |
40 |
+--- a/src/CMakeLists.txt |
41 |
++++ b/src/CMakeLists.txt |
42 |
+@@ -461,6 +461,11 @@ check_prototype_definition(mkdir |
43 |
+ ) |
44 |
+ target_compile_definitions(xmoto PUBLIC MS_MKDIR=$<BOOL:${MS_MKDIR}>) |
45 |
+ |
46 |
++if(USE_SYSTEM_Lua) |
47 |
++ check_symbol_exists(luaL_openlib lauxlib.h HAVE_LUAL_OPENLIB) |
48 |
++ target_compile_definitions(xmoto PUBLIC HAVE_LUAL_OPENLIB=$<BOOL:${HAVE_LUAL_OPENLIB}>) |
49 |
++endif() |
50 |
++ |
51 |
+ target_compile_definitions(xmoto PUBLIC USE_OPENGL=$<BOOL:${USE_OPENGL}>) |
52 |
+ target_compile_definitions(xmoto PUBLIC USE_SDLGFX=$<BOOL:${USE_SDLGFX}>) |
53 |
+ target_compile_definitions(xmoto PUBLIC USE_GETTEXT=$<BOOL:${USE_GETTEXT}>) |
54 |
+diff --git a/src/xmoto/LuaLibBase.cpp b/src/xmoto/LuaLibBase.cpp |
55 |
+index fed3c79e..62b690e1 100644 |
56 |
+--- a/src/xmoto/LuaLibBase.cpp |
57 |
++++ b/src/xmoto/LuaLibBase.cpp |
58 |
+@@ -42,7 +42,13 @@ LuaLibBase::LuaLibBase(const std::string &i_libname, luaL_Reg i_reg[]) { |
59 |
+ luaL_requiref(m_pL, LUA_TABLIBNAME, luaopen_table, 1); |
60 |
+ #endif |
61 |
+ |
62 |
++#if HAVE_LUAL_OPENLIB |
63 |
+ luaL_openlib(m_pL, i_libname.c_str(), i_reg, 0); |
64 |
++#else |
65 |
++ lua_newtable(m_pL); |
66 |
++ luaL_register(m_pL, i_libname.c_str(), i_reg); |
67 |
++ lua_setglobal(m_pL, i_libname.c_str()); |
68 |
++#endif |
69 |
+ } |
70 |
+ |
71 |
+ LuaLibBase::~LuaLibBase() { |
72 |
+ |
73 |
+From 0a92ee4e8d6ffb88f137b74ba3e9a9b688ac50e6 Mon Sep 17 00:00:00 2001 |
74 |
+From: _yui <imbatman0xff@×××××.com> |
75 |
+Date: Tue, 7 Jul 2020 23:01:38 +0300 |
76 |
+Subject: [PATCH 2/2] Change luaL_register to luaL_setfuncs for lua 5.2 and |
77 |
+ newer |
78 |
+ |
79 |
+--- |
80 |
+ src/xmoto/LuaLibBase.cpp | 10 ++++++++-- |
81 |
+ 1 file changed, 8 insertions(+), 2 deletions(-) |
82 |
+ |
83 |
+diff --git a/src/xmoto/LuaLibBase.cpp b/src/xmoto/LuaLibBase.cpp |
84 |
+index 62b690e1..911c5698 100644 |
85 |
+--- a/src/xmoto/LuaLibBase.cpp |
86 |
++++ b/src/xmoto/LuaLibBase.cpp |
87 |
+@@ -44,11 +44,17 @@ LuaLibBase::LuaLibBase(const std::string &i_libname, luaL_Reg i_reg[]) { |
88 |
+ |
89 |
+ #if HAVE_LUAL_OPENLIB |
90 |
+ luaL_openlib(m_pL, i_libname.c_str(), i_reg, 0); |
91 |
+-#else |
92 |
++#else // HAVE_LUAL_OPENLIB |
93 |
+ lua_newtable(m_pL); |
94 |
++ |
95 |
++#if LUA_VERSION_NUM >= 502 |
96 |
++ luaL_setfuncs(m_pL, i_reg, 0); |
97 |
++#else // LUA_VERSION_NUM >= 502 |
98 |
+ luaL_register(m_pL, i_libname.c_str(), i_reg); |
99 |
++#endif // LUA_VERSION_NUM >= 502 |
100 |
++ |
101 |
+ lua_setglobal(m_pL, i_libname.c_str()); |
102 |
+-#endif |
103 |
++#endif // HAVE_LUAL_OPENLIB |
104 |
+ } |
105 |
+ |
106 |
+ LuaLibBase::~LuaLibBase() { |
107 |
|
108 |
diff --git a/games-sports/xmoto/metadata.xml b/games-sports/xmoto/metadata.xml |
109 |
index e62095b0181..fe3815850e5 100644 |
110 |
--- a/games-sports/xmoto/metadata.xml |
111 |
+++ b/games-sports/xmoto/metadata.xml |
112 |
@@ -8,4 +8,7 @@ |
113 |
<use> |
114 |
<flag name="double-precision">more precise calculations at the expense of speed</flag> |
115 |
</use> |
116 |
+ <upstream> |
117 |
+ <remote-id type="github">xmoto/xmoto</remote-id> |
118 |
+ </upstream> |
119 |
</pkgmetadata> |
120 |
|
121 |
diff --git a/games-sports/xmoto/xmoto-0.6.1-r1.ebuild b/games-sports/xmoto/xmoto-0.6.1-r1.ebuild |
122 |
new file mode 100644 |
123 |
index 00000000000..c8bbb19258a |
124 |
--- /dev/null |
125 |
+++ b/games-sports/xmoto/xmoto-0.6.1-r1.ebuild |
126 |
@@ -0,0 +1,66 @@ |
127 |
+# Copyright 1999-2020 Gentoo Authors |
128 |
+# Distributed under the terms of the GNU General Public License v2 |
129 |
+ |
130 |
+EAPI=7 |
131 |
+ |
132 |
+inherit cmake |
133 |
+ |
134 |
+DESCRIPTION="A challenging 2D motocross platform game, where physics play an important role" |
135 |
+HOMEPAGE="https://xmoto.tuxfamily.org" |
136 |
+SRC_URI="https://github.com/xmoto/xmoto/archive/${PV}.tar.gz -> ${P}.tar.gz" |
137 |
+ |
138 |
+LICENSE="GPL-2+" |
139 |
+SLOT="0" |
140 |
+KEYWORDS="~amd64 ~x86" |
141 |
+IUSE="double-precision +nls" |
142 |
+ |
143 |
+RDEPEND="app-arch/bzip2 |
144 |
+ dev-db/sqlite:3 |
145 |
+ dev-games/ode[double-precision=] |
146 |
+ dev-lang/lua:0 |
147 |
+ dev-libs/libxdg-basedir |
148 |
+ dev-libs/libxml2 |
149 |
+ media-fonts/dejavu |
150 |
+ media-libs/libpng:0= |
151 |
+ media-libs/libsdl[joystick,opengl] |
152 |
+ media-libs/sdl-mixer[vorbis] |
153 |
+ media-libs/sdl-net |
154 |
+ media-libs/sdl-ttf |
155 |
+ net-misc/curl |
156 |
+ sys-libs/zlib:= |
157 |
+ virtual/jpeg:0 |
158 |
+ virtual/glu |
159 |
+ virtual/opengl |
160 |
+ nls? ( virtual/libintl )" |
161 |
+DEPEND="${RDEPEND}" |
162 |
+BDEPEND="app-arch/xz-utils |
163 |
+ nls? ( sys-devel/gettext )" |
164 |
+ |
165 |
+PATCHES=( |
166 |
+ "${FILESDIR}/${P}_lua_deprecated.patch" |
167 |
+) |
168 |
+ |
169 |
+src_prepare() { |
170 |
+ sed -e "/^Icon/s/.xpm//" -i extra/xmoto.desktop || die |
171 |
+ sed -e "/add_subdirectory.*\(bzip2\|libccd\|lua\|ode\|xdgbasedir\)/d" -i src/CMakeLists.txt || die |
172 |
+ rm -rf vendor/{bzip2,lua,ode,xdgbasedir} || die |
173 |
+ |
174 |
+ cmake_src_prepare |
175 |
+} |
176 |
+ |
177 |
+src_configure() { |
178 |
+ local mycmakeargs=( |
179 |
+ -DUSE_GETTEXT=$(usex nls) |
180 |
+ -DOpenGL_GL_PREFERENCE=GLVND |
181 |
+ ) |
182 |
+ |
183 |
+ cmake_src_configure |
184 |
+} |
185 |
+ |
186 |
+src_install() { |
187 |
+ cmake_src_install |
188 |
+ |
189 |
+ rm -f "${ED}/usr/share/xmoto"/Textures/Fonts/DejaVuSans{Mono,}.ttf || die |
190 |
+ dosym ../../../fonts/dejavu/DejaVuSans.ttf /usr/share/xmoto/Textures/Fonts/DejaVuSans.ttf |
191 |
+ dosym ../../../fonts/dejavu/DejaVuSansMono.ttf /usr/share/xmoto/Textures/Fonts/DejaVuSansMono.ttf |
192 |
+} |