1 |
commit: 17666af92dcda999af6d9b7288696e4348f2471d |
2 |
Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 15 09:00:20 2022 +0000 |
4 |
Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 16 00:00:32 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17666af9 |
7 |
|
8 |
dev-games/godot: new package, add 3.5 (slot:3) |
9 |
|
10 |
That this wasn't in ::gentoo always kind of bothered me even though |
11 |
I don't really use it, and felt like handling it. |
12 |
|
13 |
Help/suggestions/PRs welcome from actual users, and please report |
14 |
if anything unexpected compared to official builds (perhaps due |
15 |
to unbundling/USE). |
16 |
|
17 |
Slotted given godot:4 is known to have major breaking changes and |
18 |
migrating is not always trivial. |
19 |
|
20 |
Note largely no interest in building export templates (complex |
21 |
toolchains and would realistically need to use bundled libs), |
22 |
and does not help that this cannot use system paths to find them |
23 |
without patching. Game ebuilds can do simple wrapper.eclass + |
24 |
desktop.eclass w/ icon.png and use system's godot[34]-runner |
25 |
(simpler if assets are pre-imported). |
26 |
|
27 |
IUSE=headless/cli may have been useful to have both gui and headless |
28 |
at same time but requires an extra long build and is obsoleted in |
29 |
godot4 with the --headless switch, likely not worth having for 3. |
30 |
|
31 |
Bug: https://bugs.gentoo.org/532730 |
32 |
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org> |
33 |
|
34 |
dev-games/godot/Manifest | 1 + |
35 |
dev-games/godot/files/godot-3.5-musl.patch | 9 ++ |
36 |
dev-games/godot/files/godot-3.5-scons.patch | 74 ++++++++++ |
37 |
dev-games/godot/godot-3.5.ebuild | 218 ++++++++++++++++++++++++++++ |
38 |
dev-games/godot/metadata.xml | 34 +++++ |
39 |
5 files changed, 336 insertions(+) |
40 |
|
41 |
diff --git a/dev-games/godot/Manifest b/dev-games/godot/Manifest |
42 |
new file mode 100644 |
43 |
index 000000000000..8116161b4deb |
44 |
--- /dev/null |
45 |
+++ b/dev-games/godot/Manifest |
46 |
@@ -0,0 +1 @@ |
47 |
+DIST godot-3.5-stable.tar.xz 24044340 BLAKE2B 9d77ecdfa6bd90065fff26c2334f13c32bbbc4b26aad111b5aab2563d1e4782457ea6cf2115f1a809e0d8aac3d3ee9a138ad224998068983ad36e54a577d89c3 SHA512 23785e39ccc7e1406c97ee33b5e90f7f397aa907d79d72ed08ea3f4b7e68788030a1bcdd07c9f782a21ee3a84636a2cea47a57dcfc94c24e327fa210ae0515b0 |
48 |
|
49 |
diff --git a/dev-games/godot/files/godot-3.5-musl.patch b/dev-games/godot/files/godot-3.5-musl.patch |
50 |
new file mode 100644 |
51 |
index 000000000000..0738b035480f |
52 |
--- /dev/null |
53 |
+++ b/dev-games/godot/files/godot-3.5-musl.patch |
54 |
@@ -0,0 +1,9 @@ |
55 |
+crash handler requires glibc or libexecinfo (not packaged), |
56 |
+and is always enabled if build the editor (release_debug) |
57 |
+--- a/platform/x11/crash_handler_x11.cpp |
58 |
++++ b/platform/x11/crash_handler_x11.cpp |
59 |
+@@ -38,3 +38,3 @@ |
60 |
+ |
61 |
+-#ifdef DEBUG_ENABLED |
62 |
++#if defined(DEBUG_ENABLED) && defined(__GLIBC__) |
63 |
+ #define CRASH_HANDLER_ENABLED 1 |
64 |
|
65 |
diff --git a/dev-games/godot/files/godot-3.5-scons.patch b/dev-games/godot/files/godot-3.5-scons.patch |
66 |
new file mode 100644 |
67 |
index 000000000000..b8ed7f50311d |
68 |
--- /dev/null |
69 |
+++ b/dev-games/godot/files/godot-3.5-scons.patch |
70 |
@@ -0,0 +1,74 @@ |
71 |
+* add option to respect AR |
72 |
+ (respecting PKG_CONFIG is handled in the ebuild) |
73 |
+* handle recastnavigation unbundling |
74 |
+* remove unnecessary opusfile |
75 |
+* remove unnecessary -no-pie |
76 |
+* remove -pipe from LDFLAGS, may "possibly" be relevant to: |
77 |
+ https://bugs.gentoo.org/861689 |
78 |
+ https://github.com/godotengine/godot/commit/f035e784 |
79 |
+--- a/SConstruct |
80 |
++++ b/SConstruct |
81 |
+@@ -192,4 +192,5 @@ |
82 |
+ opts.Add("CXX", "C++ compiler") |
83 |
+ opts.Add("CC", "C compiler") |
84 |
++opts.Add("AR", "Archiver") |
85 |
+ opts.Add("LINK", "Linker") |
86 |
+ opts.Add("CCFLAGS", "Custom flags for both the C and C++ compilers") |
87 |
+--- a/platform/server/detect.py |
88 |
++++ b/platform/server/detect.py |
89 |
+@@ -135,5 +135,4 @@ |
90 |
+ |
91 |
+ env.Append(CCFLAGS=["-pipe"]) |
92 |
+- env.Append(LINKFLAGS=["-pipe"]) |
93 |
+ |
94 |
+ ## Dependencies |
95 |
+@@ -178,4 +177,7 @@ |
96 |
+ env.ParseConfig("pkg-config libenet --cflags --libs") |
97 |
+ |
98 |
++ if not env["builtin_recast"]: |
99 |
++ env.ParseConfig("pkg-config recastnavigation --cflags --libs") |
100 |
++ |
101 |
+ if not env["builtin_squish"]: |
102 |
+ env.ParseConfig("pkg-config libsquish --cflags --libs") |
103 |
+@@ -205,5 +207,5 @@ |
104 |
+ if not env["builtin_opus"]: |
105 |
+ env["builtin_libogg"] = False # Needed to link against system opus |
106 |
+- env.ParseConfig("pkg-config opus opusfile --cflags --libs") |
107 |
++ env.ParseConfig("pkg-config opus --cflags --libs") |
108 |
+ |
109 |
+ if not env["builtin_libogg"]: |
110 |
+--- a/platform/x11/detect.py |
111 |
++++ b/platform/x11/detect.py |
112 |
+@@ -232,17 +232,5 @@ |
113 |
+ |
114 |
+ env.Append(CCFLAGS=["-pipe"]) |
115 |
+- env.Append(LINKFLAGS=["-pipe"]) |
116 |
+ |
117 |
+- # Check for gcc version >= 6 before adding -no-pie |
118 |
+- version = get_compiler_version(env) or [-1, -1] |
119 |
+- if using_gcc(env): |
120 |
+- if version[0] >= 6: |
121 |
+- env.Append(CCFLAGS=["-fpie"]) |
122 |
+- env.Append(LINKFLAGS=["-no-pie"]) |
123 |
+- # Do the same for clang should be fine with Clang 4 and higher |
124 |
+- if using_clang(env): |
125 |
+- if version[0] >= 4: |
126 |
+- env.Append(CCFLAGS=["-fpie"]) |
127 |
+- env.Append(LINKFLAGS=["-no-pie"]) |
128 |
+ |
129 |
+ ## Dependencies |
130 |
+@@ -298,4 +286,7 @@ |
131 |
+ env.ParseConfig("pkg-config libenet --cflags --libs") |
132 |
+ |
133 |
++ if not env["builtin_recast"]: |
134 |
++ env.ParseConfig("pkg-config recastnavigation --cflags --libs") |
135 |
++ |
136 |
+ if not env["builtin_squish"]: |
137 |
+ env.ParseConfig("pkg-config libsquish --cflags --libs") |
138 |
+@@ -325,5 +316,5 @@ |
139 |
+ if not env["builtin_opus"]: |
140 |
+ env["builtin_libogg"] = False # Needed to link against system opus |
141 |
+- env.ParseConfig("pkg-config opus opusfile --cflags --libs") |
142 |
++ env.ParseConfig("pkg-config opus --cflags --libs") |
143 |
+ |
144 |
+ if not env["builtin_libogg"]: |
145 |
|
146 |
diff --git a/dev-games/godot/godot-3.5.ebuild b/dev-games/godot/godot-3.5.ebuild |
147 |
new file mode 100644 |
148 |
index 000000000000..3d18204a94a1 |
149 |
--- /dev/null |
150 |
+++ b/dev-games/godot/godot-3.5.ebuild |
151 |
@@ -0,0 +1,218 @@ |
152 |
+# Copyright 2022 Gentoo Authors |
153 |
+# Distributed under the terms of the GNU General Public License v2 |
154 |
+ |
155 |
+EAPI=7 |
156 |
+ |
157 |
+PYTHON_COMPAT=( python3_{8..10} ) |
158 |
+inherit bash-completion-r1 desktop python-any-r1 scons-utils toolchain-funcs xdg |
159 |
+ |
160 |
+DESCRIPTION="Multi-platform 2D and 3D game engine with a feature-rich editor" |
161 |
+HOMEPAGE="https://godotengine.org/" |
162 |
+SRC_URI="https://downloads.tuxfamily.org/godotengine/${PV}/${P}-stable.tar.xz" |
163 |
+S="${WORKDIR}/${P}-stable" |
164 |
+ |
165 |
+LICENSE=" |
166 |
+ MIT |
167 |
+ Apache-2.0 BSD Boost-1.0 CC0-1.0 Unlicense ZLIB |
168 |
+ gui? ( CC-BY-4.0 ) tools? ( BitstreamVera OFL-1.1 )" |
169 |
+SLOT="3" |
170 |
+KEYWORDS="~amd64" |
171 |
+# Enable roughly same as upstream by default so it works as expected, |
172 |
+# except raycast (tools-only heavy dependency), and deprecated. |
173 |
+IUSE=" |
174 |
+ +bullet debug deprecated +gui pulseaudio raycast +runner +theora |
175 |
+ +tools +udev +upnp +webm +webp" |
176 |
+ |
177 |
+# dlopen: alsa-lib,pulseaudio,udev |
178 |
+RDEPEND=" |
179 |
+ app-arch/zstd:= |
180 |
+ dev-games/recastnavigation:= |
181 |
+ dev-libs/libpcre2:=[pcre32] |
182 |
+ media-libs/freetype[brotli] |
183 |
+ media-libs/libpng:= |
184 |
+ <net-libs/mbedtls-3:= |
185 |
+ net-libs/wslay |
186 |
+ sys-libs/zlib:= |
187 |
+ bullet? ( sci-physics/bullet:= ) |
188 |
+ gui? ( |
189 |
+ media-libs/alsa-lib |
190 |
+ media-libs/libglvnd[X] |
191 |
+ x11-libs/libX11 |
192 |
+ x11-libs/libXcursor |
193 |
+ x11-libs/libXext |
194 |
+ x11-libs/libXi |
195 |
+ x11-libs/libXinerama |
196 |
+ x11-libs/libXrandr |
197 |
+ x11-libs/libXrender |
198 |
+ pulseaudio? ( media-libs/libpulse ) |
199 |
+ tools? ( raycast? ( media-libs/embree:3 ) ) |
200 |
+ udev? ( virtual/udev ) |
201 |
+ ) |
202 |
+ theora? ( |
203 |
+ media-libs/libogg |
204 |
+ media-libs/libtheora |
205 |
+ media-libs/libvorbis |
206 |
+ ) |
207 |
+ tools? ( app-misc/ca-certificates ) |
208 |
+ upnp? ( net-libs/miniupnpc:= ) |
209 |
+ webm? ( |
210 |
+ media-libs/libvorbis |
211 |
+ media-libs/libvpx:= |
212 |
+ media-libs/opus |
213 |
+ ) |
214 |
+ webp? ( media-libs/libwebp:= )" |
215 |
+DEPEND=" |
216 |
+ ${RDEPEND} |
217 |
+ gui? ( x11-base/xorg-proto )" |
218 |
+BDEPEND="virtual/pkgconfig" |
219 |
+ |
220 |
+PATCHES=( |
221 |
+ "${FILESDIR}"/${PN}-3.5-musl.patch |
222 |
+ "${FILESDIR}"/${PN}-3.5-scons.patch |
223 |
+) |
224 |
+ |
225 |
+src_prepare() { |
226 |
+ default |
227 |
+ |
228 |
+ sed -i "1,5s/ godot/&${SLOT}/i" misc/dist/linux/godot.6 || die |
229 |
+ sed -i "/id/s/Godot/&${SLOT}/" misc/dist/linux/org.godotengine.Godot.appdata.xml || die |
230 |
+ sed -e "s/=godot/&${SLOT}/" -e "/^Name=/s/$/ ${SLOT}/" \ |
231 |
+ -i misc/dist/linux/org.godotengine.Godot.desktop || die |
232 |
+ |
233 |
+ sed -i "s|pkg-config |$(tc-getPKG_CONFIG) |" platform/{x11,server}/detect.py || die |
234 |
+ |
235 |
+ # use of builtin_ switches can be messy (see below), delete to be sure |
236 |
+ local unbundle=( |
237 |
+ bullet embree freetype libogg libpng libtheora libvorbis libvpx |
238 |
+ libwebp mbedtls miniupnpc opus pcre2 recastnavigation wslay zlib zstd |
239 |
+ # certs: unused by generated header, but scons panics if not found |
240 |
+ ) |
241 |
+ rm -r "${unbundle[@]/#/thirdparty/}" || die |
242 |
+} |
243 |
+ |
244 |
+src_compile() { |
245 |
+ local -x BUILD_NAME=gentoo # replaces "custom_build" in version string |
246 |
+ |
247 |
+ local esconsargs=( |
248 |
+ AR="$(tc-getAR)" CC="$(tc-getCC)" CXX="$(tc-getCXX)" |
249 |
+ |
250 |
+ platform=$(usex gui x11 server) |
251 |
+ progress=no |
252 |
+ verbose=yes |
253 |
+ |
254 |
+ deprecated=$(usex deprecated) |
255 |
+ #execinfo=$(usex !elibc_glibc) # libexecinfo is not packaged |
256 |
+ minizip=yes # uses a modified bundled copy |
257 |
+ pulseaudio=$(usex gui $(usex pulseaudio)) |
258 |
+ udev=$(usex gui $(usex udev)) |
259 |
+ |
260 |
+ system_certs_path="${EPREFIX}"/etc/ssl/certs/ca-certificates.crt |
261 |
+ |
262 |
+ # platform/*/detect.py uses builtin_* switches to check if need |
263 |
+ # to link with system libraries, but ignores whether the dep is |
264 |
+ # actually used, so "enable" deleted builtins on disabled deps |
265 |
+ builtin_bullet=$(usex !bullet) |
266 |
+ builtin_certs=no |
267 |
+ builtin_embree=$(usex !gui yes $(usex !tools yes $(usex !raycast))) |
268 |
+ builtin_enet=yes # bundled copy is patched for IPv6+DTLS support |
269 |
+ builtin_freetype=no |
270 |
+ builtin_libogg=yes # unused |
271 |
+ builtin_libpng=no |
272 |
+ builtin_libtheora=$(usex !theora) |
273 |
+ builtin_libvorbis=$(usex !theora $(usex !webm)) |
274 |
+ builtin_libvpx=$(usex !webm) |
275 |
+ builtin_libwebp=$(usex !webp) |
276 |
+ builtin_mbedtls=no |
277 |
+ builtin_miniupnpc=$(usex !upnp) |
278 |
+ builtin_opus=$(usex !webm) |
279 |
+ builtin_pcre2=no |
280 |
+ builtin_recast=no |
281 |
+ builtin_rvo2=yes # bundled copy has godot-specific changes |
282 |
+ builtin_squish=yes # ^ likewise, may not be safe to unbundle |
283 |
+ builtin_wslay=no |
284 |
+ builtin_xatlas=yes # not wired for unbundling nor packaged |
285 |
+ builtin_zlib=no |
286 |
+ builtin_zstd=no |
287 |
+ # also bundled but lacking a builtin_* switch: |
288 |
+ # cvtt, etc2comp, fonts, glad, jpeg-compressor, libsimplewebm, |
289 |
+ # minimp3, minizip (patched to seek in archives), nanosvg, oidn, |
290 |
+ # pvrtccompressor, stb_rect_pack, tinyexr, vhacd, and the misc |
291 |
+ # directory. |
292 |
+ |
293 |
+ # modules with optional dependencies, "possible" to disable more but |
294 |
+ # gets messy and breaks all sorts of features (expected enabled) |
295 |
+ module_bullet_enabled=$(usex bullet) |
296 |
+ module_mono_enabled=no # unhandled |
297 |
+ module_ogg_enabled=no # unused |
298 |
+ module_opus_enabled=no # unused, support is gone and webm uses system's |
299 |
+ # note raycast is disabled on many arches, see raycast/config.py |
300 |
+ module_raycast_enabled=$(usex gui $(usex tools $(usex raycast))) |
301 |
+ module_theora_enabled=$(usex theora) |
302 |
+ module_upnp_enabled=$(usex upnp) |
303 |
+ module_vorbis_enabled=no # unused, non-theora/webm uses stb_vorbis |
304 |
+ module_webm_enabled=$(usex webm) |
305 |
+ module_webp_enabled=$(usex webp) |
306 |
+ |
307 |
+ # let *FLAGS handle these, e.g. can pass -flto as-is |
308 |
+ debug_symbols=no |
309 |
+ optimize=none |
310 |
+ use_lto=no |
311 |
+ use_static_cpp=no |
312 |
+ ) |
313 |
+ |
314 |
+ if use runner && use tools; then |
315 |
+ # build alternate faster + ~60% smaller binary for running |
316 |
+ # games or servers without game development debug paths |
317 |
+ escons extra_suffix=runner target=release tools=no "${esconsargs[@]}" |
318 |
+ fi |
319 |
+ |
320 |
+ esconsargs+=( |
321 |
+ # debug: debug for godot itself |
322 |
+ # release_debug: debug for game development |
323 |
+ # release: no debugging paths, only available with tools=no |
324 |
+ target=$(usex debug{,} $(usex tools release_debug release)) |
325 |
+ tools=$(usex tools) |
326 |
+ ) |
327 |
+ |
328 |
+ escons extra_suffix=main "${esconsargs[@]}" |
329 |
+} |
330 |
+ |
331 |
+src_install() { |
332 |
+ local s=godot${SLOT} |
333 |
+ |
334 |
+ newbin bin/godot*.main ${s} |
335 |
+ if use runner && use tools; then |
336 |
+ newbin bin/godot*.runner ${s}-runner |
337 |
+ else |
338 |
+ # always available, revdeps shouldn't depend on [runner] |
339 |
+ dosym ${s} /usr/bin/${s}-runner |
340 |
+ fi |
341 |
+ |
342 |
+ newman misc/dist/linux/godot.6 ${s}.6 |
343 |
+ dodoc AUTHORS.md CHANGELOG.md DONORS.md README.md |
344 |
+ |
345 |
+ if use gui; then |
346 |
+ newicon icon.svg ${s}.svg |
347 |
+ newmenu misc/dist/linux/org.godotengine.Godot.desktop \ |
348 |
+ org.godotengine.${s^}.desktop |
349 |
+ |
350 |
+ insinto /usr/share/metainfo |
351 |
+ newins misc/dist/linux/org.godotengine.Godot.appdata.xml \ |
352 |
+ org.godotengine.${s^}.appdata.xml |
353 |
+ |
354 |
+ insinto /usr/share/mime/application |
355 |
+ newins misc/dist/linux/org.godotengine.Godot.xml \ |
356 |
+ org.godotengine.${s^}.xml |
357 |
+ fi |
358 |
+ |
359 |
+ newbashcomp misc/dist/shell/godot.bash-completion ${s} |
360 |
+ bashcomp_alias ${s}{,-runner} |
361 |
+ |
362 |
+ insinto /usr/share/fish/vendor_completions.d |
363 |
+ newins misc/dist/shell/godot.fish ${s}.fish |
364 |
+ dosym ${s}.fish /usr/share/fish/vendor_completions.d/${s}-runner.fish |
365 |
+ |
366 |
+ insinto /usr/share/zsh/site-functions |
367 |
+ newins misc/dist/shell/_godot.zsh-completion _${s} |
368 |
+ dosym _${s} /usr/share/zsh/site-functions/_${s}-runner |
369 |
+} |
370 |
|
371 |
diff --git a/dev-games/godot/metadata.xml b/dev-games/godot/metadata.xml |
372 |
new file mode 100644 |
373 |
index 000000000000..71f596fee4e9 |
374 |
--- /dev/null |
375 |
+++ b/dev-games/godot/metadata.xml |
376 |
@@ -0,0 +1,34 @@ |
377 |
+<?xml version="1.0" encoding="UTF-8"?> |
378 |
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> |
379 |
+<pkgmetadata> |
380 |
+ <maintainer type="person"> |
381 |
+ <email>ionen@g.o</email> |
382 |
+ <name>Ionen Wolkens</name> |
383 |
+ </maintainer> |
384 |
+ <maintainer type="project"> |
385 |
+ <email>games@g.o</email> |
386 |
+ <name>Gentoo Games Project</name> |
387 |
+ </maintainer> |
388 |
+ <longdescription> |
389 |
+ Godot Engine is a feature-packed, cross-platform game engine |
390 |
+ to create 2D and 3D games from a unified interface. It provides |
391 |
+ a comprehensive set of common tools, so that users can focus on |
392 |
+ making games without having to reinvent the wheel. Games can be |
393 |
+ exported with one click to a number of platforms, including the |
394 |
+ major desktop platforms (Linux, macOS, Windows), mobile |
395 |
+ platforms (Android, iOS), as well as Web-based platforms (HTML5) |
396 |
+ and consoles. |
397 |
+ </longdescription> |
398 |
+ <use> |
399 |
+ <flag name="bullet">Enable the <pkg>sci-physics/bullet</pkg> module</flag> |
400 |
+ <flag name="deprecated">Enable support for deprecated features</flag> |
401 |
+ <flag name="raycast">Enable the raycast Editor module using <pkg>media-libs/embree</pkg></flag> |
402 |
+ <flag name="runner">Build an additional binary optimized for running games (only relevant with USE=tools)</flag> |
403 |
+ <flag name="tools">Enable the Godot Editor for game development</flag> |
404 |
+ <flag name="webm">Enable the WebM module</flag> |
405 |
+ </use> |
406 |
+ <upstream> |
407 |
+ <doc>https://docs.godotengine.org/</doc> |
408 |
+ <remote-id type="github">godotengine/godot</remote-id> |
409 |
+ </upstream> |
410 |
+</pkgmetadata> |