Resolves: rhbz#521513 try gdk-pixbuf before ImageMagick convert

This commit is contained in:
Caolan McNamara 2009-09-07 09:58:37 +00:00
parent 9e688f52b6
commit d818e2f5c2
2 changed files with 102 additions and 2 deletions

View File

@ -0,0 +1,94 @@
diff -ru libgsf-1.14.15.ori/configure.in libgsf-1.14.15/configure.in
--- libgsf-1.14.15.ori/configure.in 2009-09-07 09:24:35.000000000 +0100
+++ libgsf-1.14.15/configure.in 2009-09-07 10:30:22.000000000 +0100
@@ -468,6 +468,28 @@
fi
AC_SUBST(BONOBO_REQ)
+want_gdk_pixbuf=no
+dnl check for gdk_pixbuf
+AC_ARG_WITH(gdk_pixbuf,
+ AC_HELP_STRING([--without-gdk-pixbuf],[disable the use of gdk-pixbuf]),
+ [case "${withval}" in
+ yes) want_gdk_pixbuf=yes ;;
+ no) want_gdk_pixbuf=no ;;
+ *) AC_MSG_ERROR(bad value ${withval} for --with-gdk-pixbuf) ;;
+ esac],
+ [want_gdk_pixbuf=auto]) dnl Default value
+
+if test $want_gdk_pixbuf = no ; then
+ AC_MSG_WARN([gdk-pixbuf support disabled, as requested (Use --with-gdk-pixbuf to enable)])
+else
+ PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0,
+ [AC_DEFINE(HAVE_GDK_PIXBUF, 1, [Define if gdk-pixbuf is available])],
+ [if test $want_gdk_pixbuf = yes; then
+ AC_MSG_ERROR([gdk-pixbuf support requested, but not available.])
+ else
+ AC_MSG_WARN([gdk-pixbuf support disabled, unable to find required version])
+ fi])
+fi
have_gnome=no
if test $want_gnome = no ; then
diff -ru libgsf-1.14.15.ori/gsf-config.h.in libgsf-1.14.15/gsf-config.h.in
--- libgsf-1.14.15.ori/gsf-config.h.in 2009-09-07 09:24:35.000000000 +0100
+++ libgsf-1.14.15/gsf-config.h.in 2009-09-07 10:32:10.000000000 +0100
@@ -30,6 +30,9 @@
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
+/* Define if gdk-pixbuf is available */
+#undef HAVE_GDK_PIXBUF
+
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
diff -ru libgsf-1.14.15.ori/thumbnailer/main.c libgsf-1.14.15/thumbnailer/main.c
--- libgsf-1.14.15.ori/thumbnailer/main.c 2009-09-07 09:24:35.000000000 +0100
+++ libgsf-1.14.15/thumbnailer/main.c 2009-09-07 10:33:13.000000000 +0100
@@ -32,6 +32,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
+#include <gsf-config.h>
+
+#ifdef HAVE_GDK_PIXBUF
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#endif
#ifdef HAVE_SETRLIMI
#include <sys/resource.h>
@@ -62,6 +67,20 @@
GError *error;
gint exit_status;
+#ifdef HAVE_GDK_PIXBUF
+ GdkPixbuf* pixbuf;
+
+ pixbuf = gdk_pixbuf_new_from_file_at_scale (in_filename, thumb_size, thumb_size,
+ TRUE, NULL);
+ if (pixbuf)
+ {
+ gboolean success = gdk_pixbuf_save (pixbuf, out_filename, "png", NULL, NULL);
+ g_object_unref (pixbuf);
+ if (success)
+ return;
+ }
+#endif
+
in_quote = g_shell_quote (in_filename);
out_quote = g_shell_quote (out_filename);
cmd_line = g_strdup_printf ("convert %s +matte -thumbnail %dx%d png:%s",
diff -ru libgsf-1.14.15.ori/thumbnailer/Makefile.am libgsf-1.14.15/thumbnailer/Makefile.am
--- libgsf-1.14.15.ori/thumbnailer/Makefile.am 2009-09-07 09:24:35.000000000 +0100
+++ libgsf-1.14.15/thumbnailer/Makefile.am 2009-09-07 10:33:39.000000000 +0100
@@ -1,7 +1,7 @@
@INTLTOOL_SCHEMAS_RULE@
-AM_CPPFLAGS = -I$(top_srcdir) $(LIBGSF_CFLAGS) $(LIBXML_CFLAGS)
-LDADD = $(top_builddir)/gsf/libgsf-1.la $(LIBGSF_LIBS)
+AM_CPPFLAGS = -I$(top_srcdir) $(LIBGSF_CFLAGS) $(GDK_PIXBUF_CFLAGS) $(LIBXML_CFLAGS)
+LDADD = $(top_builddir)/gsf/libgsf-1.la $(LIBGSF_LIBS) $(GDK_PIXBUF_LIBS)
bin_PROGRAMS = gsf-office-thumbnailer

View File

@ -4,15 +4,16 @@
Summary: GNOME Structured File library
Name: libgsf
Version: 1.14.15
Release: 3%{?dist}
Release: 4%{?dist}
Group: System Environment/Libraries
License: LGPLv2
Source: ftp://ftp.gnome.org/pub/GNOME/sources/%{name}/1.14/%{name}-%{version}.tar.bz2
URL: http://www.gnome.org/projects/libgsf/
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: glib2-devel, perl-XML-Parser
BuildRequires: glib2-devel, perl-XML-Parser, autoconf
BuildRequires: libtool, libxml2-devel, glib2-devel, bzip2-devel, gettext
BuildRequires: libbonobo-devel, pygtk2-devel, intltool, gnome-vfs2-devel
Patch0: libgsf.gnomeXXXXX.gdk-pixbuf.patch
Requires(pre): GConf2
Requires(post): GConf2
Requires(preun): GConf2
@ -58,8 +59,10 @@ Python bindings for libgsf
%prep
%setup -q
%patch0 -p1 -b .gnomeXXXXX.gdk-pixbuf
%build
autoreconf
%configure --disable-gtk-doc --disable-static
make %{?_smp_mflags}
@ -133,6 +136,9 @@ fi
rm -r $RPM_BUILD_ROOT
%changelog
* Mon Sep 07 2009 Caolán McNamara <caolanm@redhat.com> 1.14.15-4
- Resolves: rhbz#521513 try gdk-pixbuf before ImageMagick convert
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.14.15-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild