Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-fps/gzdoom/, games-fps/gzdoom/files/
Date: Wed, 06 Jul 2022 22:46:11
Message-Id: 1657147535.6d678996b67e8cf3150d03fb17067754587f42d7.chewi@gentoo
1 commit: 6d678996b67e8cf3150d03fb17067754587f42d7
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 6 22:45:35 2022 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 6 22:45:35 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d678996
7
8 games-fps/gzdoom: Version bump to 4.8.2
9
10 Upstream broke this for distros in 4.8.0. This still hasn't been properly fixed,
11 so we just have to revert the breaking commit in the meantime. OpenSUSE has
12 already done the same for a while.
13
14 Upstream has seemingly also dropped support for 32-bit platforms. OpenSUSE is
15 reverting the line that prevents the build for working, but I'm trying to find
16 out more from upstream before we take action.
17
18 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
19
20 games-fps/gzdoom/Manifest | 1 +
21 ...rt-load-the-hex-font-as-early-as-possible.patch | 129 +++++++++++++++++++++
22 games-fps/gzdoom/gzdoom-4.8.2.ebuild | 85 ++++++++++++++
23 3 files changed, 215 insertions(+)
24
25 diff --git a/games-fps/gzdoom/Manifest b/games-fps/gzdoom/Manifest
26 index 9712094c2ea3..3fad5682d972 100644
27 --- a/games-fps/gzdoom/Manifest
28 +++ b/games-fps/gzdoom/Manifest
29 @@ -1 +1,2 @@
30 DIST gzdoom-4.7.1.tar.gz 19562412 BLAKE2B 48b089c9d0ca0f26820ea90ea1a1a6ce3fa325f6f7bd36ded66ba43eeaab610ca99eacb1ca0aec75b0888a65108573e2c85d2ce0e88663031583267f1143386e SHA512 040a51d2783616cca9f3d7e70bf83adf0d6afa8d7378a9f743cbf152811c07c4f03eecdbbdb617d9fda625049a6f13313dce6e5017698bf36fae74e107c012f0
31 +DIST gzdoom-4.8.2.tar.gz 24247668 BLAKE2B b9a505c29d14486bec96f53f614968c67ec0d8db0b784071d171038dec3a88c800483211e4ba59e8408ce5680f4800cbc455b4a53becd53e89bde17c7b7a69a5 SHA512 5f94aca016e87c8284b41d5c3beaeb752a4201e4562a528375addc976c7d7163d23a4885a223e4377856a2b75b71179efa80e99baf3edfe87fa19cf1e8bbfa42
32
33 diff --git a/games-fps/gzdoom/files/0001-Revert-load-the-hex-font-as-early-as-possible.patch b/games-fps/gzdoom/files/0001-Revert-load-the-hex-font-as-early-as-possible.patch
34 new file mode 100644
35 index 000000000000..58a2f7a2b2f4
36 --- /dev/null
37 +++ b/games-fps/gzdoom/files/0001-Revert-load-the-hex-font-as-early-as-possible.patch
38 @@ -0,0 +1,129 @@
39 +From 2d00bc6b9f25ae045eecba6e198eaceee9046647 Mon Sep 17 00:00:00 2001
40 +From: James Le Cuirot <chewi@g.o>
41 +Date: Wed, 6 Jul 2022 23:37:30 +0100
42 +Subject: [PATCH] Revert "- load the hex font as early as possible."
43 +
44 +This reverts commit 010f41a3aad3719b1e5d4d8ce157a5d9b0077b44.
45 +
46 +Bug: https://github.com/coelckers/gzdoom/issues/1615
47 +---
48 + src/common/fonts/hexfont.cpp | 24 +++++++-----------------
49 + src/d_main.cpp | 17 +++++++----------
50 + 2 files changed, 14 insertions(+), 27 deletions(-)
51 +
52 +diff --git a/src/common/fonts/hexfont.cpp b/src/common/fonts/hexfont.cpp
53 +index 8b50427f4..e2bdbff7a 100644
54 +--- a/src/common/fonts/hexfont.cpp
55 ++++ b/src/common/fonts/hexfont.cpp
56 +@@ -58,12 +58,11 @@ struct HexDataSource
57 + //
58 + //==========================================================================
59 +
60 +- void ParseDefinition(FResourceLump* font)
61 ++ void ParseDefinition(int lumpnum)
62 + {
63 + FScanner sc;
64 +
65 +- auto data = font->Lock();
66 +- sc.OpenMem("newconsolefont.hex", (const char*)data, font->Size());
67 ++ sc.OpenLumpNum(lumpnum);
68 + sc.SetCMode(true);
69 + glyphdata.Push(0); // ensure that index 0 can be used as 'not present'.
70 + while (sc.GetString())
71 +@@ -97,7 +96,6 @@ struct HexDataSource
72 + lumb = i * 255 / 17;
73 + SmallPal[i] = PalEntry(255, lumb, lumb, lumb);
74 + }
75 +- font->Unlock();
76 + }
77 + };
78 +
79 +@@ -402,7 +400,7 @@ public:
80 +
81 + FFont *CreateHexLumpFont (const char *fontname, int lump)
82 + {
83 +- assert(hexdata.FirstChar != INT_MAX);
84 ++ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump);
85 + return new FHexFont(fontname, lump);
86 + }
87 +
88 +@@ -414,7 +412,7 @@ FFont *CreateHexLumpFont (const char *fontname, int lump)
89 +
90 + FFont *CreateHexLumpFont2(const char *fontname, int lump)
91 + {
92 +- assert(hexdata.FirstChar != INT_MAX);
93 ++ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump);
94 + return new FHexFont2(fontname, lump);
95 + }
96 +
97 +@@ -426,7 +424,8 @@ FFont *CreateHexLumpFont2(const char *fontname, int lump)
98 +
99 + uint8_t* GetHexChar(int codepoint)
100 + {
101 +- assert(hexdata.FirstChar != INT_MAX);
102 ++ auto lump = fileSystem.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements.
103 ++ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump);
104 +
105 + if (hexdata.glyphmap[codepoint] > 0)
106 + {
107 +@@ -434,13 +433,4 @@ uint8_t* GetHexChar(int codepoint)
108 + return &hexdata.glyphdata[offset];
109 + }
110 + return nullptr;
111 +-}
112 +-
113 +-void LoadHexFont(const char* filename)
114 +-{
115 +- auto resf = FResourceFile::OpenResourceFile(filename);
116 +- if (resf == nullptr) I_FatalError("Unable to open %s", filename);
117 +- auto hexfont = resf->FindLump("newconsolefont.hex");
118 +- if (hexfont == nullptr) I_FatalError("Unable to find newconsolefont.hex in %s", filename);
119 +- hexdata.ParseDefinition(hexfont);
120 +-}
121 ++}
122 +\ No newline at end of file
123 +diff --git a/src/d_main.cpp b/src/d_main.cpp
124 +index b64142c07..d61807012 100644
125 +--- a/src/d_main.cpp
126 ++++ b/src/d_main.cpp
127 +@@ -175,7 +175,6 @@ void FreeSBarInfoScript();
128 + void I_UpdateWindowTitle();
129 + void S_ParseMusInfo();
130 + void D_GrabCVarDefaults();
131 +-void LoadHexFont(const char* filename);
132 +
133 + // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
134 +
135 +@@ -3535,15 +3534,6 @@ static int D_DoomMain_Internal (void)
136 + std::set_new_handler(NewFailure);
137 + const char *batchout = Args->CheckValue("-errorlog");
138 +
139 +- // [RH] Make sure zdoom.pk3 is always loaded,
140 +- // as it contains magic stuff we need.
141 +- wad = BaseFileSearch(BASEWAD, NULL, true, GameConfig);
142 +- if (wad == NULL)
143 +- {
144 +- I_FatalError("Cannot find " BASEWAD);
145 +- }
146 +- LoadHexFont(wad); // load hex font early so we have it during startup.
147 +-
148 + C_InitConsole(80*8, 25*8, false);
149 + I_DetectOS();
150 +
151 +@@ -3573,6 +3563,13 @@ static int D_DoomMain_Internal (void)
152 + extern void D_ConfirmSendStats();
153 + D_ConfirmSendStats();
154 +
155 ++ // [RH] Make sure zdoom.pk3 is always loaded,
156 ++ // as it contains magic stuff we need.
157 ++ wad = BaseFileSearch (BASEWAD, NULL, true, GameConfig);
158 ++ if (wad == NULL)
159 ++ {
160 ++ I_FatalError ("Cannot find " BASEWAD);
161 ++ }
162 + FString basewad = wad;
163 +
164 + FString optionalwad = BaseFileSearch(OPTIONALWAD, NULL, true, GameConfig);
165 +--
166 +2.35.1
167 +
168
169 diff --git a/games-fps/gzdoom/gzdoom-4.8.2.ebuild b/games-fps/gzdoom/gzdoom-4.8.2.ebuild
170 new file mode 100644
171 index 000000000000..f697ad1bc5eb
172 --- /dev/null
173 +++ b/games-fps/gzdoom/gzdoom-4.8.2.ebuild
174 @@ -0,0 +1,85 @@
175 +# Copyright 1999-2022 Gentoo Authors
176 +# Distributed under the terms of the GNU General Public License v2
177 +
178 +EAPI=8
179 +
180 +inherit cmake desktop xdg flag-o-matic
181 +
182 +DESCRIPTION="A modder-friendly OpenGL source port based on the DOOM engine"
183 +HOMEPAGE="https://zdoom.org"
184 +SRC_URI="https://github.com/coelckers/${PN}/archive/g${PV}.tar.gz -> ${P}.tar.gz"
185 +
186 +LICENSE="Apache-2.0 BSD BZIP2 GPL-3 LGPL-2.1+ LGPL-3 MIT
187 + non-free? ( Activision ChexQuest3 DOOM-COLLECTORS-EDITION freedist WidePix )"
188 +SLOT="0"
189 +KEYWORDS="~amd64"
190 +IUSE="debug gles2 gtk +non-free openmp telemetry vulkan"
191 +
192 +DEPEND="
193 + app-arch/bzip2
194 + media-libs/libjpeg-turbo:0=
195 + media-libs/libsdl2[gles2?,opengl,vulkan?]
196 + media-libs/libvpx:=
197 + media-libs/openal
198 + media-libs/zmusic
199 + sys-libs/zlib
200 + gtk? ( x11-libs/gtk+:3 )"
201 +RDEPEND="${DEPEND}"
202 +
203 +S="${WORKDIR}/${PN}-g${PV}"
204 +
205 +PATCHES=(
206 + "${FILESDIR}"/${PN}-4.7.1-Introduce-the-BUILD_NONFREE-option.patch
207 + "${FILESDIR}"/0001-Revert-load-the-hex-font-as-early-as-possible.patch
208 +)
209 +
210 +src_prepare() {
211 + rm -rf docs/licenses || die
212 + rm -rf libraries/{bzip2,jpeg,zlib} || die
213 + if ! use non-free ; then
214 + rm -rf wadsrc_bm wadsrc_extra wadsrc_widepix || die
215 + fi
216 +
217 + cmake_src_prepare
218 +}
219 +
220 +src_configure() {
221 + local mycmakeargs=(
222 + -DBUILD_SHARED_LIBS=OFF
223 + -DINSTALL_DOCS_PATH="${EPREFIX}/usr/share/doc/${PF}"
224 + -DINSTALL_PK3_PATH="${EPREFIX}/usr/share/doom"
225 + -DINSTALL_SOUNDFONT_PATH="${EPREFIX}/usr/share/doom"
226 + -DDYN_OPENAL=OFF
227 + -DNO_GTK="$(usex !gtk)"
228 + -DNO_OPENAL=OFF
229 + -DHAVE_VULKAN="$(usex vulkan)"
230 + -DHAVE_GLES2="$(usex gles2)"
231 + -DNO_OPENMP="$(usex !openmp)"
232 + -DBUILD_NONFREE="$(usex non-free)"
233 + )
234 +
235 + use debug || append-cppflags -DNDEBUG
236 + use telemetry || append-cppflags -DNO_SEND_STATS
237 +
238 + cmake_src_configure
239 +}
240 +
241 +src_install() {
242 + newicon src/posix/zdoom.xpm "${PN}.xpm"
243 + make_desktop_entry "${PN}" "GZDoom" "${PN}" "Game;ActionGame"
244 + cmake_src_install
245 +}
246 +
247 +pkg_postinst() {
248 + xdg_pkg_postinst
249 +
250 + if ! use non-free ; then
251 + ewarn
252 + ewarn "GZDoom installed without non-free components."
253 + ewarn "Note: The non-free game_support.pk3 file is needed to play"
254 + ewarn " games natively supported by GZDoom."
255 + ewarn "A list of games natively supported by GZDoom is available"
256 + ewarn "on the ZDoom wiki: https://zdoom.org/wiki/IWAD"
257 + ewarn
258 + fi
259 +}