Diff godot-3.5.3 with a godot-4.0.4

/usr/portage/dev-games/godot/godot-4.0.4.ebuild 2023-10-09 14:52:29.360368347 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
PYTHON_COMPAT=( python3_{10..11} )
6
PYTHON_COMPAT=( python3_{9..11} )
7 7
inherit bash-completion-r1 desktop python-any-r1 scons-utils toolchain-funcs xdg
8 8

  
9 9
DESCRIPTION="Multi-platform 2D and 3D game engine with a feature-rich editor"
10 10
HOMEPAGE="https://godotengine.org/"
11 11
SRC_URI="
12 12
	https://downloads.tuxfamily.org/godotengine/${PV}/${P}-stable.tar.xz
13
	https://github.com/godotengine/godot/releases/download/${PV}-stable/${P}-stable.tar.xz
14
"
13
	https://github.com/godotengine/godot/releases/download/${PV}-stable/${P}-stable.tar.xz"
15 14
S="${WORKDIR}/${P}-stable"
16 15

  
17 16
LICENSE="
18 17
	MIT
19 18
	Apache-2.0 BSD Boost-1.0 CC0-1.0 Unlicense ZLIB
20
	gui? ( CC-BY-4.0 ) tools? ( BitstreamVera OFL-1.1 )
21
"
22
SLOT="3"
19
	gui? ( CC-BY-4.0 ) tools? ( OFL-1.1 )"
20
SLOT="4"
23 21
KEYWORDS="~amd64"
24 22
# Enable roughly same as upstream by default so it works as expected,
25 23
# except raycast (tools-only heavy dependency), and deprecated.
26 24
IUSE="
27
	+bullet debug deprecated +gui pulseaudio raycast +runner +theora
28
	+tools +udev +upnp +webm +webp
29
"
25
	alsa +dbus debug deprecated +fontconfig +gui pulseaudio raycast
26
	+runner speech test +theora +tools +udev +upnp +vulkan +webp"
27
# TODO: tests still need more figuring out
28
RESTRICT="test"
30 29

  
31
# dlopen: alsa-lib,pulseaudio,udev
30
# dlopen: libglvnd
32 31
RDEPEND="
33 32
	app-arch/zstd:=
34 33
	dev-games/recastnavigation:=
34
	dev-libs/icu:=
35 35
	dev-libs/libpcre2:=[pcre32]
36
	media-libs/alsa-lib
37
	media-libs/freetype[brotli]
36
	media-libs/freetype[brotli,harfbuzz]
37
	media-libs/harfbuzz:=[icu]
38
	media-libs/libogg
38 39
	media-libs/libpng:=
40
	media-libs/libvorbis
39 41
	<net-libs/mbedtls-3:=
40 42
	net-libs/wslay
41 43
	sys-libs/zlib:=
42
	bullet? ( sci-physics/bullet:= )
44
	alsa? ( media-libs/alsa-lib )
45
	dbus? ( sys-apps/dbus )
46
	fontconfig? ( media-libs/fontconfig )
43 47
	gui? (
44 48
		media-libs/libglvnd
45 49
		x11-libs/libX11
......
49 53
		x11-libs/libXinerama
50 54
		x11-libs/libXrandr
51 55
		x11-libs/libXrender
56
		x11-libs/libxkbcommon
52 57
		tools? ( raycast? ( media-libs/embree:3 ) )
58
		vulkan? ( media-libs/vulkan-loader[X] )
53 59
	)
54 60
	pulseaudio? ( media-libs/libpulse )
55
	theora? (
56
		media-libs/libogg
57
		media-libs/libtheora
58
		media-libs/libvorbis
59
	)
61
	speech? ( app-accessibility/speech-dispatcher )
62
	theora? ( media-libs/libtheora )
60 63
	tools? ( app-misc/ca-certificates )
61 64
	udev? ( virtual/udev )
62 65
	upnp? ( net-libs/miniupnpc:= )
63
	webm? (
64
		media-libs/libvorbis
65
		media-libs/libvpx:=
66
		media-libs/opus
67
	)
68
	webp? ( media-libs/libwebp:= )
69
"
66
	webp? ( media-libs/libwebp:= )"
70 67
DEPEND="
71 68
	${RDEPEND}
72 69
	gui? ( x11-base/xorg-proto )
73
"
70
	tools? ( test? ( dev-cpp/doctest ) )"
74 71
BDEPEND="virtual/pkgconfig"
75 72

  
76 73
PATCHES=(
77
	"${FILESDIR}"/${PN}-3.5-musl.patch
78
	"${FILESDIR}"/${PN}-3.5-scons.patch
79
	"${FILESDIR}"/${PN}-3.5.3-gcc13.patch
74
	"${FILESDIR}"/${PN}-4.0_beta3-headless-header.patch
75
	"${FILESDIR}"/${PN}-4.0_rc2-musl.patch
76
	"${FILESDIR}"/${PN}-4.0_rc3-scons.patch
80 77
)
81 78

  
82 79
src_prepare() {
......
87 84
	sed -e "s/=godot/&${SLOT}/" -e "/^Name=/s/$/ ${SLOT}/" \
88 85
		-i misc/dist/linux/org.godotengine.Godot.desktop || die
89 86

  
90
	sed -i "s|pkg-config |$(tc-getPKG_CONFIG) |" platform/{x11,server}/detect.py || die
87
	sed -i "s|pkg-config |$(tc-getPKG_CONFIG) |" platform/linuxbsd/detect.py || die
91 88

  
92 89
	# use of builtin_ switches can be messy (see below), delete to be sure
93 90
	local unbundle=(
94
		bullet embree freetype libogg libpng libtheora libvorbis libvpx
95
		libwebp mbedtls miniupnpc opus pcre2 recastnavigation wslay zlib zstd
91
		doctest embree freetype graphite harfbuzz icu4c libogg
92
		libpng libtheora libvorbis libwebp linuxbsd_headers mbedtls
93
		miniupnpc pcre2 recastnavigation volk wslay zlib zstd
96 94
		# certs: unused by generated header, but scons panics if not found
97 95
	)
98 96
	rm -r "${unbundle[@]/#/thirdparty/}" || die
97

  
98
	ln -s "${ESYSROOT}"/usr/include/doctest thirdparty/ || die
99 99
}
100 100

  
101 101
src_compile() {
......
104 104
	local esconsargs=(
105 105
		AR="$(tc-getAR)" CC="$(tc-getCC)" CXX="$(tc-getCXX)"
106 106

  
107
		platform=$(usex gui x11 server)
108 107
		progress=no
109 108
		verbose=yes
110 109

  
110
		use_sowrap=no
111

  
112
		alsa=$(usex alsa)
113
		dbus=$(usex dbus)
111 114
		deprecated=$(usex deprecated)
112
		#execinfo=$(usex !elibc_glibc) # libexecinfo is not packaged
113
		minizip=yes # uses a modified bundled copy
115
		fontconfig=$(usex fontconfig)
116
		opengl3=$(usex gui)
114 117
		pulseaudio=$(usex pulseaudio)
118
		speechd=$(usex speech)
115 119
		udev=$(usex udev)
120
		use_volk=no # unnecessary when linking directly to libvulkan
121
		vulkan=$(usex gui $(usex vulkan))
122
		x11=$(usex gui)
116 123

  
117 124
		system_certs_path="${EPREFIX}"/etc/ssl/certs/ca-certificates.crt
118 125

  
119 126
		# platform/*/detect.py uses builtin_* switches to check if need
120 127
		# to link with system libraries, but ignores whether the dep is
121 128
		# actually used, so "enable" deleted builtins on disabled deps
122
		builtin_bullet=$(usex !bullet)
123 129
		builtin_certs=no
124 130
		builtin_embree=$(usex !gui yes $(usex !tools yes $(usex !raycast)))
125 131
		builtin_enet=yes # bundled copy is patched for IPv6+DTLS support
126 132
		builtin_freetype=no
127
		builtin_libogg=yes # unused
133
		builtin_glslang=yes #879111 (for now, may revisit if more stable)
134
		builtin_graphite=no
135
		builtin_harfbuzz=no
136
		builtin_icu4c=no
137
		builtin_libogg=no
128 138
		builtin_libpng=no
129 139
		builtin_libtheora=$(usex !theora)
130
		builtin_libvorbis=$(usex !theora $(usex !webm))
131
		builtin_libvpx=$(usex !webm)
140
		builtin_libvorbis=no
132 141
		builtin_libwebp=$(usex !webp)
133 142
		builtin_mbedtls=no
134 143
		builtin_miniupnpc=$(usex !upnp)
135
		builtin_opus=$(usex !webm)
144
		builtin_msdfgen=yes # not wired for unbundling nor packaged
136 145
		builtin_pcre2=no
137
		builtin_recast=no
146
		builtin_recastnavigation=no
138 147
		builtin_rvo2=yes # bundled copy has godot-specific changes
139 148
		builtin_squish=yes # ^ likewise, may not be safe to unbundle
140 149
		builtin_wslay=no
......
145 154

  
146 155
		# modules with optional dependencies, "possible" to disable more but
147 156
		# gets messy and breaks all sorts of features (expected enabled)
148
		module_bullet_enabled=$(usex bullet)
149 157
		module_mono_enabled=no # unhandled
150
		module_ogg_enabled=no # unused
151
		module_opus_enabled=no # unused, support is gone and webm uses system's
152
		# note raycast is disabled on many arches, see raycast/config.py
158
		# note raycast is only enabled on amd64+arm64, see raycast/config.py
153 159
		module_raycast_enabled=$(usex gui $(usex tools $(usex raycast)))
154 160
		module_theora_enabled=$(usex theora)
155 161
		module_upnp_enabled=$(usex upnp)
156
		module_vorbis_enabled=no # unused, non-theora/webm uses stb_vorbis
157
		module_webm_enabled=$(usex webm)
158 162
		module_webp_enabled=$(usex webp)
159 163

  
160 164
		# let *FLAGS handle these, e.g. can pass -flto as-is
161 165
		debug_symbols=no
162
		optimize=none
163
		use_lto=no
166
		lto=none
167
		optimize=custom
164 168
		use_static_cpp=no
165 169
	)
166 170

  
167 171
	if use runner && use tools; then
168 172
		# build alternate faster + ~60% smaller binary for running
169 173
		# games or servers without game development debug paths
170
		escons extra_suffix=runner target=release tools=no "${esconsargs[@]}"
174
		escons extra_suffix=runner target=template_release "${esconsargs[@]}"
171 175
	fi
172 176

  
173 177
	esconsargs+=(
174
		# debug: debug for godot itself
175
		# release_debug: debug for game development
176
		# release: no debugging paths, only available with tools=no
177
		target=$(usex debug{,} $(usex tools release_debug release))
178
		tools=$(usex tools)
178
		target=$(usex tools editor template_$(usex debug{,} release))
179
		dev_build=$(usex debug)
180

  
181
		# harmless but note this bakes in --test in the final binary
182
		tests=$(usex tools $(usex test))
179 183
	)
180 184

  
181 185
	escons extra_suffix=main "${esconsargs[@]}"
182 186
}
183 187

  
188
src_test() {
189
	xdg_environment_reset
190
	bin/godot*.main --headless --test || die
191
}
192

  
184 193
src_install() {
185 194
	local s=godot${SLOT}
186 195

  
Thank you!