Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-games/t4k-common: Fix building with gcc 14 #35241

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 76 additions & 0 deletions dev-games/t4k-common/files/t4k-common-0.1.1-gcc14-build-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
https://patch-diff.githubusercontent.com/raw/tux4kids/t4kcommon/pull/16.patch
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 7 Feb 2023 16:10:36 +0100
Subject: [PATCH 1/2] linebreak: Avoid implicit declaration of u8_mbtouc_unsafe
function

GNULIB_UNISTR_U8_MBTOUC_UNSAFE tells the bundled unistr.h to
provide a function prototype for u8_mbtouc_unsafe. This prevents
build failures with future compilers which do not support implicit
function declarations.

Upstream gnulib has split the linebreak module into multiple parts;
it is hard to tell if it still has the same issue.
--- a/src/linebreak/linebreak.c
+++ b/src/linebreak/linebreak.c
@@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
//#include "c-ctype.h"
#include "ctype.h"
#include "xsize.h"
+#define GNULIB_UNISTR_U8_MBTOUC_UNSAFE
#include "unistr.h"
#include "uniwidth.h"
#include "uniwidth/cjk.h"
--
2.43.0


Bug: https://bugs.gentoo.org/923789
From: Brahmajit Das <brahmajit.xyz@gmail.com>
Date: Fri, 9 Feb 2024 11:49:53 +0530
Subject: [PATCH 2/2] t4k_menu: Fix passing incompatible pointer type

First observed under Gentoo Linux with GCC 14, probably due to
mismatching types between child (struct _xmlAttr *) and node.children
(struct _xmlAttr *).

Resulting in build errors such as
t4k_menu.c:254:23: error: assignment to 'xmlAttr *' {aka 'struct _xmlAttr *'} from incompatible pointer type 'struct _xmlNode *' [-Wincompatible-pointer-types]
254 | for(child = node->children; child; child = child->next) {
| ^
t4k_menu.c:256:62: error: passing argument 1 of 'menu_TranslateNode' from incompatible pointer type [-Wincompatible-pointer-types]
256 | tnode->submenu[i++] = menu_TranslateNode(child);
| ^~~~~
| |
| xmlAttr * {aka struct _xmlAttr *}

Please reffer Gentoo bug: https://bugs.gentoo.org/923789
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
--- a/src/t4k_menu.c
+++ b/src/t4k_menu.c
@@ -251,9 +251,10 @@ MenuNode *menu_TranslateNode(xmlNode *node) {
/* Now add child nodes. */
if(xmlStrcasecmp(node->name, "menu") == 0) {
i = 0;
- for(child = node->children; child; child = child->next) {
- if(child->type == XML_ELEMENT_NODE) {
- tnode->submenu[i++] = menu_TranslateNode(child);
+ xmlNode *childNode = NULL;
+ for(childNode = node->children; childNode; childNode = childNode->next) {
+ if(childNode->type == XML_ELEMENT_NODE) {
+ tnode->submenu[i++] = menu_TranslateNode(childNode);
}
}
}
@@ -443,7 +444,7 @@ int T4K_RunMenu(int index, bool return_choice, void (*draw_background)(), int (*
int click_flag = 1;
int using_scroll = 0;

- internal_res_switch_handler(&T4K_PrerenderAll);
+ internal_res_switch_handler((ResSwitchCallback)&T4K_PrerenderAll);

for(;;) /* one loop body execution for one menu page */
{
--
2.43.0

66 changes: 66 additions & 0 deletions dev-games/t4k-common/t4k-common-0.1.1-r2.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright 1999-2024 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
"${FILESDIR}"/${P}-gcc14-build-fix.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
}