Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-games/t4k-common/, dev-games/t4k-common/files/
Date: Thu, 10 Jun 2021 11:52:43
Message-Id: 1623325902.c4993b6a7a6daa41d9b5b2efb53dc0a0f5e90d64.ionen@gentoo
1 commit: c4993b6a7a6daa41d9b5b2efb53dc0a0f5e90d64
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 9 11:43:55 2021 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 10 11:51:42 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4993b6a
7
8 dev-games/t4k-common: svg, text, and build fix
9
10 Three patches fix:
11 - tuxmath[svg] crash (bug #763591)
12 - tuxmath lacking text with current libsdl
13 - set_font_size build (bug #759574)
14
15 Bug: https://bugs.gentoo.org/763591
16 Closes: https://bugs.gentoo.org/759574
17 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
18
19 .../files/t4k-common-0.1.1-fix-declaration.patch | 10 +++
20 .../files/t4k-common-0.1.1-missing-text.patch | 14 +++++
21 .../files/t4k-common-0.1.1-svg-libxml2.patch | 73 ++++++++++++++++++++++
22 dev-games/t4k-common/t4k-common-0.1.1-r1.ebuild | 65 +++++++++++++++++++
23 4 files changed, 162 insertions(+)
24
25 diff --git a/dev-games/t4k-common/files/t4k-common-0.1.1-fix-declaration.patch b/dev-games/t4k-common/files/t4k-common-0.1.1-fix-declaration.patch
26 new file mode 100644
27 index 00000000000..8b1188039f4
28 --- /dev/null
29 +++ b/dev-games/t4k-common/files/t4k-common-0.1.1-fix-declaration.patch
30 @@ -0,0 +1,10 @@
31 +https://bugs.gentoo.org/759574
32 +--- a/src/t4k_menu.c 2013-12-02 10:50:23.000000000 -0500
33 ++++ b/src/t4k_menu.c 2021-01-04 19:49:20.561524579 -0500
34 +@@ -152,5 +152,5 @@
35 + char* find_longest_text(MenuNode* menu, int* length);
36 + int find_longest_menu_page(MenuNode* menu);
37 +-void set_font_size();
38 ++void set_font_size(bool uniform);
39 + void prerender_menu(MenuNode* menu);
40 + int min(int a, int b);
41
42 diff --git a/dev-games/t4k-common/files/t4k-common-0.1.1-missing-text.patch b/dev-games/t4k-common/files/t4k-common-0.1.1-missing-text.patch
43 new file mode 100644
44 index 00000000000..72cb5372c28
45 --- /dev/null
46 +++ b/dev-games/t4k-common/files/t4k-common-0.1.1-missing-text.patch
47 @@ -0,0 +1,14 @@
48 +Fix some missing (transparent) text with libsdl-1.2.15_p20210224
49 +e.g. empty menus in tuxmath
50 +--- a/src/t4k_sdl.c
51 ++++ b/src/t4k_sdl.c
52 +@@ -1401,3 +1401,3 @@
53 + /* Use color key for eventual transparency: */
54 +- color_key = SDL_MapRGB(bg->format, 30, 30, 30);
55 ++ color_key = SDL_MapRGBA(bg->format, 30, 30, 30, 0xff);
56 + SDL_FillRect(bg, NULL, color_key);
57 +@@ -1448,3 +1448,3 @@
58 + SDL_SetColorKey(bg, SDL_SRCCOLORKEY|SDL_RLEACCEL, color_key);
59 +- out = SDL_DisplayFormatAlpha(bg);
60 ++ out = SDL_DisplayFormat(bg);
61 + SDL_FreeSurface(bg);
62
63 diff --git a/dev-games/t4k-common/files/t4k-common-0.1.1-svg-libxml2.patch b/dev-games/t4k-common/files/t4k-common-0.1.1-svg-libxml2.patch
64 new file mode 100644
65 index 00000000000..590be3858de
66 --- /dev/null
67 +++ b/dev-games/t4k-common/files/t4k-common-0.1.1-svg-libxml2.patch
68 @@ -0,0 +1,73 @@
69 +https://bugs.gentoo.org/763591
70 +
71 +https://github.com/tux4kids/t4kcommon/commit/99e9d3895b480d5998513592f6af25096c6d1c50
72 +From: Paul Huff <paul.huff@×××××.com>
73 +Date: Wed, 1 May 2019 19:56:12 -0600
74 +Subject: [PATCH] Use libxml2 to get info from svg files for frame counts since
75 + librsvg doesn't let you access the description anymore.
76 +--- a/src/t4k_loaders.c
77 ++++ b/src/t4k_loaders.c
78 +@@ -41,4 +41,6 @@
79 + #include<librsvg/rsvg.h>
80 + #include<librsvg/rsvg-cairo.h>
81 ++#include <libxml/parser.h>
82 ++#include <libxml/tree.h>
83 + #endif
84 +
85 +@@ -49,4 +51,5 @@
86 +
87 + #ifdef HAVE_RSVG
88 ++int get_number_of_frames_from_svg(const char *file_name);
89 + SDL_Surface* load_svg(const char* file_name, int width, int height, const char* layer_name);
90 + sprite* load_svg_sprite(const char* file_name, int width, int height);
91 +@@ -161,4 +164,43 @@
92 + #ifdef HAVE_RSVG
93 +
94 ++int get_number_of_frames_from_svg(const char* file_name) {
95 ++ xmlDocPtr svgFile;
96 ++ xmlNodePtr svgNode = NULL, nodeIterator = NULL;
97 ++ int number_of_frames = 0, found = 0;
98 ++
99 ++ svgFile = xmlReadFile(file_name, NULL, XML_PARSE_RECOVER | XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
100 ++
101 ++ /* If it's null something's really wrong because we're trying to load a sprite that doesn't exist */
102 ++ if(svgFile == NULL) {
103 ++ DEBUGMSG(debug_loaders, "get_number_of_frames_from_svg: couldn't load svgFile: %s\n", file_name);
104 ++ return 0;
105 ++ }
106 ++
107 ++ svgNode = xmlDocGetRootElement(svgFile);
108 ++
109 ++ /* If it's null then something's really wrong because there should be a root in every svg file... */
110 ++ if(svgNode == NULL) {
111 ++ DEBUGMSG(debug_loaders, "get_number_of_frames_from_svg: couldn't load the root from the svgFile: %s", file_name);
112 ++ xmlFreeDoc(svgFile); /* be clean */
113 ++ return 0;
114 ++ }
115 ++
116 ++ nodeIterator = svgNode->children;
117 ++ while(nodeIterator) {
118 ++ if(xmlStrcasecmp(nodeIterator->name, (const xmlChar*)"desc") == 0) {
119 ++ sscanf((const char*)xmlNodeGetContent(nodeIterator), "%d", &number_of_frames);
120 ++ xmlFreeDoc(svgFile);
121 ++ return number_of_frames;
122 ++ }
123 ++ nodeIterator = nodeIterator->next;
124 ++ }
125 ++
126 ++ /* if we get here we had no description, which means something's really wrong */
127 ++ DEBUGMSG(debug_loaders, "get_number_of_frames_from_svg: couldn't find the description frame number count from svgFile: %s", file_name);
128 ++ xmlFreeDoc(svgFile);
129 ++ return 0;
130 ++}
131 ++
132 ++
133 + /* Load a layer of SVG file and resize it to given dimensions.
134 + If width or height is negative no resizing is applied.
135 +@@ -215,5 +257,5 @@
136 +
137 + /* get number of frames from description */
138 +- sscanf(rsvg_handle_get_desc(file_handle), "%d", &new_sprite->num_frames);
139 ++ new_sprite->num_frames = get_number_of_frames_from_svg(file_name);
140 + DEBUGMSG(debug_loaders, "load_svg_sprite(): loading %d frames\n", new_sprite->num_frames);
141 +
142
143 diff --git a/dev-games/t4k-common/t4k-common-0.1.1-r1.ebuild b/dev-games/t4k-common/t4k-common-0.1.1-r1.ebuild
144 new file mode 100644
145 index 00000000000..c395867aa56
146 --- /dev/null
147 +++ b/dev-games/t4k-common/t4k-common-0.1.1-r1.ebuild
148 @@ -0,0 +1,65 @@
149 +# Copyright 1999-2021 Gentoo Authors
150 +# Distributed under the terms of the GNU General Public License v2
151 +
152 +EAPI=7
153 +
154 +inherit autotools
155 +
156 +DESCRIPTION="Library of code shared between tuxmath and tuxtype"
157 +HOMEPAGE="https://github.com/tux4kids/t4kcommon"
158 +SRC_URI="https://github.com/tux4kids/t4kcommon/archive/upstream/${PV}.tar.gz -> ${P}.tar.gz"
159 +S="${WORKDIR}/t4kcommon-upstream-${PV}"
160 +
161 +LICENSE="GPL-3"
162 +SLOT="0"
163 +KEYWORDS="~amd64 ~x86"
164 +IUSE="svg"
165 +
166 +RDEPEND="
167 + dev-libs/libxml2:2
168 + media-libs/libsdl
169 + media-libs/sdl-image
170 + media-libs/sdl-mixer
171 + media-libs/sdl-net
172 + media-libs/sdl-pango
173 + svg? (
174 + gnome-base/librsvg:2
175 + media-libs/libpng:=
176 + x11-libs/cairo
177 + )"
178 +DEPEND="${RDEPEND}"
179 +# need sys-devel/gettext for AM_ICONV added to configure.ac
180 +BDEPEND="
181 + sys-devel/gettext
182 + virtual/pkgconfig"
183 +
184 +PATCHES=(
185 + "${FILESDIR}"/${P}-libpng.patch
186 + "${FILESDIR}"/${P}-fno-common.patch
187 + "${FILESDIR}"/${P}-ICONV_CONST.patch
188 + "${FILESDIR}"/${P}-fix-declaration.patch
189 + "${FILESDIR}"/${P}-missing-text.patch
190 + "${FILESDIR}"/${P}-svg-libxml2.patch
191 +)
192 +
193 +src_prepare() {
194 + default
195 +
196 + rm m4/iconv.m4 || die
197 + eautoreconf
198 +}
199 +
200 +src_configure() {
201 + # note: sdlpango<->sdlttf breaks ABI, prefer default pango
202 + local econfargs=(
203 + $(usex svg '' --without-rsvg)
204 + --disable-static
205 + )
206 + econf "${econfargs[@]}"
207 +}
208 +
209 +src_install() {
210 + default
211 +
212 + find "${ED}" -name '*.la' -delete || die
213 +}