Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-strategy/0ad/
Date: Sun, 28 Feb 2021 23:04:47
Message-Id: 1614553468.750a1ce1cc28dc679c08b1456a83c4c8542bb526.sam@gentoo
1 commit: 750a1ce1cc28dc679c08b1456a83c4c8542bb526
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 28 22:27:30 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 28 23:04:28 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=750a1ce1
7
8 games-strategy/0ad: bump to 0.0.24b_alpha
9
10 Huge thanks to everybody mentioned in this commit
11 (and likely others too, sorry if I forgot you!)
12
13 This started with Arfrever giving an initial bump,
14 then several revisions later, we seem to be in a position
15 where it's fully working!
16
17 Most of the issues came from (de)bundling SpiderMonkey
18 and NVTT:
19
20 * New SpiderMonkey releases regularly break the APIs
21 which 0ad uses, so we're reverting to the bundled
22 copy per upstream advice;
23
24 * NVTT has been abandoned upstream (as an independent project)
25 so the 0ad developers have taken it over and applied significant
26 patches. We use the bundled copy now to take advantage of these
27 fixes.
28
29 We also abandon 0ad-data for now. We're now using the released
30 asset files for 0.0.24b_alpha but the 0ad ebuild itself, thanks to
31 Wolf-Dieter, can now generate these assets rather than relying
32 on a separate ebuild like 0ad-data. This simplifies matters.
33
34 Closes: https://bugs.gentoo.org/735352
35 Thanks-to: Stanislas Dolcini <stan at wildfiregames dot com>
36 Thanks-to: Wolf-Dieter Rieck <wesen42 <AT> web.de>
37 Thanks-to: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail.com>
38 Thanks-to: Quentin Retornaz <gentoo <AT> retornaz.com>
39 Signed-off-by: Sam James <sam <AT> gentoo.org>
40
41 games-strategy/0ad/0ad-0.0.24b_alpha.ebuild | 226 ++++++++++++++++++++++++++++
42 1 file changed, 226 insertions(+)
43
44 diff --git a/games-strategy/0ad/0ad-0.0.24b_alpha.ebuild b/games-strategy/0ad/0ad-0.0.24b_alpha.ebuild
45 new file mode 100644
46 index 00000000000..436db366fb5
47 --- /dev/null
48 +++ b/games-strategy/0ad/0ad-0.0.24b_alpha.ebuild
49 @@ -0,0 +1,226 @@
50 +# Copyright 2014-2021 Gentoo Authors
51 +# Distributed under the terms of the GNU General Public License v2
52 +
53 +EAPI=7
54 +
55 +WX_GTK_VER="3.0-gtk3"
56 +
57 +inherit desktop toolchain-funcs wxwidgets xdg
58 +
59 +if [[ ${PV} == 9999 ]]; then
60 + inherit git-r3
61 +
62 + EGIT_REPO_URI="https://github.com/0ad/0ad"
63 + ZEROAD_GIT_REVISION=""
64 +elif [[ ${PV} == *_pre* ]]; then
65 + ZEROAD_GIT_REVISION="c7d07d3979f969b969211a5e5748fa775f6768a7"
66 +else
67 + MY_P="0ad-${PV/_/-}"
68 +fi
69 +
70 +DESCRIPTION="A free, real-time strategy game"
71 +HOMEPAGE="https://play0ad.com/"
72 +if [[ ${PV} == 9999 ]]; then
73 + SRC_URI=""
74 +elif [[ ${PV} == *_pre* ]]; then
75 + SRC_URI="https://github.com/0ad/0ad/archive/${ZEROAD_GIT_REVISION}.tar.gz -> ${P}.tar.gz"
76 +else
77 + SRC_URI="http://releases.wildfiregames.com/${MY_P}-unix-build.tar.xz"
78 + SRC_URI+=" https://releases.wildfiregames.com/${MY_P}-unix-data.tar.xz"
79 +fi
80 +
81 +# merged with 0ad-data
82 +# addresses comment #3
83 +# bug #771147
84 +LICENSE="CC-BY-SA-3.0 GPL-2 LGPL-2.1 MIT ZLIB BitstreamVera LPPL-1.3c"
85 +SLOT="0"
86 +KEYWORDS="~amd64 ~x86"
87 +IUSE="editor +lobby nvtt pch test"
88 +RESTRICT="test"
89 +
90 +BDEPEND="virtual/pkgconfig
91 + test? ( dev-lang/perl )"
92 +
93 +# remove dependency on nvtt
94 +# as we use the bundled one
95 +# bug #768930
96 +DEPEND="
97 + dev-libs/boost:=
98 + dev-libs/icu:=
99 + dev-libs/libfmt:0=
100 + dev-libs/libsodium
101 + dev-libs/libxml2
102 + media-libs/libpng:0
103 + media-libs/libsdl2[X,opengl,video]
104 + media-libs/libvorbis
105 + media-libs/openal
106 + net-libs/enet:1.3
107 + net-libs/miniupnpc:=
108 + net-misc/curl
109 + sys-libs/zlib
110 + virtual/opengl
111 + x11-libs/libX11
112 + editor? ( x11-libs/wxGTK:${WX_GTK_VER}[X,opengl] )
113 + lobby? ( >=net-libs/gloox-1.0.20 )"
114 +
115 +# add block on 0ad-data, as it is no longer needed.
116 +# addresses comment #3
117 +# bug #771147
118 +RDEPEND="${DEPEND}
119 + !games-strategy/0ad-data"
120 +
121 +if [[ ${PV} == 9999 ]]; then
122 + S="${WORKDIR}/${P}"
123 +elif [[ ${PV} == *_pre* ]]; then
124 + S="${WORKDIR}/${PN}-${ZEROAD_GIT_REVISION}"
125 +else
126 + S="${WORKDIR}/${MY_P}"
127 +fi
128 +
129 +PATCHES=(
130 + "${FILESDIR}/${PN}-0.0.24_alpha_pre20210116040036-build.patch"
131 +)
132 +
133 +pkg_setup() {
134 + use editor && setup-wxwidgets
135 +}
136 +
137 +src_prepare() {
138 + default
139 +
140 + sed -i -e "/--build/d" libraries/source/spidermonkey/build.sh || die
141 +
142 + # merged from 0ad-data
143 + # addresses comment #3
144 + # bug #771147
145 + rm binaries/data/tools/fontbuilder/fonts/*.txt || die
146 +}
147 +
148 +src_configure() {
149 + local myconf=(
150 + --minimal-flags
151 + $(usex nvtt "" "--without-nvtt")
152 + $(usex pch "" "--without-pch")
153 + $(usex test "" "--without-tests")
154 + $(usex editor "--atlas" "")
155 + $(usex lobby "" "--without-lobby")
156 + --bindir="/usr/bin"
157 + --libdir="/usr/$(get_libdir)"/${PN}
158 + --datadir="/usr/share/${PN}"
159 + )
160 +
161 + tc-export CC CXX
162 +
163 + # stock premake5 does not work, use the shipped one
164 + emake -C "${S}"/build/premake/premake5/build/gmake2.unix
165 +
166 + # regenerate scripts.c so our patch applies
167 + cd "${S}"/build/premake/premake5 || die
168 + "${S}"/build/premake/premake5/bin/release/premake5 embed || die
169 +
170 + # rebuild premake again... this is the most stupid build system
171 + emake -C "${S}"/build/premake/premake5/build/gmake2.unix clean
172 + emake -C "${S}"/build/premake/premake5/build/gmake2.unix
173 +
174 + # run premake to create build scripts
175 + cd "${S}"/build/premake || die
176 + "${S}"/build/premake/premake5/bin/release/premake5 \
177 + --file="premake5.lua" \
178 + --outpath="../workspaces/gcc/" \
179 + --os=linux \
180 + "${myconf[@]}" \
181 + gmake2 || die "Premake failed"
182 +}
183 +
184 +src_compile() {
185 + tc-export AR
186 +
187 + # build 3rd party fcollada
188 + einfo "Building bundled fcollada"
189 + emake -C libraries/source/fcollada/src
190 +
191 + # build bundled nvtt
192 + # nvtt is abandoned upstream and 0ad have forked it
193 + # and added fixes. Use their copy.
194 + # bug #768930
195 + if use nvtt ; then
196 + cd libraries/source/nvtt || die
197 + elog "Building bundled nvtt (bug #768930)"
198 + ./build.sh JOBS="-j3" || die "Failed to build bundled nvtt"
199 + cd "${S}" || die
200 + fi
201 +
202 + # build bundled spidermonkey
203 + # We genuinely can't use the system SpiderMonkey right now.
204 + # Breakages occur even on minor bumps in upstream SM,
205 + # e.g. bug #768840.
206 + cd libraries/source/spidermonkey || die
207 + elog "Building bundled SpiderMonkey (bug #768840)"
208 + XARGS="${EPREFIX}/usr/bin/xargs" ./build.sh JOBS="-j3" || die "Failed to build bundled SpiderMonkey"
209 + cd "${S}" || die
210 +
211 + # build 0ad
212 + elog "Building 0ad"
213 + emake -C build/workspaces/gcc verbose=1 JOBS="-j3"
214 +
215 + # merged from 0ad-data
216 + # addresses comment #3
217 + # bug #771147
218 + if [[ ${PV} == 9999 || ${PV} == *_pre* ]]; then
219 + # source/lib/sysdep/os/linux/ldbg.cpp:debug_SetThreadName() tries to open /proc/self/task/${TID}/comm for writing.
220 + addpredict /proc/self/task
221 +
222 + # Based on source/tools/dist/build-archives.sh used by source/tools/dist/build.sh.
223 + local archivebuild_input archivebuild_output mod_name
224 + for archivebuild_input in binaries/data/mods/[A-Za-z0-9]*; do
225 + mod_name="${archivebuild_input##*/}"
226 + archivebuild_output="archives/${mod_name}"
227 +
228 + mkdir -p "${archivebuild_output}"
229 +
230 + einfo pyrogenesis -archivebuild="${archivebuild_input}" -archivebuild-output="${archivebuild_output}/${mod_name}.zip"
231 + LD_LIBRARY_PATH="binaries/system" binaries/system/pyrogenesis -archivebuild="${archivebuild_input}" -archivebuild-output="${archivebuild_output}/${mod_name}.zip" || die
232 +
233 + if [[ -f "${archivebuild_input}/mod.json" ]]; then
234 + cp "${archivebuild_input}/mod.json" "${archivebuild_output}"
235 + fi
236 +
237 + rm -r "${archivebuild_input}" || die
238 + mv "${archivebuild_output}" "${archivebuild_input}" || die
239 + done
240 +
241 + # Based on source/tools/dist/build-unix-win32.sh used by source/tools/dist/build.sh.
242 + rm binaries/data/config/dev.cfg || die
243 + rm -r binaries/data/mods/_test.* || die
244 + fi
245 +}
246 +
247 +src_test() {
248 + cd binaries/system || die
249 + ./test -libdir "${S}/binaries/system" || die "test phase failed"
250 +}
251 +
252 +src_install() {
253 + newbin binaries/system/pyrogenesis 0ad
254 + use editor && newbin binaries/system/ActorEditor 0ad-ActorEditor
255 +
256 + # merged with 0ad-data
257 + # addresses comment #3
258 + # bug #771147
259 + insinto /usr/share/${PN}
260 + doins -r binaries/data/{l10n,config,mods,tools}
261 +
262 + # merged with 0ad-data
263 + # addresses comment #3
264 + # bug #771147
265 + # install bundled SpiderMonkey and nvtt
266 + # fixes comment #1
267 + # bug #771147
268 + exeinto /usr/$(get_libdir)/${PN}
269 + doexe binaries/system/{libCollada,libmozjs78-ps-release,libnvtt,libnvcore,libnvimage,libnvmath}.so
270 + use editor && doexe binaries/system/libAtlasUI.so
271 +
272 + dodoc binaries/system/readme.txt
273 + doicon -s 128 build/resources/${PN}.png
274 + make_desktop_entry ${PN}
275 +}