1 |
commit: dbb3bdf4645d0f83d7112620f07500af44e86962 |
2 |
Author: Nils Freydank <holgersson <AT> posteo <DOT> de> |
3 |
AuthorDate: Thu Jun 17 20:11:50 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 17 23:23:36 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dbb3bdf4 |
7 |
|
8 |
games-strategy/0ad: Fix stopping the binary with USE="-nvtt" |
9 |
|
10 |
Closes: https://bugs.gentoo.org/779757 |
11 |
Package-Manager: Portage-3.0.20, Repoman-3.0.3 |
12 |
Signed-off-by: Nils Freydank <holgersson <AT> posteo.de> |
13 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
14 |
|
15 |
games-strategy/0ad/0ad-0.0.24b_alpha-r1.ebuild | 229 +++++++++++++++++++++ |
16 |
...0.24b_alpha-fix-hang-on-quit-without-nvtt.patch | 98 +++++++++ |
17 |
2 files changed, 327 insertions(+) |
18 |
|
19 |
diff --git a/games-strategy/0ad/0ad-0.0.24b_alpha-r1.ebuild b/games-strategy/0ad/0ad-0.0.24b_alpha-r1.ebuild |
20 |
new file mode 100644 |
21 |
index 00000000000..94bf17e4928 |
22 |
--- /dev/null |
23 |
+++ b/games-strategy/0ad/0ad-0.0.24b_alpha-r1.ebuild |
24 |
@@ -0,0 +1,229 @@ |
25 |
+# Copyright 2014-2021 Gentoo Authors |
26 |
+# Distributed under the terms of the GNU General Public License v2 |
27 |
+ |
28 |
+EAPI=7 |
29 |
+ |
30 |
+WX_GTK_VER="3.0-gtk3" |
31 |
+PYTHON_COMPAT=( python3_{7..9} ) |
32 |
+inherit desktop toolchain-funcs multiprocessing python-any-r1 wxwidgets xdg |
33 |
+ |
34 |
+if [[ ${PV} == 9999 ]]; then |
35 |
+ inherit git-r3 |
36 |
+ |
37 |
+ EGIT_REPO_URI="https://github.com/0ad/0ad" |
38 |
+elif [[ ${PV} == *_pre* ]]; then |
39 |
+ ZEROAD_GIT_REVISION="c7d07d3979f969b969211a5e5748fa775f6768a7" |
40 |
+else |
41 |
+ MY_P="0ad-${PV/_/-}" |
42 |
+fi |
43 |
+ |
44 |
+DESCRIPTION="A free, real-time strategy game" |
45 |
+HOMEPAGE="https://play0ad.com/" |
46 |
+ |
47 |
+if [[ ${PV} == 9999 ]]; then |
48 |
+ S="${WORKDIR}/${P}" |
49 |
+elif [[ ${PV} == *_pre* ]]; then |
50 |
+ SRC_URI="https://github.com/0ad/0ad/archive/${ZEROAD_GIT_REVISION}.tar.gz -> ${P}.tar.gz" |
51 |
+ S="${WORKDIR}/${PN}-${ZEROAD_GIT_REVISION}" |
52 |
+else |
53 |
+ SRC_URI="http://releases.wildfiregames.com/${MY_P}-unix-build.tar.xz" |
54 |
+ SRC_URI+=" https://releases.wildfiregames.com/${MY_P}-unix-data.tar.xz" |
55 |
+ S="${WORKDIR}/${MY_P}" |
56 |
+fi |
57 |
+ |
58 |
+LICENSE="CC-BY-SA-3.0 GPL-2 LGPL-2.1 MIT ZLIB BitstreamVera LPPL-1.3c" |
59 |
+SLOT="0" |
60 |
+KEYWORDS="~amd64 ~arm64 ~x86" |
61 |
+IUSE="editor +lobby nvtt pch test" |
62 |
+RESTRICT="test" |
63 |
+ |
64 |
+# virtual/rust is for bundled SpiderMonkey |
65 |
+# Build-time Python dependency is for SM too |
66 |
+# TODO: Unbundle premake5 |
67 |
+# See bug #773472 which may help (bump for it) |
68 |
+BDEPEND=" |
69 |
+ ${PYTHON_DEPS} |
70 |
+ virtual/pkgconfig |
71 |
+ virtual/rust |
72 |
+ test? ( dev-lang/perl ) |
73 |
+" |
74 |
+# Removed dependency on nvtt as we use the bundled one |
75 |
+# bug #768930 |
76 |
+DEPEND=" |
77 |
+ dev-libs/boost:= |
78 |
+ dev-libs/icu:= |
79 |
+ dev-libs/libfmt:0= |
80 |
+ dev-libs/libsodium |
81 |
+ dev-libs/libxml2 |
82 |
+ media-libs/libpng:0 |
83 |
+ media-libs/libsdl2[X,opengl,video] |
84 |
+ media-libs/libvorbis |
85 |
+ media-libs/openal |
86 |
+ net-libs/enet:1.3 |
87 |
+ net-libs/miniupnpc:= |
88 |
+ net-misc/curl |
89 |
+ sys-libs/zlib |
90 |
+ virtual/opengl |
91 |
+ x11-libs/libX11 |
92 |
+ editor? ( x11-libs/wxGTK:${WX_GTK_VER}[X,opengl] ) |
93 |
+ lobby? ( >=net-libs/gloox-1.0.20 ) |
94 |
+" |
95 |
+RDEPEND=" |
96 |
+ ${DEPEND} |
97 |
+ !games-strategy/0ad-data |
98 |
+" |
99 |
+ |
100 |
+PATCHES=( |
101 |
+ "${FILESDIR}"/${PN}-0.0.24_alpha_pre20210116040036-build.patch |
102 |
+ "${FILESDIR}"/${PN}-0.0.24b_alpha-rust-1.50.patch |
103 |
+ "${FILESDIR}"/${PN}-0.0.24b_alpha-respect-tc.patch |
104 |
+ "${FILESDIR}"/${PN}-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch |
105 |
+) |
106 |
+ |
107 |
+pkg_setup() { |
108 |
+ use editor && setup-wxwidgets |
109 |
+} |
110 |
+ |
111 |
+src_prepare() { |
112 |
+ default |
113 |
+ |
114 |
+ # SpiderMonkey's configure no longer recognises --build for |
115 |
+ # the build tuple |
116 |
+ sed -i -e "/--build/d" libraries/source/spidermonkey/build.sh || die |
117 |
+ |
118 |
+ # Originally from 0ad-data |
119 |
+ rm binaries/data/tools/fontbuilder/fonts/*.txt || die |
120 |
+} |
121 |
+ |
122 |
+src_configure() { |
123 |
+ local myconf=( |
124 |
+ --minimal-flags |
125 |
+ $(usex nvtt "" "--without-nvtt") |
126 |
+ $(usex pch "" "--without-pch") |
127 |
+ $(usex test "" "--without-tests") |
128 |
+ $(usex editor "--atlas" "") |
129 |
+ $(usex lobby "" "--without-lobby") |
130 |
+ --bindir="/usr/bin" |
131 |
+ --libdir="/usr/$(get_libdir)"/${PN} |
132 |
+ --datadir="/usr/share/${PN}" |
133 |
+ ) |
134 |
+ |
135 |
+ tc-export AR CC CXX RANLIB |
136 |
+ |
137 |
+ # Stock premake5 does not work, use the shipped one |
138 |
+ # TODO: revisit this, see above BDEPEND note re premake5 |
139 |
+ emake -C "${S}"/build/premake/premake5/build/gmake2.unix |
140 |
+ |
141 |
+ # Regenerate scripts.c so our patch applies |
142 |
+ cd "${S}"/build/premake/premake5 || die |
143 |
+ "${S}"/build/premake/premake5/bin/release/premake5 embed || die |
144 |
+ |
145 |
+ # Rebuild premake again |
146 |
+ emake -C "${S}"/build/premake/premake5/build/gmake2.unix clean |
147 |
+ emake -C "${S}"/build/premake/premake5/build/gmake2.unix |
148 |
+ |
149 |
+ # Run premake to create build scripts |
150 |
+ cd "${S}"/build/premake || die |
151 |
+ "${S}"/build/premake/premake5/bin/release/premake5 \ |
152 |
+ --file="premake5.lua" \ |
153 |
+ --outpath="../workspaces/gcc/" \ |
154 |
+ --os=linux \ |
155 |
+ "${myconf[@]}" \ |
156 |
+ gmake2 \ |
157 |
+ || die "Premake failed" |
158 |
+} |
159 |
+ |
160 |
+src_compile() { |
161 |
+ # Build 3rd party fcollada |
162 |
+ einfo "Building bundled fcollada" |
163 |
+ emake -C libraries/source/fcollada/src |
164 |
+ |
165 |
+ # Build bundled NVTT |
166 |
+ # nvtt is abandoned upstream and 0ad have forked it and added fixes. |
167 |
+ # Use their copy. bug #768930 |
168 |
+ if use nvtt ; then |
169 |
+ cd libraries/source/nvtt || die |
170 |
+ elog "Building bundled NVTT (bug #768930)" |
171 |
+ JOBS="-j$(makeopts_jobs)" ./build.sh || die "Failed to build bundled NVTT" |
172 |
+ cd "${S}" || die |
173 |
+ fi |
174 |
+ |
175 |
+ # Build bundled SpiderMonkey |
176 |
+ # We really can't use the system SpiderMonkey right now. |
177 |
+ # Breakages occur even on minor bumps in upstream SM, |
178 |
+ # e.g. bug #768840. |
179 |
+ cd libraries/source/spidermonkey || die |
180 |
+ elog "Building bundled SpiderMonkey (bug #768840)" |
181 |
+ XARGS="${EPREFIX}/usr/bin/xargs" \ |
182 |
+ JOBS="-j$(makeopts_jobs)" \ |
183 |
+ ./build.sh \ |
184 |
+ || die "Failed to build bundled SpiderMonkey" |
185 |
+ |
186 |
+ cd "${S}" || die |
187 |
+ |
188 |
+ # Build 0ad itself! |
189 |
+ elog "Building 0ad" |
190 |
+ JOBS="-j$(makeopts_jobs)" emake -C build/workspaces/gcc verbose=1 |
191 |
+ |
192 |
+ # Build assets |
193 |
+ # (We only do this if we're using a snapshot/non-release) |
194 |
+ # See bug #771147 (comment 3) and the old 0ad-data ebuild |
195 |
+ # Warning: fragile! |
196 |
+ if [[ ${PV} == 9999 || ${PV} == *_pre* ]]; then |
197 |
+ # source/lib/sysdep/os/linux/ldbg.cpp:debug_SetThreadName() tries to open /proc/self/task/${TID}/comm for writing. |
198 |
+ addpredict /proc/self/task |
199 |
+ |
200 |
+ # Based on source/tools/dist/build-archives.sh used by source/tools/dist/build.sh. |
201 |
+ local archivebuild_input archivebuild_output mod_name |
202 |
+ for archivebuild_input in binaries/data/mods/[A-Za-z0-9]*; do |
203 |
+ mod_name="${archivebuild_input##*/}" |
204 |
+ archivebuild_output="archives/${mod_name}" |
205 |
+ |
206 |
+ mkdir -p "${archivebuild_output}" || die |
207 |
+ |
208 |
+ einfo pyrogenesis -archivebuild="${archivebuild_input}" -archivebuild-output="${archivebuild_output}/${mod_name}.zip" |
209 |
+ LD_LIBRARY_PATH="binaries/system" binaries/system/pyrogenesis \ |
210 |
+ -archivebuild="${archivebuild_input}" \ |
211 |
+ -archivebuild-output="${archivebuild_output}/${mod_name}.zip" \ |
212 |
+ || die "Failed to build assets" |
213 |
+ |
214 |
+ if [[ -f "${archivebuild_input}/mod.json" ]]; then |
215 |
+ cp "${archivebuild_input}/mod.json" "${archivebuild_output}" || die |
216 |
+ fi |
217 |
+ |
218 |
+ rm -r "${archivebuild_input}" || die |
219 |
+ mv "${archivebuild_output}" "${archivebuild_input}" || die |
220 |
+ done |
221 |
+ |
222 |
+ # Based on source/tools/dist/build-unix-win32.sh used by source/tools/dist/build.sh. |
223 |
+ rm binaries/data/config/dev.cfg || die |
224 |
+ rm -r binaries/data/mods/_test.* || die |
225 |
+ fi |
226 |
+} |
227 |
+ |
228 |
+src_test() { |
229 |
+ cd binaries/system || die |
230 |
+ ./test -libdir "${S}/binaries/system" || die "Failed tests" |
231 |
+} |
232 |
+ |
233 |
+src_install() { |
234 |
+ newbin binaries/system/pyrogenesis 0ad |
235 |
+ use editor && newbin binaries/system/ActorEditor 0ad-ActorEditor |
236 |
+ |
237 |
+ # Merged from 0ad-data |
238 |
+ # bug #771147 (comment 3) |
239 |
+ insinto /usr/share/${PN} |
240 |
+ doins -r binaries/data/{l10n,config,mods,tools} |
241 |
+ |
242 |
+ # Install bundled SpiderMonkey and nvtt |
243 |
+ # bug #771147 (comment 1) |
244 |
+ exeinto /usr/$(get_libdir)/${PN} |
245 |
+ doexe binaries/system/{libCollada,libmozjs78-ps-release}.so |
246 |
+ |
247 |
+ use nvtt && doexe binaries/system/{libnvtt,libnvcore,libnvimage,libnvmath}.so |
248 |
+ use editor && doexe binaries/system/libAtlasUI.so |
249 |
+ |
250 |
+ dodoc binaries/system/readme.txt |
251 |
+ doicon -s 128 build/resources/${PN}.png |
252 |
+ make_desktop_entry ${PN} |
253 |
+} |
254 |
|
255 |
diff --git a/games-strategy/0ad/files/0ad-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch b/games-strategy/0ad/files/0ad-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch |
256 |
new file mode 100644 |
257 |
index 00000000000..fe054eccac5 |
258 |
--- /dev/null |
259 |
+++ b/games-strategy/0ad/files/0ad-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch |
260 |
@@ -0,0 +1,98 @@ |
261 |
+# Nils Freydank <holgersson@××××××.de> (2021-06-17) |
262 |
+Apply the patch from upstream with minor adoption. |
263 |
+ |
264 |
+Gentoo bug: https://bugs.gentoo.org/779757 |
265 |
+Upstream Bug: https://trac.wildfiregames.com/ticket/6107 |
266 |
+Upstream Patch: https://trac.wildfiregames.com/changeset/25766 |
267 |
+ |
268 |
+--- a/source/graphics/TextureConverter.cpp (revision 25765) |
269 |
++++ b/source/graphics/TextureConverter.cpp (revision 25766) |
270 |
+@@ -294,9 +294,8 @@ |
271 |
+ m_VFS(vfs), m_HighQuality(highQuality), m_Shutdown(false) |
272 |
+ { |
273 |
++#if CONFIG2_NVTT |
274 |
+ // Verify that we are running with at least the version we were compiled with, |
275 |
+ // to avoid bugs caused by ABI changes |
276 |
+-#if CONFIG2_NVTT |
277 |
+ ENSURE(nvtt::version() >= NVTT_VERSION); |
278 |
+-#endif |
279 |
+ |
280 |
+ m_WorkerThread = std::thread(Threading::HandleExceptions<RunThread>::Wrapper, this); |
281 |
+@@ -304,8 +303,10 @@ |
282 |
+ // Maybe we should share some centralised pool of worker threads? |
283 |
+ // For now we'll just stick with a single thread for this specific use. |
284 |
++#endif // CONFIG2_NVTT |
285 |
+ } |
286 |
+ |
287 |
+ CTextureConverter::~CTextureConverter() |
288 |
+ { |
289 |
++#if CONFIG2_NVTT |
290 |
+ // Tell the thread to shut down |
291 |
+ { |
292 |
+@@ -327,4 +328,5 @@ |
293 |
+ // Wait for it to shut down cleanly |
294 |
+ m_WorkerThread.join(); |
295 |
++#endif // CONFIG2_NVTT |
296 |
+ } |
297 |
+ |
298 |
+@@ -477,8 +479,8 @@ |
299 |
+ return true; |
300 |
+ |
301 |
+-#else |
302 |
++#else // CONFIG2_NVTT |
303 |
+ LOGERROR("Failed to convert texture \"%s\" (NVTT not available)", src.string8()); |
304 |
+ return false; |
305 |
+-#endif |
306 |
++#endif // !CONFIG2_NVTT |
307 |
+ } |
308 |
+ |
309 |
+@@ -529,22 +531,24 @@ |
310 |
+ return true; |
311 |
+ |
312 |
+-#else // #if CONFIG2_NVTT |
313 |
++#else // CONFIG2_NVTT |
314 |
+ return false; |
315 |
+-#endif |
316 |
++#endif // !CONFIG2_NVTT |
317 |
+ } |
318 |
+ |
319 |
+ bool CTextureConverter::IsBusy() |
320 |
+ { |
321 |
++#if CONFIG2_NVTT |
322 |
+ std::lock_guard<std::mutex> lock(m_WorkerMutex); |
323 |
+ return !m_RequestQueue.empty(); |
324 |
++#else // CONFIG2_NVTT |
325 |
++ return false; |
326 |
++#endif // !CONFIG2_NVTT |
327 |
+ } |
328 |
+ |
329 |
+ void CTextureConverter::RunThread(CTextureConverter* textureConverter) |
330 |
+ { |
331 |
++#if CONFIG2_NVTT |
332 |
+ debug_SetThreadName("TextureConverter"); |
333 |
+ g_Profiler2.RegisterCurrentThread("texconv"); |
334 |
+- |
335 |
+-#if CONFIG2_NVTT |
336 |
+- |
337 |
+ // Wait until the main thread wakes us up |
338 |
+ while (true) |
339 |
+@@ -596,4 +600,4 @@ |
340 |
+ std::lock_guard<std::mutex> wait_lock(textureConverter->m_WorkerMutex); |
341 |
+ textureConverter->m_Shutdown = false; |
342 |
+-#endif |
343 |
+-} |
344 |
++#endif // CONFIG2_NVTT |
345 |
++} |
346 |
+ |
347 |
+--- a/source/graphics/TextureConverter.h (revision 25765) |
348 |
++++ b/source/graphics/TextureConverter.h (revision 25766) |
349 |
+@@ -208,7 +208,9 @@ |
350 |
+ bool m_HighQuality; |
351 |
+ |
352 |
++#if CONFIG2_NVTT |
353 |
+ std::thread m_WorkerThread; |
354 |
+ std::mutex m_WorkerMutex; |
355 |
+ std::condition_variable m_WorkerCV; |
356 |
++#endif // CONFIG2_NVTT |
357 |
+ |
358 |
+ struct ConversionRequest; |