commit:     f8eb85215fa28bb9f6d266d65fadf4f9679a57a6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 03:16:57 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 03:49:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8eb8521

media-libs/aalib: fix build w/ opaque ncurses structures, build w/ -std=gnu17

wrt gnu17: unfortunately, gpm headers are broken and gpm is dead upstream,
so I don't expect that to be fixed any time soon.

Closes: https://bugs.gentoo.org/932140
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-libs/aalib/aalib-1.4_rc5-r11.ebuild          | 74 ++++++++++++++++++++++
 .../aalib/files/aalib-1.4_rc5-ncurses-opaque.patch | 24 +++++++
 2 files changed, 98 insertions(+)

diff --git a/media-libs/aalib/aalib-1.4_rc5-r11.ebuild 
b/media-libs/aalib/aalib-1.4_rc5-r11.ebuild
new file mode 100644
index 000000000000..6877f514dbd5
--- /dev/null
+++ b/media-libs/aalib/aalib-1.4_rc5-r11.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools flag-o-matic multilib-minimal toolchain-funcs
+
+MY_PV="${PV/_/}"
+MY_P="${PN}-${MY_PV}"
+S="${WORKDIR}/${PN}-1.4.0"
+
+DESCRIPTION="A ASCII-Graphics Library"
+HOMEPAGE="https://aa-project.sourceforge.net/aalib/";
+SRC_URI="https://download.sourceforge.net/project/aa-project/aa-lib/${MY_PV}/${MY_P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos 
~x64-solaris"
+IUSE="X gpm slang"
+
+RDEPEND=">=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}]
+       X? ( >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}] )
+       gpm? ( >=sys-libs/gpm-1.20.7-r2[${MULTILIB_USEDEP}] )
+       slang? ( >=sys-libs/slang-2.2.4-r1[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+       X? ( x11-base/xorg-proto )"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4_rc4-gentoo.patch
+       "${FILESDIR}"/${PN}-1.4_rc4-m4.patch
+       "${FILESDIR}"/${PN}-1.4_rc5-fix-protos.patch #224267
+       "${FILESDIR}"/${PN}-1.4_rc5-fix-aarender.patch #214142
+       "${FILESDIR}"/${PN}-1.4_rc5-tinfo.patch #468566
+       "${FILESDIR}"/${PN}-1.4_rc5-key-down-OOB.patch
+       "${FILESDIR}"/${PN}-1.4_rc5-more-protos.patch
+       "${FILESDIR}"/${PN}-1.4_rc5-free-offset-pointer.patch #894978
+       "${FILESDIR}"/${PN}-1.4_rc5-ncurses-opaque.patch #932140
+)
+
+DOCS=( ANNOUNCE AUTHORS ChangeLog NEWS README )
+
+src_prepare() {
+       default
+
+       sed -i -e 's:#include <malloc.h>:#include <stdlib.h>:g' "${S}"/src/*.c
+
+       # Fix bug #165617.
+       use gpm || sed -i \
+               's/gpm_mousedriver_test=yes/gpm_mousedriver_test=no/' 
"${S}/configure.in"
+
+       #467988 automake-1.13
+       mv configure.{in,ac} || die
+       sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac || die
+
+       eautoreconf
+}
+
+multilib_src_configure() {
+       # Gpm_Wgetch from sys-libs/gpm is unprototyped in gpm.h and
+       # gpm is dead upstream.
+       append-cflags -std=gnu17
+
+       ECONF_SOURCE=${S} econf \
+               $(use_with slang slang-driver) \
+               $(use_with X x11-driver) \
+               PKG_CONFIG=$(tc-getPKG_CONFIG)
+}
+
+multilib_src_install() {
+       emake DESTDIR="${D}" install
+
+       find "${D}" -name '*.la' -type f -delete || die
+}

diff --git a/media-libs/aalib/files/aalib-1.4_rc5-ncurses-opaque.patch 
b/media-libs/aalib/files/aalib-1.4_rc5-ncurses-opaque.patch
new file mode 100644
index 000000000000..91271fba4f7f
--- /dev/null
+++ b/media-libs/aalib/files/aalib-1.4_rc5-ncurses-opaque.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/932140
+https://sourceforge.net/p/aa-project/patches/10/
+
+Without the change build fails on ncurses-6.5 (enables opaque WINDOW by
+default) as:
+
+    aacurses.c: In function 'curses_getsize':
+    aacurses.c:74:20: error: invalid use of incomplete typedef 'WINDOW' {aka 
'struct _win_st'}
+     74 |     *width = stdscr->_maxx + 1;
+        |                    ^~
+--- a/src/aacurses.c
++++ b/src/aacurses.c
+@@ -71,8 +71,8 @@ static void curses_getsize(aa_context * c, int *width, int 
*height)
+ {
+     if (__resized_curses)
+       curses_uninit(c), curses_init(&c->params, NULL,&c->driverparams, NULL), 
__resized_curses = 0;
+-    *width = stdscr->_maxx + 1;
+-    *height = stdscr->_maxy + 1;
++    *width = getmaxx(stdscr);
++    *height = getmaxy(stdscr);
+ #ifdef GPM_MOUSEDRIVER
+     gpm_mx = *width;
+     gpm_my = *height;
+

Reply via email to