File gimp.spec of Package gimp

#
# spec file for package gimp
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%global abiver 4
%global apiver 2.0

Name:           gimp
BuildRequires:  aalib-devel
BuildRequires:  alsa-devel
BuildRequires:  babl-devel
BuildRequires:  cairo-devel
BuildRequires:  dbus-1-glib-devel
BuildRequires:  fontconfig-devel
BuildRequires:  gegl-devel
BuildRequires:  glib2-devel
BuildRequires:  gtk2-devel
BuildRequires:  hal-devel
BuildRequires:  intltool
BuildRequires:  iso-codes-devel
BuildRequires:  libexif-devel
BuildRequires:  liblcms-devel
BuildRequires:  libmng-devel
BuildRequires:  libpng-devel
BuildRequires:  libpoppler-glib-devel
BuildRequires:  librsvg-devel
BuildRequires:  libtiff-devel
BuildRequires:  libwebkit-devel
BuildRequires:  libwmf-devel
BuildRequires:  pango-devel
BuildRequires:  python-gtk-devel
BuildRequires:  translation-update-upstream
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-libXfixes-devel
Url:            http://www.gimp.org/
Version:        2.6.11
Release:        13.<RELEASE18>
Suggests:       AdobeICCProfiles
Provides:       gimp-2.0 = %{version}
Obsoletes:      gimp-unstable < 2.6.0
Recommends:     %{name}-lang
Requires:       gtk2
Summary:        The GNU Image Manipulation Program
License:        GPL-2.0+
Group:          Productivity/Graphics/Bitmap Editors
Source:         ftp://ftp.gimp.org/pub/gimp/v2.6/%{name}-%{version}.tar.bz2
Source1:        macros.gimp
# openSUSE palette file
Source2:        openSUSE.gpl
Source99:       baselibs.conf
# PATCH-FIX-UPSTREAM gimp-CVE-2010-4540-and-more.patch CVE-2010-4540 CVE-2010-4541 CVE-2010-4542 bgo#639203 bnc#662043 vuntz@opensuse.org -- Fix various buffer overflows
Patch0:         gimp-CVE-2010-4540-and-more.patch
# PATCH-FIX-UPSTREAM gimp-CVE-2010-4543.patch CVE-2010-4543 bgo#639203 bnc#662043 vuntz@opensuse.org -- Fix a buffer overflow when reading a psp file
Patch1:         gimp-CVE-2010-4543.patch
# PATCH-FIX-UPSTREAM gimp-pyslice-cellspacing-fix.patch bgo#641259 bnc#698769 fisiu@opensuse.org -- py-slice cellspacing fix
Patch2:         gimp-pyslice-cellspacing-fix.patch
# PATCH-FIX-UPSTREAM gimp-CVE-2011-2896.patch CVE-2011-2896 bnc#711491 vuntz@opensuse.org -- Fix heap corruption and buffer overflow
Patch5:         gimp-CVE-2011-2896.patch
# Patches to fix bnc#775433
Patch6:         bnc#775433-01-file-cel-check-fread-g_fopen-return-values-and-pass-.patch
Patch7:         bnc#775433-02-file-cel-validate-header-data-CVE-2012-3403.patch
Patch8:         bnc#775433-03-file-cel-use-statically-allocated-palette-buffer.patch
Patch9:         bnc#775433-04-file-cel-use-g_set_error-for-errors-instead-of-g_mes.patch
Patch10:        bnc#775433-05-file-cel-close-file-on-error.patch
# Patches to fix bnc#724628
Patch11:        bnc#724628-0001-file-gif-load-limit-len-and-height-CVE-2012-3481.patch
Patch12:        bnc#724628-0002-file-gif-load-fix-type-overflow-CVE-2012-3481.patch
# Patch to fix bnc#763595
Patch13:        bnc#763595-gimp-fix-script-fu-buf-overflow-leak.patch
# Patch to fix bnc#769565
Patch14:        bnc#769565-gimp-NULL-ptr-crash-in-fit-format-handler.patch
# PATCH-FIX-UPSTREAM gimp-CVE-2012-5576.patch bnc#791372 bgo#687392 CVE-2012-5576 dimstar@opensuse.org -- Memory corruption vulnerability when reading XWD files, taken from git.
Patch15:        gimp-CVE-2012-5576.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       %{name}-branding >= 2.4 

Recommends:     %{name}-plugins-python = %{version} gimp-2.0-scanner-plugin %{name}-help-browser
Provides:       gimp(abi) = %{abiver}
Provides:       gimp(api) = %{apiver}

%description
The GIMP (GNU Image Manipulation Program) is a powerful image
composition and editing program, which can be extremely useful for
creating logos and other graphics for Web pages.  The GIMP offers many
of the tools and filters you would expect to find in similar commercial
offerings and contains some interesting extras as well. The GIMP
provides alarge image manipulation toolbox, including channel
operations and layers, effects, subpixel imaging and antialiasing, and
conversions- all including multilevel undo. The GIMP offers a scripting
facility, but many of the included scripts rely on fonts that we cannot
distribute.


%package branding-upstream
Summary:        The GNU Image Manipulation Program
Group:          Productivity/Graphics/Bitmap Editors
Provides:       %{name}-branding = %{version}
Conflicts:      otherproviders(%{name}-branding)
Obsoletes:      gimp-unstable-branding-upstream < 2.6.0
Supplements:    packageand(%{name}:branding-upstream)
# It is technically compatible with 2.4, but upstream branding has version specific image:
Conflicts:      %{name} < 2.6.0
#BRAND: /usr/share/gimp/2.0/images/gimp-splash.png is a splash screen in
#BRAND: GIMP, original size is 300x400. Bottom part displays "just
#BRAND: starting" text and progress bar.

%description branding-upstream
The GIMP (GNU Image Manipulation Program) is a powerful image
composition and editing program, which can be extremely useful for
creating logos and other graphics for Web pages.  The GIMP offers many
of the tools and filters you would expect to find in similar commercial
offerings and contains some interesting extras as well. The GIMP
provides alarge image manipulation toolbox, including channel
operations and layers, effects, subpixel imaging and antialiasing, and
conversions- all including multilevel undo. The GIMP offers a scripting
facility, but many of the included scripts rely on fonts that we cannot
distribute.


%package plugins-python
Summary:        The GNU Image Manipulation Program - python-gtk based plugins
Group:          Productivity/Graphics/Bitmap Editors
Requires:       %{name} = %{version}
Requires:       python-gtk
Supplements:    %{name}
Provides:       gimp-2.0-plugins-python = %{version}
Obsoletes:      gimp-unstable-plugins-python < 2.6.0
# For update from <= 10.3 and SLED 10:
Provides:       %{name}:%{_libdir}/gimp/2.0/plug-ins/pyconsole.py = %{version}
%py_requires

%description plugins-python
The GIMP (GNU Image Manipulation Program) is a powerful image
composition and editing program, which can be extremely useful for
creating logos and other graphics for Web pages.  The GIMP offers many
of the tools and filters you would expect to find in similar commercial
offerings and contains some interesting extras as well. The GIMP
provides alarge image manipulation toolbox, including channel
operations and layers, effects, subpixel imaging and antialiasing, and
conversions- all including multilevel undo. The GIMP offers a scripting
facility, but many of the included scripts rely on fonts that we cannot
distribute.


%package devel
Summary:        The GNU Image Manipulation Program
Group:          Productivity/Graphics/Bitmap Editors
Requires:       libgimp-2_0-0 = %{version}
Requires:       libgimpui-2_0-0 = %{version}
Provides:       gimp-2.0-devel = %{version}
Obsoletes:      gimp-doc <= 2.6.4
Obsoletes:      gimp-unstable-devel < 2.6.0
Provides:       gimp-doc = 2.6.4

%description devel
The GIMP (GNU Image Manipulation Program) is a powerful image
composition and editing program, which can be extremely useful for
creating logos and other graphics for Web pages.  The GIMP offers many
of the tools and filters you would expect to find in similar commercial
offerings and contains some interesting extras as well. The GIMP
provides alarge image manipulation toolbox, including channel
operations and layers, effects, subpixel imaging and antialiasing, and
conversions- all including multilevel undo. The GIMP offers a scripting
facility, but many of the included scripts rely on fonts that we cannot
distribute.


%package help-browser
Summary:        The GNU Image Manipulation Program - Help Browser
Group:          Productivity/Graphics/Bitmap Editors
Requires:       %{name} = %{version}
Supplements:    packageand(%{name}:gimp-help)

%description help-browser
This package contains the help browser for the GIMP.

%package module-hal
License:        GPLv2+
Summary:        The GNU Image Manipulation Program - module to detect input devices with HAL
Requires:       %{name} = %{version}
Supplements:    packageand(%{name}:hal)
Group:          Productivity/Graphics/Bitmap Editors

%description module-hal
The GIMP (GNU Image Manipulation Program) is a powerful image
composition and editing program, which can be extremely useful for
creating logos and other graphics for Web pages.  The GIMP offers many
of the tools and filters you would expect to find in similar commercial
offerings and contains some interesting extras as well. The GIMP
provides alarge image manipulation toolbox, including channel
operations and layers, effects, subpixel imaging and antialiasing, and
conversions- all including multilevel undo. The GIMP offers a scripting
facility, but many of the included scripts rely on fonts that we cannot
distribute.

This package provides a module to detect input devices with HAL.

%lang_package
%prep
%setup -q
translation-update-upstream
translation-update-upstream po-libgimp gimp20-libgimp
translation-update-upstream po-python gimp20-python
translation-update-upstream po-script-fu gimp20-script-fu
translation-update-upstream po-plug-ins gimp20-std-plug-ins
translation-update-upstream po-tips gimp20-tips
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1

# Safety check for ABI version change.
vabi=`printf "%d" $(sed -n '/#define GIMP_MODULE_ABI_VERSION/{s/.* //;p}' libgimpmodule/gimpmodule.h)`
if test "x${vabi}" != "x%{abiver}"; then
   : Error: Upstream ABI version is now ${vabi}, expecting %{abiver}.
   : Update the apiver macro and rebuild.
   exit 1
fi
# Safety check for API version change.
vapi=`sed -n '/#define GIMP_API_VERSION/{s/.* //;p}' libgimpbase/gimpversion.h | sed -e 's@"@@g'`
if test "x${vapi}" != "x%{apiver}"; then
   : Error: Upstream API version is now ${vapi}, expecting %{apiver}.
   : Update the apiver macro and rebuild.
   exit 1
fi

%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%configure --with-pic\
	--disable-static\
	--libexecdir=%{_prefix}/lib\
	--enable-default-binary\
	--enable-mp
make %{?jobs:-j%jobs}

%install
%makeinstall
install -D -m 0644 %{S:2} %{buildroot}%{_datadir}/gimp/2.0/palettes
%suse_update_desktop_file -N GIMP gimp
rm $RPM_BUILD_ROOT%{_libdir}/gimp/2.0/*/*.*a
%find_lang gimp20 %{?no_lang_C}
%find_lang gimp20-libgimp %{?no_lang_C} gimp20.lang
%find_lang gimp20-python %{?no_lang_C} gimp20.lang
%find_lang gimp20-script-fu %{?no_lang_C} gimp20.lang
%find_lang gimp20-std-plug-ins %{?no_lang_C} gimp20.lang
%find_lang gimp20-tips %{?no_lang_C} gimp20.lang
echo "%%defattr(-,root,root)" >plugins.list
echo "%%defattr(-,root,root)" >plugins-python.list
for PLUGIN in $RPM_BUILD_ROOT%{_libdir}/gimp/2.0/plug-ins/* ; do
    if grep -q '^#!.*python' $PLUGIN ; then
	echo "${PLUGIN#$RPM_BUILD_ROOT}" >>plugins-python.list
    else
	echo "${PLUGIN#$RPM_BUILD_ROOT}" >>plugins.list
    fi
done
rm %{buildroot}%{_libdir}/*.la
# Install the macros file:
install -d $RPM_BUILD_ROOT%{_sysconfdir}/rpm
sed -e "s/@GIMP_APIVER@/%{apiver}/;s/@GIMP_ABIVER@/%{abiver}/" \
    < $RPM_SOURCE_DIR/macros.gimp > macros.gimp
install -m 644 -c macros.gimp \
           $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.gimp

%post -p /sbin/ldconfig
%if 0%{?suse_version} > 1130
%desktop_database_post
%icon_theme_cache_post
%endif

%postun -p /sbin/ldconfig
%if 0%{?suse_version} > 1130
%desktop_database_postun
%icon_theme_cache_postun
%endif


%clean
rm -rf $RPM_BUILD_ROOT

%files -f plugins.list
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog LICENSE NEWS* README
%exclude %{_libdir}/gimp/2.0/plug-ins/help-browser
%{_bindir}/gimp
%{_bindir}/gimp-2.?
%{_bindir}/gimp-console
%{_bindir}/gimp-console-2.?
%{_datadir}/applications/gimp.desktop
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/icons/hicolor/*/apps/*.svg
%{_datadir}/gimp/
%exclude %{_datadir}/gimp/2.0/images/gimp-splash.png
%{_libdir}/gimp/2.0/environ/default.env
%{_libdir}/gimp/2.0/interpreters/default.interp
%{_libdir}/gimp/2.0/modules/*.so
%exclude %{_libdir}/gimp/2.0/modules/libcontroller-linux-input.so
%doc %{_mandir}/man?/gimp.*
%doc %{_mandir}/man?/gimp-2.?.*
%doc %{_mandir}/man?/gimp-console.*
%doc %{_mandir}/man?/gimp-console-2.?.*
%doc %{_mandir}/man?/gimprc.*
%doc %{_mandir}/man?/gimprc-2.?.*
%dir %{_sysconfdir}/gimp
%dir %{_sysconfdir}/gimp/2.0
%config %{_sysconfdir}/gimp/2.0/*rc
%dir %{_datadir}/gimp
%dir %{_datadir}/gimp/2.0
%dir %{_libdir}/gimp
%dir %{_libdir}/gimp/2.0
%dir %{_libdir}/gimp/2.0/environ
%dir %{_libdir}/gimp/2.0/interpreters
%dir %{_libdir}/gimp/2.0/modules
%dir %{_libdir}/gimp/2.0/plug-ins
%{_libdir}/libgimp-2.0.so.*
%{_libdir}/libgimpbase-2.0.so.*
%{_libdir}/libgimpcolor-2.0.so.*
%{_libdir}/libgimpconfig-2.0.so.*
%{_libdir}/libgimpmath-2.0.so.*
%{_libdir}/libgimpmodule-2.0.so.*
%{_libdir}/libgimpthumb-2.0.so.*
%{_libdir}/libgimpui-2.0.so.*
%{_libdir}/libgimpwidgets-2.0.so.*

%files help-browser
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog LICENSE NEWS* README
%{_libdir}/gimp/2.0/plug-ins/help-browser

%files branding-upstream
%defattr(-,root,root)
%{_datadir}/gimp/2.0/images/gimp-splash.png

%files plugins-python -f plugins-python.list
%defattr(-,root,root)
%{_libdir}/gimp/2.0/environ/pygimp.env
%{_libdir}/gimp/2.0/interpreters/pygimp.interp
%{_libdir}/gimp/2.0/python/

%files module-hal
%defattr(-,root,root)
%{_libdir}/gimp/2.0/modules/libcontroller-linux-input.so

%files lang -f gimp20.lang

%files devel
%defattr(-,root,root)
%doc README.i18n
%{_bindir}/gimptool-2.0
%doc %{_mandir}/man?/gimptool-2.0.*
%{_datadir}/aclocal/*.m4
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
# Own these repositories to not depend on gtk-doc while building:
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%{_datadir}/gtk-doc/html/*
%config %{_sysconfdir}/rpm/macros.gimp

%changelog