commit: ff080c7f5689ff52bcacacdc6bb1716fad594acc Author: Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr> AuthorDate: Fri Jul 11 18:02:07 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Jul 12 05:54:59 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff080c7f
app-text/psiconv: add 0.9.9 bump EAPI SRC_URI httpS, website has moved add imagemagick in IUSE (enabled by default) use eautoreconf to modernize building and use the patched configure.in add basic tests with examples files patches : remove declaration for getopt, not needed with glibc and musl (bug 944761) fix imagemagick with new API and detection (bug 886293) bug 886291 fixed because the doc is generated w/ another script now (xhtml) Closes: https://bugs.gentoo.org/886291 Closes: https://bugs.gentoo.org/886293 Closes: https://bugs.gentoo.org/944761 Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr> Part-of: https://github.com/gentoo/gentoo/pull/42959 Closes: https://github.com/gentoo/gentoo/pull/42959 Signed-off-by: Sam James <sam <AT> gentoo.org> app-text/psiconv/Manifest | 1 + .../psiconv/files/psiconv-0.9.9-fix_getopt.patch | 23 ++ .../files/psiconv-0.9.9-fix_imagemagick.patch | 246 +++++++++++++++++++++ app-text/psiconv/psiconv-0.9.9.ebuild | 67 ++++++ 4 files changed, 337 insertions(+) diff --git a/app-text/psiconv/Manifest b/app-text/psiconv/Manifest index 87a0d6f8235c..9a979a372729 100644 --- a/app-text/psiconv/Manifest +++ b/app-text/psiconv/Manifest @@ -1 +1,2 @@ DIST psiconv-0.8.3.tar.gz 326460 BLAKE2B add1a863c706dfe00ddace65e7083924cd37766a7e17339d1626c6a65ba00bb72e6687a6e1409febf81efd5fb1f7937b60f83e8afcca67f3a47c40611118c82c SHA512 a48814f64fd2c3dda0dfa13c331d2d60ff8674ab7a56f51efcad29d3dd6874f4b94dc0a21ef3066b0fa605b18635ee151fbb4e3eeb06dab3854a329ed70348a9 +DIST psiconv-0.9.9.tar.gz 554882 BLAKE2B ff27054bd447503900e96007818c849889c33d997559e06efed1a63a671e65cafbd81528c66852b3291eecef9deb44139d76b0deed9b3d6fb506d19729c7fac0 SHA512 ec21d1e4734ad79dc19146223d7016bd53b3a3bb602f3a55489663ccbf3a4c6f5c6417728e798b4448acc2e49ff5145f58c812edfdd6c11ee9060128b6157d3a diff --git a/app-text/psiconv/files/psiconv-0.9.9-fix_getopt.patch b/app-text/psiconv/files/psiconv-0.9.9-fix_getopt.patch new file mode 100644 index 000000000000..d5aad908a7de --- /dev/null +++ b/app-text/psiconv/files/psiconv-0.9.9-fix_getopt.patch @@ -0,0 +1,23 @@ +# We don't need to declare getopt +# No conflict with musl or glibc +diff --git a/compat/getopt.h b/compat/getopt.h +index b0147e9..62de71c 100644 +--- a/compat/getopt.h ++++ b/compat/getopt.h +@@ -127,15 +127,7 @@ struct option + `getopt'. */ + + #if defined __STDC__ && __STDC__ +-# ifdef __GNU_LIBRARY__ +-/* Many other libraries have conflicting prototypes for getopt, with +- differences in the consts, in stdlib.h. To avoid compilation +- errors, only prototype getopt for the GNU C library. */ +-extern int getopt (int __argc, char *const *__argv, const char *__shortopts); +-# else /* not __GNU_LIBRARY__ */ +-extern int getopt (); +-# endif /* __GNU_LIBRARY__ */ +- ++// getopt already declared in glibc and musl + # ifndef __need_getopt + extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, + const struct option *__longopts, int *__longind); diff --git a/app-text/psiconv/files/psiconv-0.9.9-fix_imagemagick.patch b/app-text/psiconv/files/psiconv-0.9.9-fix_imagemagick.patch new file mode 100644 index 000000000000..fc6947cebc5b --- /dev/null +++ b/app-text/psiconv/files/psiconv-0.9.9-fix_imagemagick.patch @@ -0,0 +1,246 @@ +https://git.pld-linux.org/?p=packages/psiconv.git;a=blob;f=psiconv-magick.patch +Allow new API for imagemagick +Avoid Magick-config hardcoded +--- psiconv-0.9.9/configure.in 2014-10-22 20:38:11.000000000 +0200 ++++ psiconv-0.9.9/configure.in 2019-07-01 18:49:10.146154303 +0200 +@@ -67,22 +67,33 @@ + [IMAGEMAGICK=$withval], + [IMAGEMAGICK='yes']) + if test x"$IMAGEMAGICK" != xno ; then +- AC_CHECK_PROG(IMAGEMAGICK,Magick-config,yes,no) +- if test x"$IMAGEMAGICK" != xno ; then ++ AC_CHECK_PROG(MAGICKCONFIG,Magick-config,yes,no) ++ if test x"$MAGICKCONFIG" != xno ; then + CFLAGS_OLD="$CFLAGS" + CPPFLAGS_OLD="$CPPFLAGS" + LDFLAGS_OLD="$LDFLAGS" + LIBS_OLD="$LIBS" +- CFLAGS="$CFLAGS `Magick-config --cflags`" +- CPPFLAGS="$CPPFLAGS `Magick-config --cppflags`" +- LDFLAGS="$LDFLAGS `Magick-config --ldflags`" +- LIBS="$LIBS `Magick-config --libs`" ++ CFLAGS="$CFLAGS `$MAGICKCONFIG --cflags`" ++ CPPFLAGS="$CPPFLAGS `$MAGICKCONFIG --cppflags`" ++ LDFLAGS="$LDFLAGS `$MAGICKCONFIG --ldflags`" ++ LIBS="$LIBS `$MAGICKCONFIG --libs`" + + + AC_MSG_CHECKING(whether GetMagickInfo works and which API to use) + AC_TRY_RUN([ #include <stdio.h> + #include <stdlib.h> + #include <time.h> ++ #include <MagickCore/MagickCore.h> ++ int main(void) { ++ unsigned long number_formats; ++ ExceptionInfo *exception = AcquireExceptionInfo(); ++ GetMagickInfoList("*",&number_formats,exception); ++ return number_formats == 0; }], ++ IMAGEMAGICK=5,IMAGEMAGICK=no,IMAGEMAGICK=no) ++ if test x"$IMAGEMAGICK" = xno ; then ++ AC_TRY_RUN([ #include <stdio.h> ++ #include <stdlib.h> ++ #include <time.h> + #include <magick/api.h> + int main(void) { + unsigned long number_formats; +@@ -92,6 +103,7 @@ + GetMagickInfoList("*",&number_formats,&exception); + return number_formats == 0; }], + IMAGEMAGICK=4,IMAGEMAGICK=no,IMAGEMAGICK=no) ++ fi + if test x"$IMAGEMAGICK" = xno ; then + AC_TRY_RUN([ #include <stdio.h> + #include <stdlib.h> +@@ -148,7 +148,7 @@ + fi + fi + if test x"$IMAGEMAGICK" != xno ; then +- LIB_MAGICK="`Magick-config --libs` `Magick-config --ldflags`" ++ LIB_MAGICK="`$MAGICKCONFIG --libs` `$MAGICKCONFIG --ldflags`" + AC_DEFINE(IMAGEMAGICK, 1 ,[ImageMagick availability]) + AC_DEFINE_UNQUOTED(IMAGEMAGICK_API, $IMAGEMAGICK, [ImageMagick API version]) + else +--- psiconv-0.9.9/program/psiconv/magick-aux.h 2014-10-22 21:46:01.000000000 +0200 ++++ psiconv-0.9.9/program/psiconv/magick-aux.h 2019-07-02 17:01:45.109667769 +0200 +@@ -21,7 +21,11 @@ + + #if IMAGEMAGICK + +-#if IMAGEMAGICK_API == 1 ++#if IMAGEMAGICK_API >= 5 ++ ++#include <MagickCore/MagickCore.h> ++ ++#elif IMAGEMAGICK_API == 1 + + #include <magick/magick.h> + +@@ -34,7 +38,7 @@ + + #endif /* IMAGEMAGICK_API == 1 */ + +-#if IMAGEMAGICK_API == 100 ++#if IMAGEMAGICK_API >= 5 /* IM 7 or GM */ + + #define DestroyImages DestroyImageList + +--- psiconv-0.9.9/program/psiconv/gen_image.c 2014-10-22 21:45:59.000000000 +0200 ++++ psiconv-0.9.9/program/psiconv/gen_image.c 2019-07-02 17:20:52.370119193 +0200 +@@ -56,9 +56,13 @@ + Image *image; + float *pixel, *p, *red, *green, *blue; + int x,y; +- ExceptionInfo exc; ++#if IMAGEMAGICK_API >= 5 ++ ExceptionInfo *pexc = AcquireExceptionInfo(); ++#else ++ ExceptionInfo exc, *pexc = &exc; + + GetExceptionInfo(&exc); ++#endif + red = sec->red; + green = sec->green; + blue = sec->blue; +@@ -71,14 +75,14 @@ + } + } + +- image = ConstituteImage(sec->xsize,sec->ysize,"RGB",FloatPixel,pixel,&exc); +- if (! image || (exc.severity != UndefinedException)) { +- MagickError(exc.severity,exc.reason,exc.description); ++ image = ConstituteImage(sec->xsize,sec->ysize,"RGB",FloatPixel,pixel,pexc); ++ if (! image || (pexc->severity != UndefinedException)) { ++ MagickError(pexc->severity,pexc->reason,pexc->description); + exit(1); + } + free(pixel); + +- DestroyExceptionInfo(&exc); ++ DestroyExceptionInfo(pexc); + + return image; + } +@@ -87,17 +91,23 @@ + void image_to_list(psiconv_list list,Image *image,const char *dest) + { + ImageInfo *image_info; +- ExceptionInfo exc; ++#if IMAGEMAGICK_API >= 5 ++ ExceptionInfo *pexc = AcquireExceptionInfo(); ++#else ++ ExceptionInfo exc, *pexc = &exc; ++#endif + size_t length; + unsigned char *data; + int i; + + strcpy(image->magick,dest); + image_info = CloneImageInfo(NULL); ++#if IMAGEMAGICK_API < 5 + GetExceptionInfo(&exc); +- data = ImageToBlob(image_info,image,&length,&exc); +- if (!data || (exc.severity != UndefinedException)) { +- MagickError(exc.severity,exc.reason,exc.description); ++#endif ++ data = ImageToBlob(image_info,image,&length,pexc); ++ if (!data || (pexc->severity != UndefinedException)) { ++ MagickError(pexc->severity,pexc->reason,pexc->description); + exit(1); + } + for (i = 0; i < length; i++) { +@@ -106,7 +116,7 @@ + exit(1); + } + } +- DestroyExceptionInfo(&exc); ++ DestroyExceptionInfo(pexc); + DestroyImageInfo(image_info); + } + +@@ -119,18 +129,22 @@ + Image *image = NULL; + Image *last_image = NULL; + Image *this_image, *images; +- ExceptionInfo exc; + int i; ++#if IMAGEMAGICK_API >= 5 ++ ExceptionInfo *pexc = AcquireExceptionInfo(); ++#else ++ ExceptionInfo exc, *pexc = &exc; + + GetExceptionInfo(&exc); +- mi = GetMagickInfo(dest,&exc); +- if (!mi || (exc.severity != UndefinedException)) { +- MagickError(exc.severity,exc.reason,exc.description); ++#endif ++ mi = GetMagickInfo(dest,pexc); ++ if (!mi || (pexc->severity != UndefinedException)) { ++ MagickError(pexc->severity,pexc->reason,pexc->description); + exit(1); + } + + if ((psiconv_list_length(sections) < 1) || +- ((psiconv_list_length(sections)) > 1 && ! (mi->adjoin))) { ++ ((psiconv_list_length(sections)) > 1 && ! GetMagickAdjoin(mi))) { + fprintf(stderr,"This image type supports only one image\n"); + exit(1); + } +@@ -152,9 +166,9 @@ + + image_info = CloneImageInfo(NULL); + if (image->next) { +- images = CoalesceImages(image,&exc); +- if (!images || (exc.severity != UndefinedException)) { +- MagickError(exc.severity,exc.reason,exc.description); ++ images = CoalesceImages(image,pexc); ++ if (!images || (pexc->severity != UndefinedException)) { ++ MagickError(pexc->severity,pexc->reason,pexc->description); + exit(1); + } + } else +@@ -162,7 +176,7 @@ + + image_to_list(list,image,dest); + +- DestroyExceptionInfo(&exc); ++ DestroyExceptionInfo(pexc); + DestroyImageInfo(image_info); + if (image != images) + DestroyImages(image); +@@ -249,7 +263,7 @@ + ff.description = strdup(mi[i]->description); + ff.supported_format = FORMAT_CLIPART_SINGLE | FORMAT_MBM_SINGLE | + FORMAT_SKETCH; +- if (mi[i]->adjoin) ++ if (GetMagickAdjoin(mi[i])) + ff.supported_format |= FORMAT_MBM_MULTIPLE | FORMAT_CLIPART_MULTIPLE; + psiconv_list_add(fileformat_list,&ff); + } +--- psiconv-0.9.9/program/psiconv/magick-aux.c 2014-10-22 21:46:07.000000000 +0200 ++++ psiconv-0.9.9/program/psiconv/magick-aux.c 2019-07-02 17:22:32.846241534 +0200 +@@ -93,6 +93,25 @@ + return copy; + } + ++#elif IMAGEMAGICK_API == 5 ++ ++const MagickInfo ** GetMagickFileList(void) ++{ ++ const MagickInfo **mi; ++ const MagickInfo **copy; ++ size_t len; ++ int i; ++ ExceptionInfo *pexc = AcquireExceptionInfo(); ++ mi = GetMagickInfoList("*",&len,pexc); ++ copy = malloc((len+1) * sizeof(*copy)); ++ for (i = 0; i < len; i++) { ++ copy[i] = mi[i]; ++ } ++ copy[len] = NULL; ++ DestroyExceptionInfo(pexc); ++ return copy; ++} ++ + #elif IMAGEMAGICK_API == 100 + /* GraphicsMagick library */ + const MagickInfo ** GetMagickFileList(void) diff --git a/app-text/psiconv/psiconv-0.9.9.ebuild b/app-text/psiconv/psiconv-0.9.9.ebuild new file mode 100644 index 000000000000..186991909bde --- /dev/null +++ b/app-text/psiconv/psiconv-0.9.9.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools edo + +DESCRIPTION="Interpreter for Psion 5(MX) file formats" +HOMEPAGE="https://frodo.looijaard.name/project/psiconv" +SRC_URI="https://frodo.looijaard.name/system/files/software/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86" +IUSE="+imagemagick" + +# TIFF is the output by default for input image formats +RDEPEND="imagemagick? ( media-gfx/imagemagick:=[cxx,tiff] )" +DEPEND="${RDEPEND}" +BDEPEND="app-alternatives/bc" + +PATCHES=( + "${FILESDIR}"/${PN}-0.8.3-gcc10-fno-common.patch + "${FILESDIR}"/${PN}-0.9.9-fix_getopt.patch + "${FILESDIR}"/${PN}-0.9.9-fix_imagemagick.patch +) + +src_prepare() { + default + + # use patched configure.in, then modernize the build system + eautoreconf +} + +src_configure() { + local myeconfargs=( + MAGICKCONFIG="Magick++-config" + $(use_with imagemagick) + ) + econf "${myeconfargs[@]}" +} + +src_test() { + # test various encodings and output formats + # anyway the html doc is already generated with the freshly compiled binary + for file in Word TextEd; do + for e in UTF8 UCS2 ASCII; do + edo program/psiconv/psiconv examples/${file} -n 3 -e ${e} -T XHTML -o "${T}"/${file}-${e}.out + done + done + if use imagemagick; then + for file in Sketch Clipart MBM; do + edo program/psiconv/psiconv examples/${file} -n 3 -T TIFF -o "${T}"/${file}.out + done + fi +} + +src_install() { + default + + # no static archives + find "${D}" -name '*.la' -delete || die + + # move html in the docdir and remove source files + mv "${ED}"/usr/share/psiconv/xhtml "${ED}"/usr/share/doc/${PF}/html || die + rm -r "${ED}"/usr/share/psiconv || die +}
