gimp update to devel 2.99

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 2022-11-21 00:54:47 +01:00
parent a75fc511ca
commit cf32569d0d
3 changed files with 338 additions and 136 deletions

View File

@ -0,0 +1,60 @@
From 4f99f1fcfd892ead19831b5adcd38a99d71214b6 Mon Sep 17 00:00:00 2001
From: Jacob Boerema <jgboerema@gmail.com>
Date: Fri, 29 Apr 2022 16:40:32 -0400
Subject: [PATCH] app: fix #8120 GIMP 2.10.30 crashed when allocate large
memory

GIMP could crash if the information regarding old path properties read
from XCF was incorrect. It did not check if xcf_old_path succeeded and
kept trying to load more paths even if the last one failed to load.

Instead we now stop loading paths as soon as that function fails.
In case we have a failure here we also try to skip to the next property
based on the size of the path property, in hopes that the only problem
was this property.
---
app/xcf/xcf-load.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index ac9c4ea248..67bc766390 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -1168,7 +1168,12 @@ xcf_load_image_props (XcfInfo *info,
break;
case PROP_PATHS:
- xcf_load_old_paths (info, image);
+ {
+ goffset base = info->cp;
+
+ if (! xcf_load_old_paths (info, image))
+ xcf_seek_pos (info, base + prop_size, NULL);
+ }
break;
case PROP_USER_UNIT:
@@ -3035,8 +3040,11 @@ xcf_load_old_paths (XcfInfo *info,
xcf_read_int32 (info, &last_selected_row, 1);
xcf_read_int32 (info, &num_paths, 1);
+ GIMP_LOG (XCF, "Number of old paths: %u", num_paths);
+
while (num_paths-- > 0)
- xcf_load_old_path (info, image);
+ if (! xcf_load_old_path (info, image))
+ return FALSE;
active_vectors =
GIMP_VECTORS (gimp_container_get_child_by_index (gimp_image_get_vectors (image),
@@ -3087,7 +3095,7 @@ xcf_load_old_path (XcfInfo *info,
}
else if (version != 1)
{
- g_printerr ("Unknown path type. Possibly corrupt XCF file");
+ g_printerr ("Unknown path type (version: %u). Possibly corrupt XCF file.\n", version);
g_free (name);
return FALSE;
--
GitLab

View File

@ -0,0 +1,31 @@
From 22af0bcfe67c1c86381f33975ca7fdbde6b36b39 Mon Sep 17 00:00:00 2001
From: Jacob Boerema <jgboerema@gmail.com>
Date: Sun, 5 Jun 2022 15:38:24 -0400
Subject: [PATCH] app: fix #8230 crash in gimp_layer_invalidate_boundary when
channel is NULL

gimp_channel_is_empty returns FALSE if channel is NULL. This causes
gimp_layer_invalidate_boundary to crash if the mask channel is NULL.

With a NULL channel gimp_channel_is_empty should return TRUE, just like
the similar gimp_image_is_empty does, because returning FALSE here
suggests we have a non empty channel.
---
app/core/gimpchannel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 7b6a9851ae..502821ba58 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1827,7 +1827,7 @@ gimp_channel_boundary (GimpChannel *channel,
gboolean
gimp_channel_is_empty (GimpChannel *channel)
{
- g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
+ g_return_val_if_fail (GIMP_IS_CHANNEL (channel), TRUE);
return GIMP_CHANNEL_GET_CLASS (channel)->is_empty (channel);
}
--
GitLab

View File

@ -1,3 +1,6 @@
# Set this to 0 in stable, 1 in (SONAME-wise) unstable releases
%global unstable 0

#### options: #### options:
# Use the following --with/--without <option> switches to control how the # Use the following --with/--without <option> switches to control how the
# package will be built: # package will be built:
@ -7,20 +10,24 @@
# static: build static libraries # static: build static libraries
%bcond_with static %bcond_with static
# default_binary: install unversioned binary # default_binary: install unversioned binary
%if ! %unstable
%bcond_without default_binary %bcond_without default_binary
%else
%bcond_with default_binary
%endif
# aalib: build with AAlib (ASCII art gfx library) # aalib: build with AAlib (ASCII art gfx library)
%bcond_without aalib %bcond_without aalib
# don't build webkit-based help browser by default # don't build webkit-based help browser by default
%bcond_with helpbrowser %bcond_with helpbrowser
# hardcode python interpreter in python plug-ins # hardcode python interpreter in python plug-ins
%bcond_with hardcoded_python %bcond_without hardcoded_python
# webp support # webp support
%bcond_without webp %bcond_without webp
# libunwind support (only available on some architectures) # libunwind support (only available on some architectures)
%bcond_without libunwind %bcond_without libunwind


# If Python plug-ins need to be byte-compiled separately # If Python plug-ins need to be byte-compiled separately
%bcond_with python_separately_bytecompile %bcond_without python_separately_bytecompile


%if %{with python_separately_bytecompile} %if %{with python_separately_bytecompile}
# Disable automatic compilation of Python files in extra directories # Disable automatic compilation of Python files in extra directories
@ -42,23 +49,61 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth
#global skip_checks_version X.Y.Z #global skip_checks_version X.Y.Z
#global skip_checks test1 test2 test3 #global skip_checks test1 test2 test3


# Set this in pre-releases (e.g. release candidates)
#global prerel RC1

# Set this when building from intermediate git revisions
#global gitrev ff6c280

%if %{defined prerel}
%global dotprerel .%{prerel}
%global dashprerel -%{prerel}
%global prerelprefix 0.
%else
%global dotprerel %{nil}
%global dashprerel %{nil}
%global prerelprefix %{nil}
%endif

%if %{defined gitrev}
%global dotgitrev .git%{gitrev}
%else
%global dotgitrev %{nil}
%endif

Summary: GNU Image Manipulation Program Summary: GNU Image Manipulation Program
Name: gimp Name: gimp
Epoch: 2 Epoch: 2
Version: 2.10.32 Version: 2.99.14
Release: 1%{?dist} %global rel 1
Release: %{?prerelprefix}%{rel}%{dotprerel}%{dotgitrev}%{?dist}


# Compute some version related macros. # Compute some version related macros.
# Ugly, need to get quoting percent signs straight. # Ugly, need to get quoting percent signs straight.
%global major %(ver=%{version}; echo ${ver%%%%.*}) %global major %(ver=%{version}; echo ${ver%%%%.*})
%global minor %(ver=%{version}; ver=${ver#%major.}; echo ${ver%%%%.*}) %global minor %(ver=%{version}; ver=${ver#%major.}; echo ${ver%%%%.*})
%global micro %(ver=%{version}; ver=${ver#%major.%minor.}; echo ${ver%%%%.*}) %global micro %(ver=%{version}; ver=${ver#%major.%minor.}; echo ${ver%%%%.*})
%global binver 2.10 %global binver 2.99
%global interface_age 0 %global interface_age 0
%global gettext_version %{major}0 %global gettext_version 30
%global lib_api_version %{major}.0 %global lib_api_version %{major}.99
%global unstable_so_version 3.0
%if ! %unstable
%global lib_minor %(echo $[%minor * 100]) %global lib_minor %(echo $[%minor * 100])
%global lib_micro %micro %global lib_micro %micro
%else
%global lib_minor %(echo $[%minor * 100 + %{micro}])
%global lib_micro 0
%endif

%if %unstable
%global os_bindir %{_bindir}
%global os_datadir %{_datadir}
%undefine _prefix
%undefine _sysconfdir
%global _prefix /opt/gimp-%{major}.%{minor}
%global _sysconfdir %{_prefix}/etc
%endif


# poppler is "GPLv2 or GPLv3" which makes plug-ins linking to libpoppler such # poppler is "GPLv2 or GPLv3" which makes plug-ins linking to libpoppler such
# as file-pdf-load GPLv3-only # as file-pdf-load GPLv3-only
@ -71,7 +116,7 @@ BuildRequires: alsa-lib-devel >= 1.0.0
BuildRequires: atk-devel >= 2.2.0 BuildRequires: atk-devel >= 2.2.0
BuildRequires: babl-devel >= 0.1.74 BuildRequires: babl-devel >= 0.1.74
BuildRequires: bzip2-devel BuildRequires: bzip2-devel
BuildRequires: cairo-devel >= 1.12.2 BuildRequires: cairo-devel >= 1.14.0
BuildRequires: fontconfig-devel >= 2.12.4 BuildRequires: fontconfig-devel >= 2.12.4
BuildRequires: freetype-devel >= 2.1.7 BuildRequires: freetype-devel >= 2.1.7
BuildRequires: gcc BuildRequires: gcc
@ -79,47 +124,41 @@ BuildRequires: gdk-pixbuf2-devel >= 2.30.8
BuildRequires: gegl04-tools BuildRequires: gegl04-tools
BuildRequires: gegl04-devel >= 0.4.32 BuildRequires: gegl04-devel >= 0.4.32
BuildRequires: libgs-devel BuildRequires: libgs-devel
BuildRequires: glib2-devel >= 2.56.2 BuildRequires: glib2-devel >= 2.68.0
BuildRequires: glib-networking BuildRequires: gtk3-devel >= 3.22.29
BuildRequires: gtk2-devel >= 2.24.32
BuildRequires: gtk-doc >= 1.0 BuildRequires: gtk-doc >= 1.0
BuildRequires: harfbuzz-devel >= 0.9.19 BuildRequires: harfbuzz-devel >= 1.0.5
BuildRequires: iso-codes-devel BuildRequires: iso-codes-devel
BuildRequires: jasper-devel BuildRequires: jasper-devel
BuildRequires: lcms2-devel >= 2.8 BuildRequires: lcms2-devel >= 2.8
BuildRequires: libappstream-glib BuildRequires: libappstream-glib, libappstream-glib-devel
BuildRequires: libarchive
BuildRequires: libgexiv2-devel >= 0.10.6 BuildRequires: libgexiv2-devel >= 0.10.6
BuildRequires: libgudev1-devel >= 167 BuildRequires: libgudev1-devel >= 167
BuildRequires: libjpeg-devel BuildRequires: libjpeg-devel
BuildRequires: libjxl-devel >= 0.6.1
BuildRequires: libmng-devel BuildRequires: libmng-devel
BuildRequires: libpng-devel >= 1.6.25 BuildRequires: libpng-devel >= 1.6.25
BuildRequires: librsvg2-devel >= 2.40.6 BuildRequires: librsvg2-devel >= 2.40.6
BuildRequires: libtiff-devel BuildRequires: libtiff-devel
%if %{with libunwind} #%if %{with libunwind}
BuildRequires: libunwind-devel >= 1.1.0 #BuildRequires: libunwind-devel >= 1.1.0
%endif #%endif
%if %{with webp} %if %{with webp}
BuildRequires: libwebp-devel >= 0.6.0 BuildRequires: libwebp-devel >= 0.6.0
%endif %endif
BuildRequires: libwmf-devel >= 0.2.8 BuildRequires: libwmf-devel >= 0.2.8
BuildRequires: libmypaint-devel >= 1.3.0 BuildRequires: libmypaint-devel >= 1.3.0
BuildRequires: mypaint-brushes-devel >= 1.3.0 BuildRequires: mypaint-brushes-devel >= 1.3.0
%if 0%{?fedora} > 34
BuildRequires: openexr-devel
BuildRequires: imath-devel
%else
BuildRequires: OpenEXR-devel >= 1.6.1 BuildRequires: OpenEXR-devel >= 1.6.1
%endif
BuildRequires: openjpeg2-devel >= 2.1.0 BuildRequires: openjpeg2-devel >= 2.1.0
BuildRequires: pango-devel >= 1.29.4 BuildRequires: pango-devel >= 1.29.4
BuildRequires: perl >= 5.10.0 BuildRequires: perl >= 5.10.0
BuildRequires: poppler-glib-devel >= 0.50.0 BuildRequires: poppler-glib-devel >= 0.50.0
BuildRequires: poppler-data-devel >= 0.4.7 BuildRequires: poppler-data-devel >= 0.4.7
BuildRequires: pycairo-devel >= 1.0.2 BuildRequires: python3-cairo-devel >= 1.0.2
BuildRequires: pygtk2-devel >= 2.10.4 #BuildRequires: pygtk2-devel >= 2.10.4
BuildRequires: pygobject2-devel BuildRequires: python3-gobject-devel
BuildRequires: python2-devel >= 2.5.0 BuildRequires: python3-devel >= 3.6.0
%if %{with helpbrowser} %if %{with helpbrowser}
BuildRequires: webkitgtk-devel >= 1.6.1 BuildRequires: webkitgtk-devel >= 1.6.1
%endif %endif
@ -134,22 +173,27 @@ BuildRequires: intltool >= 0.40.1
BuildRequires: gettext >= 0.19 BuildRequires: gettext >= 0.19
BuildRequires: make BuildRequires: make
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: vala


Requires: babl%{?_isa} >= 0.1.78 %if %unstable
BuildRequires: desktop-file-utils
BuildRequires: ImageMagick
%endif

Requires: babl%{?_isa} >= 0.1.74
Requires: gegl04%{?_isa} >= 0.4.32 Requires: gegl04%{?_isa} >= 0.4.32
Requires: fontconfig >= 2.12.4 Requires: fontconfig >= 2.12.4
Requires: freetype >= 2.1.7 Requires: freetype >= 2.1.7
Requires: glib2 >= 2.56.2 Requires: glib2 >= 2.68.0
Requires: glib-networking Requires: gtk3 >= 3.22.29
Requires: gtk2 >= 2.24.32
Requires: hicolor-icon-theme Requires: hicolor-icon-theme
%if %{with libunwind} #%if %{with libunwind}
Requires: libunwind%{?_isa} >= 1.1.0 #Requires: libunwind%{?_isa} >= 1.1.0
%endif #%endif
Requires: lcms2 >= 2.8 Requires: lcms2 >= 2.8
Recommends: mypaint-brushes Recommends: mypaint-brushes
Requires: pango >= 1.29.4 Requires: pango >= 1.29.4
Requires: pygtk2 >= 2.10.4 #Requires: pygtk2 >= 2.10.4
Requires: xdg-utils Requires: xdg-utils
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
%if %{with helpbrowser} %if %{with helpbrowser}
@ -158,12 +202,20 @@ Recommends: %{name}-help-browser = %{epoch}:%{version}-%{release}
Obsoletes: %{name}-help-browser < %{epoch}:%{version}-%{release} Obsoletes: %{name}-help-browser < %{epoch}:%{version}-%{release}
Conflicts: %{name}-help-browser < %{epoch}:%{version}-%{release} Conflicts: %{name}-help-browser < %{epoch}:%{version}-%{release}
%endif %endif
%if ! %unstable
Obsoletes: %{name}-unstable < %{epoch}:%{major}.%{minor}
Conflicts: %{name}-unstable < %{epoch}:%{major}.%{minor}
%endif


#Demodularizing of gimp (#1772469) #Demodularizing of gimp (#1772469)
Obsoletes: %{name} < %{epoch}:%{version}-%{release} Obsoletes: %{name} < %{epoch}:%{version}-%{release}
Conflicts: %{name} < %{epoch}:%{version}-%{release} Conflicts: %{name} < %{epoch}:%{version}-%{release}


Source0: http://download.gimp.org/pub/gimp/v%{binver}/gimp-%{version}.tar.bz2 Source0: http://download.gimp.org/pub/gimp/v%{binver}/gimp-%{version}%{dashprerel}.tar.bz2

%if %{defined gitrev}
Patch0: gimp-%{version}%{dashprerel}-git%{gitrev}.patch.bz2
%endif


# Try using the system monitor profile for color management by default. # Try using the system monitor profile for color management by default.
# Fedora specific. # Fedora specific.
@ -175,6 +227,15 @@ Patch2: gimp-2.10.12-default-font.patch
# don't phone home to check for updates by default # don't phone home to check for updates by default
Patch3: gimp-2.10.18-no-phone-home-default.patch Patch3: gimp-2.10.18-no-phone-home-default.patch


# no luajit available in RHEL-9
Patch4: gimp-remove-lua.patch

# CVE-2022-30067
Patch5: gimp-CVE-2022-30067.patch

# CVE-2022-32990
Patch6: gimp-CVE-2022-32990.patch

# use external help browser directly if help browser plug-in is not built # use external help browser directly if help browser plug-in is not built
Patch100: gimp-2.10.24-external-help-browser.patch Patch100: gimp-2.10.24-external-help-browser.patch


@ -190,6 +251,10 @@ with multi-level undo.
%package libs %package libs
Summary: GIMP libraries Summary: GIMP libraries
License: LGPLv3+ License: LGPLv3+
%if ! %unstable
Obsoletes: %{name}-unstable-libs < %{epoch}:%{major}.%{minor}
Conflicts: %{name}-unstable-libs < %{epoch}:%{major}.%{minor}
%endif
#Demodularizing of gimp (#1772469) #Demodularizing of gimp (#1772469)
Obsoletes: %{name}-libs < %{epoch}:%{version}-%{release} Obsoletes: %{name}-libs < %{epoch}:%{version}-%{release}
Conflicts: %{name}-libs < %{epoch}:%{version}-%{release} Conflicts: %{name}-libs < %{epoch}:%{version}-%{release}
@ -207,6 +272,10 @@ Requires: gtk2-devel
Requires: glib2-devel Requires: glib2-devel
Requires: pkgconfig Requires: pkgconfig
Requires: rpm >= 4.11.0 Requires: rpm >= 4.11.0
%if ! %unstable
Obsoletes: %{name}-unstable-devel < %{epoch}:%{major}.%{minor}
Conflicts: %{name}-unstable-devel < %{epoch}:%{major}.%{minor}
%endif
#Demodularizing of gimp (#1772469) #Demodularizing of gimp (#1772469)
Obsoletes: %{name}-devel < %{epoch}:%{version}-%{release} Obsoletes: %{name}-devel < %{epoch}:%{version}-%{release}
Conflicts: %{name}-devel < %{epoch}:%{version}-%{release} Conflicts: %{name}-devel < %{epoch}:%{version}-%{release}
@ -220,6 +289,10 @@ extensions.
Summary: GIMP plugin and extension development tools Summary: GIMP plugin and extension development tools
License: LGPLv3+ License: LGPLv3+
Requires: %{name}-devel = %{epoch}:%{version}-%{release} Requires: %{name}-devel = %{epoch}:%{version}-%{release}
%if ! %unstable
Obsoletes: %{name}-unstable-devel-tools < %{epoch}:%{major}.%{minor}
Conflicts: %{name}-unstable-devel-tools < %{epoch}:%{major}.%{minor}
%endif
#Demodularizing of gimp (#1772469) #Demodularizing of gimp (#1772469)
Obsoletes: %{name}-devel-tools < %{epoch}:%{version}-%{release} Obsoletes: %{name}-devel-tools < %{epoch}:%{version}-%{release}
Conflicts: %{name}-devel-tools < %{epoch}:%{version}-%{release} Conflicts: %{name}-devel-tools < %{epoch}:%{version}-%{release}
@ -233,6 +306,10 @@ build GNU Image Manipulation Program (GIMP) plug-ins and extensions.
Summary: GIMP help browser plug-in Summary: GIMP help browser plug-in
License: GPLv3+ License: GPLv3+
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
%if ! %unstable
Obsoletes: %{name}-unstable-help-browser < %{epoch}:%{major}.%{minor}
Conflicts: %{name}-unstable-help-browser < %{epoch}:%{major}.%{minor}
%endif
#Demodularizing of gimp (#1772469) #Demodularizing of gimp (#1772469)
Obsoletes: %{name}-help-browser < %{epoch}:%{version}-%{release} Obsoletes: %{name}-help-browser < %{epoch}:%{version}-%{release}
Conflicts: %{name}-help-browser < %{epoch}:%{version}-%{release} Conflicts: %{name}-help-browser < %{epoch}:%{version}-%{release}
@ -254,29 +331,27 @@ hardcode python interpreter: %{with hardcoded_python}
--- >8 --------------------------------------------------------------------- --- >8 ---------------------------------------------------------------------
EOF EOF


%setup -q -n gimp-%{version} %setup -q -n gimp-%{version}%{dashprerel}

%if %{defined gitrev}
%patch0 -p1 -b .git%{gitrev}
%endif


%patch1 -p1 -b .cm-system-monitor-profile-by-default
%patch2 -p1 -b .font-default %patch2 -p1 -b .font-default
%patch3 -p1 -b .no-phone-home-default %patch4 -p1 -b .remove-lua
%patch5 -p1 -b .CVE-2022-30067
%patch6 -p1 -b .CVE-2022-32990


%if ! %{with helpbrowser} %if ! %{with helpbrowser}
%patch100 -p1 -b .external-help-browser #%patch100 -p1 -b .external-help-browser
%endif %endif


%build %build
# allow python2 package for RHEL-8
export RHEL_ALLOW_PYTHON2_FOR_BUILD=1

# Use hardening compiler/linker flags because gimp is likely to deal with files # Use hardening compiler/linker flags because gimp is likely to deal with files
# coming from untrusted sources # coming from untrusted sources
%global _hardened_build 1 %global _hardened_build 1
%configure \ %configure \
%if %{with_hardcoded_python} --with-python \
--enable-python \
%else
--disable-python \
%endif
%if %{with mp} %if %{with mp}
--enable-mp \ --enable-mp \
%else %else
@ -317,11 +392,11 @@ export RHEL_ALLOW_PYTHON2_FOR_BUILD=1
%if 0%{?flatpak} %if 0%{?flatpak}
--with-icc-directory=/run/host/usr/share/color/icc/ \ --with-icc-directory=/run/host/usr/share/color/icc/ \
%endif %endif
--with-bug-report-url=https://bugs.powerel.org/ \
--without-appdata-test --without-appdata-test


%make_build %make_build


%if ! %{unstable}
# Generate RPM macros from pkg-config data: # Generate RPM macros from pkg-config data:
# %%_gimp_datadir -- toplevel directory for brushes, gradients, scripts, ... # %%_gimp_datadir -- toplevel directory for brushes, gradients, scripts, ...
# %%_gimp_libdir -- toplevel directory for modules, plug-ins, ... # %%_gimp_libdir -- toplevel directory for modules, plug-ins, ...
@ -365,10 +440,13 @@ cat << EOF > macros.gimp
%%_gimp_scriptdir ${_gimp_scriptdir} %%_gimp_scriptdir ${_gimp_scriptdir}
%%_gimp_plugindir ${_gimp_plugindir} %%_gimp_plugindir ${_gimp_plugindir}
EOF EOF
%endif


%install %install
%make_install %make_install
%if ! %unstable
install -D -m0644 macros.gimp %{buildroot}%{_rpmconfigdir}/macros.d/macros.gimp install -D -m0644 macros.gimp %{buildroot}%{_rpmconfigdir}/macros.d/macros.gimp
%endif


# remove rpaths # remove rpaths
find %buildroot -type f -print0 | xargs -0 -L 20 chrpath --delete --keepgoing 2>/dev/null || : find %buildroot -type f -print0 | xargs -0 -L 20 chrpath --delete --keepgoing 2>/dev/null || :
@ -376,6 +454,14 @@ find %buildroot -type f -print0 | xargs -0 -L 20 chrpath --delete --keepgoing 2>
# remove .la files # remove .la files
find %buildroot -name \*.la -exec %__rm -f {} \; find %buildroot -name \*.la -exec %__rm -f {} \;


%if %{with python_separately_bytecompile}
%py_byte_compile %{__python3} %{buildroot}%{_libdir}/gimp/%{lib_api_version}
%endif

%if %{with static}
find %{buildroot}%{_libdir}/gimp/%{lib_api_version} -type f | sed "s@^%{buildroot}@@g" | grep '\.a$' > gimp-static-files
%endif

# #
# Plugins and modules change often (grab the executeable ones) # Plugins and modules change often (grab the executeable ones)
# #
@ -383,20 +469,12 @@ find %{buildroot}%{_libdir}/gimp/%{lib_api_version} -type f | sed "s@^%{buildroo
find %{buildroot}%{_libdir}/gimp/%{lib_api_version}/* -type d | sed "s@^%{buildroot}@%%dir @g" >> gimp-plugin-files find %{buildroot}%{_libdir}/gimp/%{lib_api_version}/* -type d | sed "s@^%{buildroot}@%%dir @g" >> gimp-plugin-files


# .pyc and .pyo files don't exist yet # .pyc and .pyo files don't exist yet
grep "\.py$" gimp-plugin-files > gimp-plugin-files-py #grep "\.py$" gimp-plugin-files > gimp-plugin-files-py
for file in $(cat gimp-plugin-files-py); do #for file in $(cat gimp-plugin-files-py); do
for newfile in ${file}c ${file}o; do # for newfile in ${file}c ${file}o; do
grep -F -q -x "$newfile" gimp-plugin-files || echo "$newfile" # grep -F -q -x "$newfile" gimp-plugin-files || echo "$newfile"
done # done
done >> gimp-plugin-files #done >> gimp-plugin-files

%if %{with python_separately_bytecompile}
%py_byte_compile %{__python2} %{buildroot}%{_libdir}/gimp/%{lib_api_version}
%endif

%if %{with static}
find %{buildroot}%{_libdir}/gimp/%{lib_api_version} -type f | sed "s@^%{buildroot}@@g" | grep '\.a$' > gimp-static-files
%endif


# #
# Auto detect the lang files. # Auto detect the lang files.
@ -405,6 +483,7 @@ find %{buildroot}%{_libdir}/gimp/%{lib_api_version} -type f | sed "s@^%{buildroo
%find_lang gimp%{gettext_version}-std-plug-ins %find_lang gimp%{gettext_version}-std-plug-ins
%find_lang gimp%{gettext_version}-script-fu %find_lang gimp%{gettext_version}-script-fu
%find_lang gimp%{gettext_version}-libgimp %find_lang gimp%{gettext_version}-libgimp
#%find_lang gimp%{gettext_version}-tips
%find_lang gimp%{gettext_version}-python %find_lang gimp%{gettext_version}-python


cat gimp%{gettext_version}.lang gimp%{gettext_version}-std-plug-ins.lang gimp%{gettext_version}-script-fu.lang gimp%{gettext_version}-libgimp.lang gimp%{gettext_version}-python.lang > gimp-all.lang cat gimp%{gettext_version}.lang gimp%{gettext_version}-std-plug-ins.lang gimp%{gettext_version}-script-fu.lang gimp%{gettext_version}-libgimp.lang gimp%{gettext_version}-python.lang > gimp-all.lang
@ -431,11 +510,55 @@ ln -snf gimprc-%{binver}.5 %{buildroot}/%{_mandir}/man5/gimprc.5
# to the system python interpreter, but this will avoid false alarms. # to the system python interpreter, but this will avoid false alarms.
grep -E -rl '^#!\s*/usr/bin/env\s+python' --include=\*.py "%{buildroot}" | grep -E -rl '^#!\s*/usr/bin/env\s+python' --include=\*.py "%{buildroot}" |
while read file; do while read file; do
sed -r '1s,^#!\s*/usr/bin/env\s+python$,#!%{__python2},' -i "$file" sed -r '1s,^#!\s*/usr/bin/env\s+python$,#!%{__python3},' -i "$file"
sed -r '1s,^#!\s*/usr/bin/env\s+python2$,#!%{__python2},' -i "$file" sed -r '1s,^#!\s*/usr/bin/env\s+python3$,#!%{__python3},' -i "$file"
done done


echo "%{__python2}=%{__python2}" >> %{buildroot}%{_libdir}/gimp/%{lib_api_version}/interpreters/pygimp.interp echo "%{__python3}=%{__python3}" >> %{buildroot}%{_libdir}/gimp/%{lib_api_version}/interpreters/pygimp.interp
%endif

%if %unstable
# install stuff in system locations

# script wrappers for executables
mkdir -p %{buildroot}%{os_bindir}
pushd %{buildroot}%{_bindir}
for exe in *-%{major}.%{minor}; do
cat << EOF > "%{buildroot}%{os_bindir}/$exe"
#!/bin/sh
export LD_LIBRARY_PATH=%{_libdir}
exec %{_bindir}/$exe "\$@"
EOF
chmod 755 %{buildroot}%{os_bindir}/"$exe"
done
popd

# desktop file -- mention version/unstable, use custom icon
desktop-file-install --dir=%{buildroot}%{os_datadir}/applications \
--set-name="GIMP %major.%minor (unstable)" \
--set-icon="gimp-%major.%minor" \
%{buildroot}%{_datadir}/applications/gimp.desktop
mv -f %{buildroot}%{os_datadir}/applications/gimp.desktop \
%{buildroot}%{os_datadir}/applications/gimp-%major.%minor.desktop

# icons -- overlay major.minor version
pushd %{buildroot}%{_datadir}/icons/hicolor
for srcicon in */apps/gimp.png; do
geo=${srcicon%%%%/*}
dim=${geo%%x*}
ps=$((5+$dim/6))
sw=$(($dim/50+1))
o=$(($dim/26+1))
destdir="%{buildroot}%{os_datadir}/icons/hicolor/$geo/apps"
desticon="$destdir/gimp-%{major}.%{minor}.png"
mkdir -p "$destdir"
convert "$srcicon" \
-gravity northeast -pointsize $ps -strokewidth $sw \
-stroke black -annotate +$o+$(($o+$ps)) %{major}.%{minor} \
-stroke none -fill white -annotate +$o+$(($o+$ps)) %{major}.%{minor} \
"$desticon"
done
popd
%endif %endif


%check %check
@ -475,11 +598,11 @@ make check %{?_smp_mflags}
%{_datadir}/gimp/%{lib_api_version}/ui/ %{_datadir}/gimp/%{lib_api_version}/ui/
%dir %{_libdir}/gimp %dir %{_libdir}/gimp
%dir %{_libdir}/gimp/%{lib_api_version} %dir %{_libdir}/gimp/%{lib_api_version}
%dir %{_libdir}/gimp/%{lib_api_version}/environ #%dir %%{_libdir}/gimp/%%{lib_api_version}/environ
%dir %{_libdir}/gimp/%{lib_api_version}/interpreters #%dir %%{_libdir}/gimp/%%{lib_api_version}/interpreters
%dir %{_libdir}/gimp/%{lib_api_version}/modules #%dir %%{_libdir}/gimp/%%{lib_api_version}/modules
%dir %{_libdir}/gimp/%{lib_api_version}/plug-ins #%dir %%{_libdir}/gimp/%%{lib_api_version}/plug-ins
%dir %{_libdir}/gimp/%{lib_api_version}/python #%dir %%{_libdir}/gimp/%%{lib_api_version}/python
%if %{with helpbrowser} %if %{with helpbrowser}
%exclude %{_libdir}/gimp/%{lib_api_version}/plug-ins/help-browser %exclude %{_libdir}/gimp/%{lib_api_version}/plug-ins/help-browser
%endif %endif
@ -502,13 +625,15 @@ make check %{?_smp_mflags}
%dir %{_sysconfdir}/gimp/%{lib_api_version} %dir %{_sysconfdir}/gimp/%{lib_api_version}
%config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/controllerrc %config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/controllerrc
%config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/gimprc %config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/gimprc
%config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/gtkrc #%config(noreplace) %%{_sysconfdir}/gimp/%%{lib_api_version}/gtkrc
%config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/unitrc %config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/unitrc
%config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/sessionrc %config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/sessionrc
%config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/templaterc %config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/templaterc
%config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/menurc %config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/menurc
%config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/toolrc %config(noreplace) %{_sysconfdir}/gimp/%{lib_api_version}/toolrc


%{_sysconfdir}/gimp/%{lib_api_version}/gimp.css

%{_bindir}/gimp-%{binver} %{_bindir}/gimp-%{binver}
%{_bindir}/gimp-console-%{binver} %{_bindir}/gimp-console-%{binver}


@ -530,29 +655,34 @@ make check %{?_smp_mflags}
%{_mandir}/man5/gimprc.5* %{_mandir}/man5/gimprc.5*
%endif %endif


%{_datadir}/icons/hicolor/*/apps/gimp.png %{_datadir}/icons/hicolor/*/apps/gimp.*
%if %unstable
%{os_bindir}/*-%{major}.%{minor}
%{os_datadir}/applications/gimp-%{major}.%{minor}.desktop
%{os_datadir}/icons/hicolor/*/apps/gimp-%{major}.%{minor}.png
%endif


%files libs %files libs
%license COPYING %license COPYING
%doc AUTHORS ChangeLog NEWS README %doc AUTHORS ChangeLog NEWS README
%{_libdir}/libgimp-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimp-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimp-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimp-%{unstable_so_version}.so.%{interface_age}
%{_libdir}/libgimpbase-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimpbase-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimpbase-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimpbase-%{unstable_so_version}.so.%{interface_age}
%{_libdir}/libgimpcolor-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimpcolor-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimpcolor-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimpcolor-%{unstable_so_version}.so.%{interface_age}
%{_libdir}/libgimpconfig-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimpconfig-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimpconfig-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimpconfig-%{unstable_so_version}.so.%{interface_age}
%{_libdir}/libgimpmath-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimpmath-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimpmath-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimpmath-%{unstable_so_version}.so.%{interface_age}
%{_libdir}/libgimpmodule-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimpmodule-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimpmodule-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimpmodule-%{unstable_so_version}.so.%{interface_age}
%{_libdir}/libgimpthumb-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimpthumb-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimpthumb-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimpthumb-%{unstable_so_version}.so.%{interface_age}
%{_libdir}/libgimpui-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimpui-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimpui-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimpui-%{unstable_so_version}.so.%{interface_age}
%{_libdir}/libgimpwidgets-%{lib_api_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro} %{_libdir}/libgimpwidgets-%{unstable_so_version}.so.%{interface_age}.%{lib_minor}.%{lib_micro}
%{_libdir}/libgimpwidgets-%{lib_api_version}.so.%{interface_age} %{_libdir}/libgimpwidgets-%{unstable_so_version}.so.%{interface_age}


%if %{with static} %if %{with static}
%files devel -f gimp-static-files %files devel -f gimp-static-files
@ -568,9 +698,15 @@ make check %{?_smp_mflags}
%{_libdir}/gimp/%{lib_api_version}/modules/*.la %{_libdir}/gimp/%{lib_api_version}/modules/*.la
%endif %endif
%{_datadir}/aclocal/*.m4 %{_datadir}/aclocal/*.m4
%{_includedir}/gimp-%{lib_api_version} %{_includedir}/gimp-%{unstable_so_version}
%{_libdir}/pkgconfig/* %{_libdir}/pkgconfig/*
%{_libdir}/girepository-1.0/*
%{_datadir}/vala/*
%{_datadir}/gir-1.0/*

%if ! %unstable
%{_rpmconfigdir}/macros.d/macros.gimp %{_rpmconfigdir}/macros.d/macros.gimp
%endif


%files devel-tools %files devel-tools
%{_bindir}/gimptool-%{lib_api_version} %{_bindir}/gimptool-%{lib_api_version}
@ -587,39 +723,15 @@ make check %{?_smp_mflags}
%endif %endif


%changelog %changelog
* Sat Sep 03 2022 Nils Philippsen <nils@tiptoe.de> 2:2.10.32-3 * Mon Jul 18 2022 Josef Ridky <jridky@redhat.com> - 2:2.99.8-3
- Add and update (build-)dependencies - fix CVE-2022-30067
- fix CVE-2022-32990


* Sat Sep 03 2022 Nils Philippsen <nils@tiptoe.de> 2:2.10.32-2 * Wed Mar 09 2022 Josef Ridky <jridky@redhat.com> - 2:2.99.8-2
- Remove more cruft for unstable version packaging - Remove luajit requirement


* Sat Sep 03 2022 Nils Philippsen <nils@tiptoe.de> 2:2.10.32-1 * Tue Feb 01 2022 Josef Ridky <jridky@redhat.com> - 2:2.99.8-1
- Version 2.10.32 - Tech Preview import into RHEL-9

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:2.10.30-1.3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Fri May 20 2022 Sandro Mani <manisandro@gmail.com> - 2:2.10.30-1.2
- Rebuild for gdal-3.5.0 and/or openjpeg-2.5.0

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:2.10.30-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Mon Jan 17 2022 Nils Philippsen <nils@tiptoe.de> - 2:2.10.30-1
- version 2.10.30
- remove trailing white space

* Fri Oct 15 2021 Josef Ridky <jridky@redhat.com> - 2:2.10.28-1
- New upstream release 2.10.28

* Sat Aug 21 2021 Richard Shaw <hobbes1069@gmail.com> - 2:2.10.24-1.3
- Rebuild for OpenEXR/Imath 3.1.

* Thu Aug 05 2021 Richard Shaw <hobbes1069@gmail.com> - 2:2.10.24-1.2
- Rebuild for OpenEXR 3.

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2:2.10.24-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild


* Fri Apr 02 2021 Kalev Lember <klember@redhat.com> - 2:2.10.24-1 * Fri Apr 02 2021 Kalev Lember <klember@redhat.com> - 2:2.10.24-1
- Update to 2.10.24 - Update to 2.10.24
@ -2522,4 +2634,3 @@ make check %{?_smp_mflags}
* Wed Dec 22 1999 Gregory McLean <gregm@comstar.net> * Wed Dec 22 1999 Gregory McLean <gregm@comstar.net>
- Version 1.1.14 - Version 1.1.14
- Added some auto %%files section generation scriptlets - Added some auto %%files section generation scriptlets