public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-games/t4k-common/, dev-games/t4k-common/files/
@ 2021-06-10 11:52 Ionen Wolkens
  0 siblings, 0 replies; only message in thread
From: Ionen Wolkens @ 2021-06-10 11:52 UTC (permalink / raw
  To: gentoo-commits

commit:     c4993b6a7a6daa41d9b5b2efb53dc0a0f5e90d64
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  9 11:43:55 2021 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Thu Jun 10 11:51:42 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4993b6a

dev-games/t4k-common: svg, text, and build fix

Three patches fix:
- tuxmath[svg] crash (bug #763591)
- tuxmath lacking text with current libsdl
- set_font_size build (bug #759574)

Bug: https://bugs.gentoo.org/763591
Closes: https://bugs.gentoo.org/759574
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../files/t4k-common-0.1.1-fix-declaration.patch   | 10 +++
 .../files/t4k-common-0.1.1-missing-text.patch      | 14 +++++
 .../files/t4k-common-0.1.1-svg-libxml2.patch       | 73 ++++++++++++++++++++++
 dev-games/t4k-common/t4k-common-0.1.1-r1.ebuild    | 65 +++++++++++++++++++
 4 files changed, 162 insertions(+)

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
new file mode 100644
index 00000000000..8b1188039f4
--- /dev/null
+++ b/dev-games/t4k-common/files/t4k-common-0.1.1-fix-declaration.patch
@@ -0,0 +1,10 @@
+https://bugs.gentoo.org/759574
+--- a/src/t4k_menu.c	2013-12-02 10:50:23.000000000 -0500
++++ b/src/t4k_menu.c	2021-01-04 19:49:20.561524579 -0500
+@@ -152,5 +152,5 @@
+ char*           find_longest_text(MenuNode* menu, int* length);
+ int             find_longest_menu_page(MenuNode* menu);
+-void            set_font_size();
++void            set_font_size(bool uniform);
+ void            prerender_menu(MenuNode* menu);
+ int		min(int a, int b);

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
new file mode 100644
index 00000000000..72cb5372c28
--- /dev/null
+++ b/dev-games/t4k-common/files/t4k-common-0.1.1-missing-text.patch
@@ -0,0 +1,14 @@
+Fix some missing (transparent) text with libsdl-1.2.15_p20210224
+e.g. empty menus in tuxmath
+--- a/src/t4k_sdl.c
++++ b/src/t4k_sdl.c
+@@ -1401,3 +1401,3 @@
+   /* Use color key for eventual transparency: */
+-  color_key = SDL_MapRGB(bg->format, 30, 30, 30);
++  color_key = SDL_MapRGBA(bg->format, 30, 30, 30, 0xff);
+   SDL_FillRect(bg, NULL, color_key);
+@@ -1448,3 +1448,3 @@
+   SDL_SetColorKey(bg, SDL_SRCCOLORKEY|SDL_RLEACCEL, color_key);
+-  out = SDL_DisplayFormatAlpha(bg);
++  out = SDL_DisplayFormat(bg);
+   SDL_FreeSurface(bg);

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
new file mode 100644
index 00000000000..590be3858de
--- /dev/null
+++ b/dev-games/t4k-common/files/t4k-common-0.1.1-svg-libxml2.patch
@@ -0,0 +1,73 @@
+https://bugs.gentoo.org/763591
+
+https://github.com/tux4kids/t4kcommon/commit/99e9d3895b480d5998513592f6af25096c6d1c50
+From: Paul Huff <paul.huff@gmail.com>
+Date: Wed, 1 May 2019 19:56:12 -0600
+Subject: [PATCH] Use libxml2 to get info from svg files for frame counts since
+ librsvg doesn't let you access the description anymore.
+--- a/src/t4k_loaders.c
++++ b/src/t4k_loaders.c
+@@ -41,4 +41,6 @@
+ #include<librsvg/rsvg.h>
+ #include<librsvg/rsvg-cairo.h>
++#include <libxml/parser.h>
++#include <libxml/tree.h>
+ #endif
+ 
+@@ -49,4 +51,5 @@
+ 
+ #ifdef HAVE_RSVG
++int             get_number_of_frames_from_svg(const char *file_name);
+ SDL_Surface*    load_svg(const char* file_name, int width, int height, const char* layer_name);
+ sprite*         load_svg_sprite(const char* file_name, int width, int height);
+@@ -161,4 +164,43 @@
+ #ifdef HAVE_RSVG
+ 
++int get_number_of_frames_from_svg(const char* file_name) {
++    xmlDocPtr svgFile;
++    xmlNodePtr svgNode = NULL, nodeIterator = NULL;
++    int number_of_frames = 0, found = 0;
++
++    svgFile = xmlReadFile(file_name, NULL, XML_PARSE_RECOVER | XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
++
++    /* If it's null something's really wrong because we're trying to load a sprite that doesn't exist */
++    if(svgFile == NULL) {
++        DEBUGMSG(debug_loaders, "get_number_of_frames_from_svg: couldn't load svgFile: %s\n", file_name);
++        return 0;
++    }
++
++    svgNode = xmlDocGetRootElement(svgFile);
++
++    /* If it's null then something's really wrong because there should be a root in every svg file... */
++    if(svgNode == NULL) {
++        DEBUGMSG(debug_loaders, "get_number_of_frames_from_svg: couldn't load the root from the svgFile: %s", file_name);
++        xmlFreeDoc(svgFile); /* be clean */
++        return 0;
++    }
++
++    nodeIterator = svgNode->children;
++    while(nodeIterator) {
++        if(xmlStrcasecmp(nodeIterator->name, (const xmlChar*)"desc") == 0) {
++            sscanf((const char*)xmlNodeGetContent(nodeIterator), "%d", &number_of_frames);
++            xmlFreeDoc(svgFile);
++            return number_of_frames;
++        }
++        nodeIterator = nodeIterator->next;
++    }
++
++    /* if we get here we had no description, which means something's really wrong */
++    DEBUGMSG(debug_loaders, "get_number_of_frames_from_svg: couldn't find the description frame number count from svgFile: %s", file_name);
++    xmlFreeDoc(svgFile);
++    return 0;
++}
++
++
+ /* Load a layer of SVG file and resize it to given dimensions.
+    If width or height is negative no resizing is applied.
+@@ -215,5 +257,5 @@
+ 
+   /* get number of frames from description */
+-  sscanf(rsvg_handle_get_desc(file_handle), "%d", &new_sprite->num_frames);
++  new_sprite->num_frames = get_number_of_frames_from_svg(file_name);
+   DEBUGMSG(debug_loaders, "load_svg_sprite(): loading %d frames\n", new_sprite->num_frames);
+ 

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
new file mode 100644
index 00000000000..c395867aa56
--- /dev/null
+++ b/dev-games/t4k-common/t4k-common-0.1.1-r1.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools
+
+DESCRIPTION="Library of code shared between tuxmath and tuxtype"
+HOMEPAGE="https://github.com/tux4kids/t4kcommon"
+SRC_URI="https://github.com/tux4kids/t4kcommon/archive/upstream/${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/t4kcommon-upstream-${PV}"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="svg"
+
+RDEPEND="
+	dev-libs/libxml2:2
+	media-libs/libsdl
+	media-libs/sdl-image
+	media-libs/sdl-mixer
+	media-libs/sdl-net
+	media-libs/sdl-pango
+	svg? (
+		gnome-base/librsvg:2
+		media-libs/libpng:=
+		x11-libs/cairo
+	)"
+DEPEND="${RDEPEND}"
+# need sys-devel/gettext for AM_ICONV added to configure.ac
+BDEPEND="
+	sys-devel/gettext
+	virtual/pkgconfig"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-libpng.patch
+	"${FILESDIR}"/${P}-fno-common.patch
+	"${FILESDIR}"/${P}-ICONV_CONST.patch
+	"${FILESDIR}"/${P}-fix-declaration.patch
+	"${FILESDIR}"/${P}-missing-text.patch
+	"${FILESDIR}"/${P}-svg-libxml2.patch
+)
+
+src_prepare() {
+	default
+
+	rm m4/iconv.m4 || die
+	eautoreconf
+}
+
+src_configure() {
+	# note: sdlpango<->sdlttf breaks ABI, prefer default pango
+	local econfargs=(
+		$(usex svg '' --without-rsvg)
+		--disable-static
+	)
+	econf "${econfargs[@]}"
+}
+
+src_install() {
+	default
+
+	find "${ED}" -name '*.la' -delete || die
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-10 11:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-10 11:52 [gentoo-commits] repo/gentoo:master commit in: dev-games/t4k-common/, dev-games/t4k-common/files/ Ionen Wolkens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox