Skip to content

Commit

Permalink
games-kids/tuxmath: EAPI-7, -fno-common, and crash fix
Browse files Browse the repository at this point in the history
Two causes of crashes, mismatch with t4k-common is exposed by
gcc10+ (blits-to-tmblits patch), and bug #763591 is fixed in
>=t4k-common-0.1.1-r1 which now depend on.

Thanks to Samuel Bauer for pointing out -fno-common fix

Closes: https://bugs.gentoo.org/763591
Closes: https://bugs.gentoo.org/795069
Signed-off-by: Ionen Wolkens <[email protected]>
  • Loading branch information
ionenwks committed Jun 10, 2021
1 parent c4993b6 commit dfffb12
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
36 changes: 36 additions & 0 deletions games-kids/tuxmath/files/tuxmath-2.0.3-blits-to-tmblits.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Fixes immediate crash on titlescreen with gcc10+
Patch from debian:
https://bugs.debian.org/986623
--- a/src/titlescreen.c
+++ b/src/titlescreen.c
@@ -57,3 +57,3 @@
unsigned char type;
-} blits[MAX_UPDATES];
+} tmblits[MAX_UPDATES];

@@ -1021,4 +1021,4 @@
for (i = 0; i < MAX_UPDATES; ++i) {
- blits[i].srcrect = &srcupdate[i];
- blits[i].dstrect = &dstupdate[i];
+ tmblits[i].srcrect = &srcupdate[i];
+ tmblits[i].dstrect = &dstupdate[i];
}
@@ -1034,4 +1034,4 @@
for (i = 0; i < numupdates; i++)
- if (blits[i].type == 'E')
- SDL_LowerBlit(blits[i].src, blits[i].srcrect, screen, blits[i].dstrect);
+ if (tmblits[i].type == 'E')
+ SDL_LowerBlit(tmblits[i].src, tmblits[i].srcrect, screen, tmblits[i].dstrect);
// SNOW_erase();
@@ -1040,4 +1040,4 @@
for (i = 0; i < numupdates; i++)
- if (blits[i].type == 'D')
- SDL_BlitSurface(blits[i].src, blits[i].srcrect, screen, blits[i].dstrect);
+ if (tmblits[i].type == 'D')
+ SDL_BlitSurface(tmblits[i].src, tmblits[i].srcrect, screen, tmblits[i].dstrect);
// SNOW_draw();
@@ -1069,3 +1069,3 @@

- update = &blits[numupdates++];
+ update = &tmblits[numupdates++];

8 changes: 8 additions & 0 deletions games-kids/tuxmath/files/tuxmath-2.0.3-fno-common.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
https://bugs.gentoo.org/795069
https://github.com/tux4kids/tuxmath/pull/15
--- a/src/menu_lan.c
+++ b/src/menu_lan.c
@@ -39,3 +39,2 @@
/* lan_player_type now defined in network.h */
-lan_player_type lan_player_info[MAX_CLIENTS];

62 changes: 62 additions & 0 deletions games-kids/tuxmath/tuxmath-2.0.3-r2.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit desktop optfeature

DESCRIPTION="Educational arcade game where you have to solve maths problems"
HOMEPAGE="https://www.tux4kids.com/"
SRC_URI="mirror://debian/pool/main/t/${PN}/${PN}_${PV}.orig.tar.gz"
S="${WORKDIR}/${PN}_w_fonts-${PV}"

LICENSE="CC-BY-SA-3.0 CC-PD GPL-3+ public-domain"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="nls svg"

RDEPEND="
>=dev-games/t4k-common-0.1.1-r1[svg?]
dev-libs/libxml2:2
media-libs/libsdl[video]
media-libs/sdl-image[jpeg,png]
media-libs/sdl-mixer
media-libs/sdl-net
nls? ( virtual/libintl )"
DEPEND="
${RDEPEND}
svg? (
gnome-base/librsvg:2
x11-libs/cairo
)"
BDEPEND="
virtual/pkgconfig
nls? ( sys-devel/gettext )"

PATCHES=(
"${FILESDIR}"/${P}-blits-to-tmblits.patch
"${FILESDIR}"/${P}-fno-common.patch
)

src_configure() {
local econfargs=(
$(use_enable nls)
$(usex svg '' --without-rsvg)
)
econf "${econfargs[@]}"
}

src_install() {
default

doicon data/images/icons/${PN}.svg
domenu ${PN}.desktop

# bundled fonts are unused if t4k-common uses pango
rm -r "${ED}"/usr/share/${PN}/fonts || die
rm "${ED}"/usr/share/doc/${PF}/{COPYING_GPL3,GPL_VERSIONS,INSTALL,OFL,README_DATA_LICENSES} || die
}

pkg_postinst() {
optfeature "music support" "media-libs/sdl-mixer[mod,vorbis]"
}

0 comments on commit dfffb12

Please sign in to comment.