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: 1614553467.d0cdd28cee7b12f4fe2e10949af2abb94f3533c5.sam@gentoo
1 commit: d0cdd28cee7b12f4fe2e10949af2abb94f3533c5
2 Author: Wolf-Dieter Rieck <wesen42 <AT> web <DOT> de>
3 AuthorDate: Mon Feb 22 21:19:08 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 28 23:04:27 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0cdd28c
7
8 games-strategy/0ad: fix build and merge 0ad-data package
9
10 * Build was broken in former revision,
11 as generated libs weren't in LD_LIBRARY_PATH.
12 Also libs weren't correcly installed.
13
14 * 0ad-data pulled same archive as 0a package.
15 Merged both ebuilds into this revision blocking the 0ad-data package.
16
17 Bug: https://bugs.gentoo.org/768930
18 Closes: https://bugs.gentoo.org/771147
19 Package-Manager: Portage-3.0.13, Repoman-3.0.2
20 Signed-off-by: Wolf-Dieter Rieck <wesen42 <AT> web.de>
21 Closes: https://github.com/gentoo/gentoo/pull/19603
22 Signed-off-by: Sam James <sam <AT> gentoo.org>
23
24 .../0ad-0.0.24_alpha_pre20210116040036-r2.ebuild | 224 +++++++++++++++++++++
25 1 file changed, 224 insertions(+)
26
27 diff --git a/games-strategy/0ad/0ad-0.0.24_alpha_pre20210116040036-r2.ebuild b/games-strategy/0ad/0ad-0.0.24_alpha_pre20210116040036-r2.ebuild
28 new file mode 100644
29 index 00000000000..7826f504366
30 --- /dev/null
31 +++ b/games-strategy/0ad/0ad-0.0.24_alpha_pre20210116040036-r2.ebuild
32 @@ -0,0 +1,224 @@
33 +# Copyright 2014-2021 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +WX_GTK_VER="3.0-gtk3"
39 +inherit desktop toolchain-funcs wxwidgets xdg
40 +
41 +if [[ ${PV} == 9999 ]]; then
42 + inherit git-r3
43 +
44 + EGIT_REPO_URI="https://github.com/0ad/0ad"
45 + ZEROAD_GIT_REVISION=""
46 +elif [[ ${PV} == *_pre* ]]; then
47 + ZEROAD_GIT_REVISION="c7d07d3979f969b969211a5e5748fa775f6768a7"
48 +else
49 + MY_P="0ad-${PV/_/-}"
50 +fi
51 +
52 +DESCRIPTION="A free, real-time strategy game"
53 +HOMEPAGE="https://play0ad.com/"
54 +if [[ ${PV} == 9999 ]]; then
55 + SRC_URI=""
56 +elif [[ ${PV} == *_pre* ]]; then
57 + SRC_URI="https://github.com/0ad/0ad/archive/${ZEROAD_GIT_REVISION}.tar.gz -> ${P}.tar.gz"
58 +else
59 + SRC_URI="http://releases.wildfiregames.com/${MY_P}-unix-build.tar.xz"
60 +fi
61 +
62 +# merged with 0ad-data
63 +# addresses comment #3
64 +# bug #771147
65 +LICENSE="CC-BY-SA-3.0 GPL-2 LGPL-2.1 MIT ZLIB BitstreamVera LPPL-1.3c"
66 +SLOT="0"
67 +KEYWORDS="~amd64 ~x86"
68 +IUSE="editor +lobby nvtt pch test"
69 +RESTRICT="test"
70 +
71 +BDEPEND="virtual/pkgconfig
72 + test? ( dev-lang/perl )"
73 +
74 +# remove dependency on nvtt
75 +# as we use the bundled one
76 +# bug #768930
77 +DEPEND="
78 + dev-libs/boost:=
79 + dev-libs/icu:=
80 + dev-libs/libfmt:0=
81 + dev-libs/libsodium
82 + dev-libs/libxml2
83 + media-libs/libpng:0
84 + media-libs/libsdl2[X,opengl,video]
85 + media-libs/libvorbis
86 + media-libs/openal
87 + net-libs/enet:1.3
88 + net-libs/miniupnpc:=
89 + net-misc/curl
90 + sys-libs/zlib
91 + virtual/opengl
92 + x11-libs/libX11
93 + editor? ( x11-libs/wxGTK:${WX_GTK_VER}[X,opengl] )
94 + lobby? ( >=net-libs/gloox-1.0.20 )"
95 +
96 +# add block on 0ad-data, as it is no longer needed.
97 +# addresses comment #3
98 +# bug #771147
99 +RDEPEND="${DEPEND}
100 + !games-strategy/0ad-data"
101 +
102 +if [[ ${PV} == 9999 ]]; then
103 + S="${WORKDIR}/${P}"
104 +elif [[ ${PV} == *_pre* ]]; then
105 + S="${WORKDIR}/${PN}-${ZEROAD_GIT_REVISION}"
106 +else
107 + S="${WORKDIR}/${MY_P}"
108 +fi
109 +
110 +PATCHES=(
111 + "${FILESDIR}/${PN}-0.0.24_alpha_pre20210116040036-build.patch"
112 +)
113 +
114 +pkg_setup() {
115 + use editor && setup-wxwidgets
116 +}
117 +
118 +src_prepare() {
119 + default
120 +
121 + sed -i -e "/--build/d" libraries/source/spidermonkey/build.sh || die
122 +
123 + # merged from 0ad-data
124 + # addresses comment #3
125 + # bug #771147
126 + rm binaries/data/tools/fontbuilder/fonts/*.txt || die
127 +}
128 +
129 +src_configure() {
130 + local myconf=(
131 + --minimal-flags
132 + $(usex nvtt "" "--without-nvtt")
133 + $(usex pch "" "--without-pch")
134 + $(usex test "" "--without-tests")
135 + $(usex editor "--atlas" "")
136 + $(usex lobby "" "--without-lobby")
137 + --bindir="/usr/bin"
138 + --libdir="/usr/$(get_libdir)"/${PN}
139 + --datadir="/usr/share/${PN}"
140 + )
141 +
142 + tc-export CC CXX
143 +
144 + # stock premake5 does not work, use the shipped one
145 + emake -C "${S}"/build/premake/premake5/build/gmake2.unix
146 +
147 + # regenerate scripts.c so our patch applies
148 + cd "${S}"/build/premake/premake5 || die
149 + "${S}"/build/premake/premake5/bin/release/premake5 embed || die
150 +
151 + # rebuild premake again... this is the most stupid build system
152 + emake -C "${S}"/build/premake/premake5/build/gmake2.unix clean
153 + emake -C "${S}"/build/premake/premake5/build/gmake2.unix
154 +
155 + # run premake to create build scripts
156 + cd "${S}"/build/premake || die
157 + "${S}"/build/premake/premake5/bin/release/premake5 \
158 + --file="premake5.lua" \
159 + --outpath="../workspaces/gcc/" \
160 + --os=linux \
161 + "${myconf[@]}" \
162 + gmake2 || die "Premake failed"
163 +}
164 +
165 +src_compile() {
166 + tc-export AR
167 +
168 + # build 3rd party fcollada
169 + einfo "Building bundled fcollada"
170 + emake -C libraries/source/fcollada/src
171 +
172 + # build bundled nvtt
173 + # nvtt is abandoned upstream and 0ad have forked it
174 + # and added fixes. Use their copy.
175 + # bug #768930
176 + if use nvtt ; then
177 + cd libraries/source/nvtt || die
178 + elog "Building bundled nvtt (bug #768930)"
179 + ./build.sh || die "Failed to build bundled nvtt"
180 + cd "${S}" || die
181 + fi
182 +
183 + # build bundled spidermonkey
184 + # We genuinely can't use the system SpiderMonkey right now.
185 + # Breakages occur even on minor bumps in upstream SM,
186 + # e.g. bug #768840.
187 + cd libraries/source/spidermonkey || die
188 + elog "Building bundled SpiderMonkey (bug #768840)"
189 + XARGS="${EPREFIX}/usr/bin/xargs" ./build.sh || die "Failed to build bundled SpiderMonkey"
190 + cd "${S}" || die
191 +
192 + # build 0ad
193 + elog "Building 0ad"
194 + emake -C build/workspaces/gcc verbose=1
195 +
196 + # merged from 0ad-data
197 + # addresses comment #3
198 + # bug #771147
199 + if [[ ${PV} == 9999 || ${PV} == *_pre* ]]; then
200 + # source/lib/sysdep/os/linux/ldbg.cpp:debug_SetThreadName() tries to open /proc/self/task/${TID}/comm for writing.
201 + addpredict /proc/self/task
202 +
203 + # Based on source/tools/dist/build-archives.sh used by source/tools/dist/build.sh.
204 + local archivebuild_input archivebuild_output mod_name
205 + for archivebuild_input in binaries/data/mods/[A-Za-z0-9]*; do
206 + mod_name="${archivebuild_input##*/}"
207 + archivebuild_output="archives/${mod_name}"
208 +
209 + mkdir -p "${archivebuild_output}"
210 +
211 + einfo pyrogenesis -archivebuild="${archivebuild_input}" -archivebuild-output="${archivebuild_output}/${mod_name}.zip"
212 + LD_LIBRARY_PATH="binaries/system" binaries/system/pyrogenesis -archivebuild="${archivebuild_input}" -archivebuild-output="${archivebuild_output}/${mod_name}.zip" || die
213 +
214 + if [[ -f "${archivebuild_input}/mod.json" ]]; then
215 + cp "${archivebuild_input}/mod.json" "${archivebuild_output}"
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 "test phase failed"
231 +}
232 +
233 +src_install() {
234 + newbin binaries/system/pyrogenesis 0ad
235 + use editor && newbin binaries/system/ActorEditor 0ad-ActorEditor
236 +
237 + # merged with 0ad-data
238 + # addresses comment #3
239 + # bug #771147
240 + insinto /usr/share/${PN}
241 + doins -r binaries/data/{l10n,config,mods,tools}
242 +
243 + # merged with 0ad-data
244 + # addresses comment #3
245 + # bug #771147
246 + # install bundled SpiderMonkey and nvtt
247 + # fixes comment #1
248 + # bug #771147
249 + exeinto /usr/$(get_libdir)/${PN}
250 + doexe binaries/system/{libCollada,libmozjs78-ps-release,libnvtt,libnvcore,libnvimage,libnvmath}.so
251 + use editor && doexe binaries/system/libAtlasUI.so
252 +
253 + dodoc binaries/system/readme.txt
254 + doicon -s 128 build/resources/${PN}.png
255 + make_desktop_entry ${PN}
256 +}