commit:     5602c153d4e7bdbff0595645bb0183907d9ad29c
Author:     Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr>
AuthorDate: Fri Jul 11 08:21:49 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 23 02:37:46 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5602c153

app-text/paps: add 0.8.0

EAPI bump

use python-r1 to install the script src-to-paps

move to official github repo
build-system changed to meson

deps :
add missing dev-libs/glib
add x11-libs/cairo (since 0.7.0)

add basic test

patches from PR merged :
fix compiler warnings
fix glib/fmt compatilibity

Closes: https://bugs.gentoo.org/936584
Closes: https://bugs.gentoo.org/944759
Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/42957
Closes: https://github.com/gentoo/gentoo/pull/42957
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-text/paps/Manifest                             |  1 +
 app-text/paps/files/paps-0.8.0-fix_fmt11.2.patch   | 31 ++++++++
 app-text/paps/files/paps-0.8.0-fix_glib.patch      | 47 ++++++++++++
 .../paps/files/paps-0.8.0-fix_unused_results.patch | 84 ++++++++++++++++++++++
 app-text/paps/metadata.xml                         |  3 +-
 app-text/paps/paps-0.8.0.ebuild                    | 52 ++++++++++++++
 6 files changed, 217 insertions(+), 1 deletion(-)

diff --git a/app-text/paps/Manifest b/app-text/paps/Manifest
index cbe793b45227..81c8cd0d779d 100644
--- a/app-text/paps/Manifest
+++ b/app-text/paps/Manifest
@@ -1 +1,2 @@
 DIST paps-0.6.8.tar.gz 460062 BLAKE2B 
8ca34cd217a5ed26de80a1e35f5cb05d75c291a966923ddcf73fb8a6db1a3823075c480c876cff932757feb3a4767057d269bac0863236df0b513e246726b01b
 SHA512 
db657d90179e11fe42bbcdbebe09a84f1927c99d0b539c9e29b66b3cb8ffcf33ff500c9d81835ae5a0880382bf8f24801f04742517b76b8e005b125a139d8bba
+DIST paps-0.8.0.tar.gz 75685 BLAKE2B 
e20ea4ceafe41e938901d61c3c684d9d6b53a621127a66551d0137215c42a7a3c9a8657456bfe4893b8b6b9cd0b65fb104e0492d090b1bb584ca850c06d01236
 SHA512 
f8c101f6439159354b6a6d218b19baab605f08fa4e70171addb6e38cf5645a7888601fa0aa9d067ec1e5c423297f305cc35268cfde8a3327ffc6ced73ce6df50

diff --git a/app-text/paps/files/paps-0.8.0-fix_fmt11.2.patch 
b/app-text/paps/files/paps-0.8.0-fix_fmt11.2.patch
new file mode 100644
index 000000000000..e365dd4003ec
--- /dev/null
+++ b/app-text/paps/files/paps-0.8.0-fix_fmt11.2.patch
@@ -0,0 +1,31 @@
+https://github.com/dov/paps/pull/77.patch
+PR merged
+From 2a37bffcaddd93002bea9fb49122167274a0cbbd Mon Sep 17 00:00:00 2001
+From: Nicolas PARLANT <[email protected]>
+Date: Fri, 11 Jul 2025 07:23:51 +0200
+Subject: [PATCH] Replace deprecated fmt::localtime with std::localtime
+
+fmt::localtime is deprecated since fmt 11.2.0
+
+Signed-off-by: Nicolas PARLANT <[email protected]>
+---
+ src/format_from_dict.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/format_from_dict.cc b/src/format_from_dict.cc
+index bcad60e..ce72e99 100644
+--- a/src/format_from_dict.cc
++++ b/src/format_from_dict.cc
+@@ -54,7 +54,11 @@ static string scalar_to_string(scalar_t scalar,
+     time_t val = get<time_t>(scalar);
+     if (!spec.length())
+       return to_string(val);
+-    return format(runtime(format("{{:{}}}", spec)), fmt::localtime(val));
++    const auto *tm = std::localtime(&val);
++    if (tm == nullptr)
++      return {};
++
++    return format(runtime(format("{{:{}}}", spec)), *tm);
+   }
+   throw runtime_error("Unrecognized type!"); // I shouldn't be here!
+ }

diff --git a/app-text/paps/files/paps-0.8.0-fix_glib.patch 
b/app-text/paps/files/paps-0.8.0-fix_glib.patch
new file mode 100644
index 000000000000..a4ed8aea0bad
--- /dev/null
+++ b/app-text/paps/files/paps-0.8.0-fix_glib.patch
@@ -0,0 +1,47 @@
+https://github.com/dov/paps/pull/71.patch
+PR merged
+From e6ec698be127822661e31f7fca7d2e0107944b24 Mon Sep 17 00:00:00 2001
+From: Yaakov Selkowitz <[email protected]>
+Date: Tue, 17 Sep 2024 13:58:46 -0400
+Subject: [PATCH] Fix build with glib 2.82
+
+g_utf8_next_char no longer includes a cast to char* as of this change:
+
+https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4016
+
+Signed-off-by: Yaakov Selkowitz <[email protected]>
+---
+ src/paps.cc | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/paps.cc b/src/paps.cc
+index fde04d1..3ab9a7c 100644
+--- a/src/paps.cc
++++ b/src/paps.cc
+@@ -1107,7 +1107,7 @@ split_text_into_paragraphs (PangoContext *pango_context,
+       while (p != nullptr && *p)
+         {
+           wc = g_utf8_get_char (p);
+-          next = g_utf8_next_char (p);
++          next = (char *) g_utf8_next_char (p);
+           if (wc == (gunichar)-1)
+             {
+               fprintf (stderr, _("%s: Invalid character in input\n"), 
g_get_prgname ());
+@@ -1122,7 +1122,7 @@ split_text_into_paragraphs (PangoContext *pango_context,
+               para->length = p - last_para;
+               /* handle dos line breaks */
+               if (wc == '\r' && *next == '\n')
+-                  next = g_utf8_next_char(next);
++                  next = (char *) g_utf8_next_char(next);
+               para->layout = pango_layout_new (pango_context);
+ 
+               if (page_layout->cpi > 0.0L)
+@@ -1193,7 +1193,7 @@ split_text_into_paragraphs (PangoContext *pango_context,
+                       g_free (newtext);
+ 
+                       para->length = i;
+-                      next = g_utf8_offset_to_pointer (para->text, 
para->length);
++                      next = (char *) g_utf8_offset_to_pointer (para->text, 
para->length);
+                       wc = g_utf8_get_char (g_utf8_prev_char (next));
+                     }
+                   else

diff --git a/app-text/paps/files/paps-0.8.0-fix_unused_results.patch 
b/app-text/paps/files/paps-0.8.0-fix_unused_results.patch
new file mode 100644
index 000000000000..2b8bd61a0702
--- /dev/null
+++ b/app-text/paps/files/paps-0.8.0-fix_unused_results.patch
@@ -0,0 +1,84 @@
+https://github.com/dov/paps/pull/58.patch
+PR merged
+From 0eac5cb403dd7dc4f4ebd05c9a93730fa1521e53 Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <[email protected]>
+Date: Wed, 1 Mar 2023 15:24:27 +0900
+Subject: [PATCH] Fix the build issue
+
+Some code ignores a return value of g_string_free() and that causes:
+
+ignoring return value of 'gchar* g_string_free_and_steal(GString*)' declared 
with attribute 'warn_unused_result' [-Wunused-result]
+
+This fixes it.
+---
+ src/paps.cc | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/src/paps.cc b/src/paps.cc
+index cb48ddc..429b764 100644
+--- a/src/paps.cc
++++ b/src/paps.cc
+@@ -368,6 +368,7 @@ copy_pango_parse_enum (GType       type,
+       {
+         int i;
+         GString *s = g_string_new (nullptr);
++        gchar *gstr;
+ 
+         for (i = 0, v = g_enum_get_value (klass, i); v;
+              i++  , v = g_enum_get_value (klass, i))
+@@ -382,10 +383,10 @@ copy_pango_parse_enum (GType       type,
+                      G_ENUM_CLASS_TYPE_NAME(klass),
+                      s->str);
+ 
+-        if (possible_values)
+-          *possible_values = s->str;
++        gstr = g_string_free (s, possible_values ? false : true);
+ 
+-        g_string_free (s, possible_values ? false : true);
++        if (possible_values)
++          *possible_values = gstr;
+       }
+     }
+ 
+@@ -1001,7 +1002,7 @@ read_file (FILE   *file,
+       if (ferror (file))
+         {
+           fprintf(stderr, _("%s: Error reading file.\n"), g_get_prgname ());
+-          g_string_free (inbuf, true);
++          (void) g_string_free (inbuf, true);
+           exit(1);
+         }
+       else if (bp == nullptr)
+@@ -1043,8 +1044,7 @@ read_file (FILE   *file,
+   if (inbuf->len && inbuf->str[inbuf->len-1] != '\n')
+     g_string_append(inbuf, "\n");
+ 
+-  text = inbuf->str;
+-  g_string_free (inbuf, false);
++  text = g_string_free (inbuf, false);
+ 
+   if (encoding != nullptr && cvh != nullptr)
+     g_iconv_close(cvh);
+@@ -1671,7 +1671,11 @@ get_date()
+       fprintf(stderr, _("%1$s: Error while converting date string from '%2$s' 
to UTF-8.\n"),
+         g_get_prgname(), get_encoding());
+       /* Return the unconverted string. */
+-      g_string_free(inbuf, false);
++      /*
++       * inbuf isn't used here, but a few memory is
++       * allocated by default. so it should be freed anyway.
++       */
++      (void) g_string_free(inbuf, true);
+       g_iconv_close(cvh);
+       return date;
+     }
+@@ -1679,8 +1683,7 @@ get_date()
+     obuffer[BUFSIZE * 6 - 1 - oblen] = 0;
+     g_string_append(inbuf, bp);
+ 
+-    date_utf8 = inbuf->str;
+-    g_string_free(inbuf, false);
++    date_utf8 = g_string_free(inbuf, false);
+     g_iconv_close(cvh);
+   }
+ 

diff --git a/app-text/paps/metadata.xml b/app-text/paps/metadata.xml
index 9a99904e90fd..bf1f3468d302 100644
--- a/app-text/paps/metadata.xml
+++ b/app-text/paps/metadata.xml
@@ -3,6 +3,7 @@
 <pkgmetadata>
        <!-- maintainer-needed -->
        <upstream>
-               <remote-id type="sourceforge">paps</remote-id>
+               <remote-id type="sourceforge">paps</remote-id><!-- old -->
+               <remote-id type="github">dov/paps</remote-id>
        </upstream>
 </pkgmetadata>

diff --git a/app-text/paps/paps-0.8.0.ebuild b/app-text/paps/paps-0.8.0.ebuild
new file mode 100644
index 000000000000..f240e3305b90
--- /dev/null
+++ b/app-text/paps/paps-0.8.0.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} )
+
+inherit edo meson python-r1
+
+DESCRIPTION="Unicode-aware text to PostScript converter"
+HOMEPAGE="https://github.com/dov/paps";
+SRC_URI="https://github.com/dov/paps/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="
+       ${PYTHON_DEPS}
+       dev-libs/glib:2
+       dev-libs/libfmt:=
+       x11-libs/cairo
+       x11-libs/pango
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       # patches merged in upstream, to be removed for the next version.
+       "${FILESDIR}"/${P}-fix_glib.patch
+       "${FILESDIR}"/${P}-fix_unused_results.patch
+       "${FILESDIR}"/${P}-fix_fmt11.2.patch
+)
+
+src_prepare() {
+       default
+
+       # even if it can be changed with --pango-outlang-path, fix the default 
value
+       sed -e "/^pango_outlang_path =/s/\/usr\/local/${EPREFIX}\/usr/" \
+               -i scripts/src-to-paps || die
+}
+
+src_test() {
+       edo "${BUILD_DIR}"/src/paps examples/small-hello.utf8 -o 
"${T}"/test-out.ps
+}
+
+src_install() {
+       meson_src_install
+
+       python_foreach_impl python_doscript scripts/src-to-paps
+}

Reply via email to