%global glib2_version 2.56.0

Name:           gdk-pixbuf2
Version:        2.42.10
Release:        4
Summary:        gdk is a multi-platform toolkit for creating graphical user interfaces.
License:        LGPLv2+
URL:            https://gitlab.gnome.org/GNOME/gdk-pixbuf
Source0:        https://download.gnome.org/sources/gdk-pixbuf/2.42/gdk-pixbuf-%{version}.tar.xz

Patch6000:	backport-CVE-2022-48622.patch

BuildRequires:  docbook-style-xsl
BuildRequires:  gettext
BuildRequires:  pkgconfig(gio-2.0) >= %{glib2_version}
BuildRequires:  libpng-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxslt
BuildRequires:  meson
BuildRequires:  pkgconfig(gobject-introspection-1.0)
BuildRequires:  shared-mime-info
BuildRequires:  cmake gi-docgen python3-docutils

Requires:       glib2%{?_isa} >= %{glib2_version}
Requires:       shared-mime-info

%description
gdk is written in C but has been designed from the ground up to support a wide range of languages.
It provide a complete set of widgets,and suitable for projects ranging from small one-off
tools to complete application suites.

%package modules
Summary: Additional image modules for gdk-pixbuf2
Requires: %{name}%{?_isa} = %{version}-%{release}

%description modules
This package contains the additional modules that are needed to load various
image formats such as ICO and JPEG.

%package devel
Summary: Development files for gdk-pixbuf2
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: glib2-devel%{?_isa} >= %{glib2_version}

%description devel
This package contains libraries and header files needed for doing development and
speeding up your development time

%package tests
Summary: Tests for the %{name} package
Requires: %{name}%{?_isa} = %{version}-%{release}

%description tests
The %{name}-tests package contains tests that can be used to verify
the functionality of the installed %{name} package.

%package help
Summary:        Development Documentation files for gdk-pixbuf2 and xlib library
Buildarch: noarch
Requires:       %{name} = %{version}-%{release}

%description    help
The gdk-pixbuf2 package contains the documentation files which is useful for
developing applications that uses gdk-pixbuf2 xlib and test.

%prep
%autosetup -n gdk-pixbuf-%{version} -p1

%build
%meson \
       -Dgtk_doc=true \
       -Dman=true \
       %{nil}

%global _smp_mflags -j1
%meson_build

%install
%meson_install

touch $RPM_BUILD_ROOT%{_libdir}/gdk-pixbuf-2.0/2.10.0/loaders.cache

(cd $RPM_BUILD_ROOT%{_bindir}
 mv gdk-pixbuf-query-loaders gdk-pixbuf-query-loaders-%{__isa_bits}
)
sed -i -e 's/gdk-pixbuf-query-loaders/gdk-pixbuf-query-loaders-%{__isa_bits}/' \
    $RPM_BUILD_ROOT%{_libdir}/pkgconfig/gdk-pixbuf-2.0.pc

%find_lang gdk-pixbuf

%transfiletriggerin -- %{_libdir}/gdk-pixbuf-2.0/2.10.0/loaders
gdk-pixbuf-query-loaders-%{__isa_bits} --update-cache

%transfiletriggerpostun -- %{_libdir}/gdk-pixbuf-2.0/2.10.0/loaders
gdk-pixbuf-query-loaders-%{__isa_bits} --update-cache

%files -f gdk-pixbuf.lang
%license COPYING
%doc NEWS
%{_libdir}/libgdk_pixbuf-2.0.so.*
%{_libdir}/girepository-1.0
%dir %{_libdir}/gdk-pixbuf-2.0
%dir %{_libdir}/gdk-pixbuf-2.0/2.10.0
%dir %{_libdir}/gdk-pixbuf-2.0/2.10.0/loaders
%ghost %{_libdir}/gdk-pixbuf-2.0/2.10.0/loaders.cache
%{_bindir}/gdk-pixbuf-query-loaders-%{__isa_bits}
%{_bindir}/gdk-pixbuf-thumbnailer
%{_datadir}/thumbnailers/

%files modules
%{_libdir}/gdk-pixbuf-2.0/2.10.0/loaders/*.so

%files devel
%dir %{_includedir}/gdk-pixbuf-2.0
%{_includedir}/gdk-pixbuf-2.0/gdk-pixbuf
%{_libdir}/libgdk_pixbuf-2.0.so
%{_libdir}/pkgconfig/gdk-pixbuf-2.0.pc
%{_bindir}/gdk-pixbuf-csource
%{_bindir}/gdk-pixbuf-pixdata
%{_datadir}/gir-1.0/

%files tests
%{_libexecdir}/installed-tests
%{_datadir}/installed-tests

%files help
%defattr(-,root,root)
%{_mandir}/man1/gdk-pixbuf-query-loaders.1*
%{_mandir}/man1/gdk-pixbuf-csource.1*
%{_datadir}/doc/gdk-pixbuf/
%{_datadir}/doc/gdk-pixdata/

%changelog
* Mon Oct 14 2024 zhangpan <zhangpan103@h-partners.com> - 2.42.10-4
- fix duplicate packaged files for help subpackages

* Wed Jun 26 2024 liningjie <liningjie@xfusion.com> - 2.42.10-3
- Fix CVE-2022-48622

* Tue Mar 07 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 2.42.10-2
- disable make check

* Mon Jan 2 2023 lin zhang <lin.zhang@turbolinux.com.cn> - 2.42.10-1
- Update to 2.42.10

* Tue Sep 06 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 2.42.8-2
- fix test fails when testing gif images

* Mon Mar 28 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 2.42.8-1
- Update to 2.42.8

* Wed Mar 30 2022 liuyumeng <liuyumeng5@h-partners.com> - 2.42.6-2
- enable tests

* Thu Dec 2 2021 hanhui <hanhui15@huawei.com> - 2.42.6-1
- update to 2.42.6

* Thu Jul 20 2021 liuyumeng <liuyumeng5@huawei.com> - 2.40.0-2
- delete gdb in buildrequires

* Mon Jul 20 2020 wangye <wangye70@huawei.com> - 2.40.0-1
- version update 2.40.0

* Fri Mar 20 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.38.0-9
- add gdb in buildrequires

* Mon Jan 20 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.38.0-8
- remove the jasper

* Tue Dec 24 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.38.0-7
- change the path of files

* Mon Oct 28 2019 zoujing <zoujing13@huawei.com>  - 2.38.0-6
- add gobject-introspection-devel

* Wed Sep 18 2019 openEuler jimmy<dukaitian@huawei.com>  - 2.38.0-5
- Package init jimmy
