[packages/psiconv] - updated to 0.9.9 - added magick patch (adjust to ImageMagick 7 API)

qboosh qboosh at pld-linux.org
Tue Jul 2 18:20:03 CEST 2019


commit 82ce5e402da123a2972ad554e19001943d12cf8b
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Jul 2 18:21:24 2019 +0200

    - updated to 0.9.9
    - added magick patch (adjust to ImageMagick 7 API)

 psiconv-magick.patch | 243 +++++++++++++++++++++++++++++++++++++++++++++++++++
 psiconv.spec         |  40 ++++++---
 2 files changed, 269 insertions(+), 14 deletions(-)
---
diff --git a/psiconv.spec b/psiconv.spec
index da6e213..3c57f74 100644
--- a/psiconv.spec
+++ b/psiconv.spec
@@ -1,17 +1,20 @@
 Summary:	Psion 5 data format library
 Summary(pl.UTF-8):	Biblioteka obsługi plików Psion 5
 Name:		psiconv
-Version:	0.9.8
-Release:	3
-License:	GPL
+Version:	0.9.9
+Release:	1
+License:	GPL v2+
 Group:		Libraries
-Source0:	http://software.frodo.looijaard.name/psiconv/files/%{name}-%{version}.tar.gz
-# Source0-md5:	8d7548e3c6b9cd408544736133728acd
-URL:		http://software.frodo.looijaard.name/psiconv/
-BuildRequires:	ImageMagick-devel
+Source0:	http://www.frodo.looijaard.name/system/files/software/psiconv/%{name}-%{version}.tar.gz
+# Source0-md5:	286e427b10f4d10aaeef1944210a2ea6
+Patch0:		%{name}-magick.patch
+URL:		http://frodo.looijaard.name/project/psiconv
+BuildRequires:	ImageMagick-devel >= 1:6
+BuildRequires:	autoconf
 BuildRequires:	automake
+# for formats/index_html.sh
 BuildRequires:	bc
-BuildRequires:	gcc-c++
+BuildRequires:	libtool
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -60,10 +63,16 @@ Statyczna biblioteka psiconv.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
-cp -f /usr/share/automake/config.sub .
-%configure
+%{__libtoolize}
+%{__aclocal}
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+%configure \
+	MAGICKCONFIG=MagickCore-config
 %{__make}
 
 %install
@@ -72,7 +81,9 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-rm -rf formats/xhtml/.temp
+%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/psiconv.conf.eg
+
+%{__rm} -r formats/xhtml/.temp
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -82,16 +93,17 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc AUTHORS NEWS README TODO
+%doc AUTHORS ChangeLog NEWS README TODO
 %attr(755,root,root) %{_bindir}/psiconv
 %attr(755,root,root) %{_libdir}/libpsiconv.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libpsiconv.so.?
+%attr(755,root,root) %ghost %{_libdir}/libpsiconv.so.6
 %dir %{_sysconfdir}/%{name}
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/psiconv.conf
 %dir %{_datadir}/%{name}
 %{_datadir}/%{name}/psion
 %{_datadir}/%{name}/xhtml
 %{_mandir}/man1/psiconv.1*
+%{_mandir}/man5/psiconv.conf.5*
 
 %files devel
 %defattr(644,root,root,755)
diff --git a/psiconv-magick.patch b/psiconv-magick.patch
new file mode 100644
index 0000000..ba6e4e2
--- /dev/null
+++ b/psiconv-magick.patch
@@ -0,0 +1,243 @@
+--- psiconv-0.9.9/configure.in.orig	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.orig	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.orig	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.orig	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)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/psiconv.git/commitdiff/82ce5e402da123a2972ad554e19001943d12cf8b



More information about the pld-cvs-commit mailing list