commit:     eab3a00efc7116fe7edefcd7ca43abc6240a27fa
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 30 11:10:22 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 11:10:22 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eab3a00e

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 <AT> gentoo.org>

 media-gfx/mscgen/files/mscgen-0.20-escape.patch    | 16 +++++++
 media-gfx/mscgen/files/mscgen-0.20-language.patch  | 27 +++++++++++
 .../files/mscgen-0.20-uninitialized-ymax.patch     | 14 ++++++
 .../mscgen-0.20-width-never-less-than-zero.patch   | 24 ++++++++++
 media-gfx/mscgen/mscgen-0.20-r1.ebuild             | 55 ++++++++++++++++++++++
 5 files changed, 136 insertions(+)

diff --git a/media-gfx/mscgen/files/mscgen-0.20-escape.patch 
b/media-gfx/mscgen/files/mscgen-0.20-escape.patch
new file mode 100644
index 000000000000..674f3852775e
--- /dev/null
+++ b/media-gfx/mscgen/files/mscgen-0.20-escape.patch
@@ -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"

diff --git a/media-gfx/mscgen/files/mscgen-0.20-language.patch 
b/media-gfx/mscgen/files/mscgen-0.20-language.patch
new file mode 100644
index 000000000000..226b39842b3c
--- /dev/null
+++ b/media-gfx/mscgen/files/mscgen-0.20-language.patch
@@ -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

diff --git a/media-gfx/mscgen/files/mscgen-0.20-uninitialized-ymax.patch 
b/media-gfx/mscgen/files/mscgen-0.20-uninitialized-ymax.patch
new file mode 100644
index 000000000000..96e96e7bfb2c
--- /dev/null
+++ b/media-gfx/mscgen/files/mscgen-0.20-uninitialized-ymax.patch
@@ -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

diff --git 
a/media-gfx/mscgen/files/mscgen-0.20-width-never-less-than-zero.patch 
b/media-gfx/mscgen/files/mscgen-0.20-width-never-less-than-zero.patch
new file mode 100644
index 000000000000..7c3d571c2854
--- /dev/null
+++ b/media-gfx/mscgen/files/mscgen-0.20-width-never-less-than-zero.patch
@@ -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 <[email protected]>
+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
+ }
+ 
+

diff --git a/media-gfx/mscgen/mscgen-0.20-r1.ebuild 
b/media-gfx/mscgen/mscgen-0.20-r1.ebuild
new file mode 100644
index 000000000000..3cb467eeba7a
--- /dev/null
+++ b/media-gfx/mscgen/mscgen-0.20-r1.ebuild
@@ -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[@]}"
+}

Reply via email to