media-gfx/mscgen: update EAPI 7 -> 8, unrestrict tests, pull in Fedora/Debian patches

* EAPI 8
* Unrestict tests, which exposes a crash!
* Pull in Fedora/Debian patches to fix aforementioned crash

Closes: https://bugs.gentoo.org/379279
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2025-05-30 12:10:22 +01:00
parent 50f3f28b86
commit eab3a00efc
5 changed files with 136 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
https://src.fedoraproject.org/rpms/mscgen/blob/rawhide/f/mscgen-0.20-escape.patch
# Removes unknown escape sequence '\-'
# Patch sent upstream.
# http://code.google.com/p/mscgen/issues/detail?id=72
--- mscgen-0.20.orig/src/usage.c 2011-03-01 22:16:04.000000000 +0100
+++ mscgen-0.20/src/usage.c 2012-07-20 23:53:25.415071528 +0200
@@ -59,7 +59,7 @@ void Usage(void)
" command line.\n"
" -o <file> Write output to the named file. This option must be specified if \n"
" input is taken from stdin, otherwise the output filename\n"
-" defaults to <infile>.<type>. This may also be specified as '\-'\n"
+" defaults to <infile>.<type>. This may also be specified as '-'\n"
" to write output directly to stdout.\n"
#ifdef USE_FREETYPE
" -F <font> Use specified font for PNG output. This must be a font specifier\n"

View File

@@ -0,0 +1,27 @@
https://src.fedoraproject.org/rpms/mscgen/blob/rawhide/f/mscgen-0.20-language.patch
Description: Use %parse-param to ensure that yyparse is generated
with the proper prototype.
# Fixes language.c:464:5: error: conflicting types for 'yyparse'
# https://code.google.com/p/mscgen/issues/detail?id=83
--- a/src/language.y
+++ b/src/language.y
@@ -48,7 +48,7 @@ int yylex_destroy(void);
* Error handling function. The TOK_XXX names are substituted for more
* understandable values that make more sense to the user.
*/
-void yyerror(const char *str)
+void yyerror(void *unused, const char *str)
{
static const char *tokNames[] = { "TOK_OCBRACKET", "TOK_CCBRACKET",
"TOK_OSBRACKET", "TOK_CSBRACKET",
@@ -224,6 +224,8 @@ Msc MscParse(FILE *in)
%}
+%parse-param {void *YYPARSE_PARAM}
+
%token TOK_STRING TOK_QSTRING TOK_EQUAL TOK_COMMA TOK_SEMICOLON TOK_OCBRACKET TOK_CCBRACKET
TOK_OSBRACKET TOK_CSBRACKET TOK_MSC
TOK_ATTR_LABEL TOK_ATTR_URL TOK_ATTR_ID TOK_ATTR_IDURL

View File

@@ -0,0 +1,14 @@
https://src.fedoraproject.org/rpms/mscgen/blob/rawhide/f/mscgen-0.20-uninitialized-ymax.patch
# Fixes 'ymax' variable initialization
# http://code.google.com/p/mscgen/issues/detail?id=73
--- a/src/main.c
+++ b/src/main.c
@@ -851,6 +851,7 @@
nextYmin = ymin = gOpts.entityHeadGap;
yskipmax = 0;
+ ymax = 0;
MscResetArcIterator(m);
do

View File

@@ -0,0 +1,24 @@
https://src.fedoraproject.org/rpms/mscgen/blob/rawhide/f/mscgen-0.20-width-never-less-than-zero.patch
Description: don't make width < 0 with an off-by-one fix-up
gdoTextWidth() tries to correct an off-by-one error in the calculated width
of a text bounding box; but doesn't account for the possibility that the
bounding box has a size of zero (which is the case in latest libgd for
zero-width text). Account for this so we aren't accidentally returning
-1 where we mean 0.
Author: Steve Langasek <steve.langasek@ubuntu.com>
Bug-Debian: https://bugs.debian.org/960405
Last-Update: 2020-05-15
--- a/src/gd_out.c
+++ b/src/gd_out.c
@@ -212,7 +212,7 @@
* the right of the last character for the fixed width
* font.
*/
- return rect[2] - 1;
+ return rect[2] ? rect[2] - 1 : 0;
#endif
}

View File

@@ -0,0 +1,55 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools
DESCRIPTION="Message sequence chart generator"
HOMEPAGE="https://www.mcternan.me.uk/mscgen/"
SRC_URI="https://www.mcternan.me.uk/${PN}/software/${PN}-src-${PV}.tar.gz"
LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86 ~x64-solaris"
IUSE="png truetype"
REQUIRED_USE="truetype? ( png )"
RDEPEND="
truetype? ( media-libs/freetype )
png? ( media-libs/gd[png,truetype?] )
"
DEPEND="${RDEPEND}"
BDEPEND="
app-alternatives/yacc
app-alternatives/lex
virtual/pkgconfig
"
# Workaround for bug #379279
#RESTRICT="test"
PATCHES=(
"${FILESDIR}"/${PN}-0.20-escape.patch
"${FILESDIR}"/${PN}-0.20-uninitialized-ymax.patch
"${FILESDIR}"/${PN}-0.20-language.patch
"${FILESDIR}"/${PN}-0.20-width-never-less-than-zero.patch
)
src_prepare() {
default
sed -i -e '/dist_doc_DATA/d' Makefile.am || die "Fixing Makefile.am failed"
eautoreconf
}
src_configure() {
local myconf=()
if use png; then
use truetype && myconf+=( --with-freetype )
else
myconf+=( --without-png )
fi
econf "${myconf[@]}"
}