%global __provides_exclude_from ^%{_libdir}/%{name}/.*\\.so.*$
%global __requires_exclude ^libgnome-photos\\.so.*$

%global cairo_version 1.14.0
%global dazzle_version 3.26.0
%global gdk_pixbuf_version 2.36.8
%global gegl_version 0.4.0
%global gettext_version 0.19.8
%global gexiv2_version 0.10.8
%global glib2_version 2.62.0
%global goa_version 3.8.0
%global gtk3_version 3.22.16
%global handy_version 1.1.90
%global tracker_miners_version 3.0.0

Name:          gnome-photos
Version:       43.0
Release:       2
Summary:       Access, organize and share your photos on GNOME
License:       GPLv3+ and LGPLv2+
URL:           https://wiki.gnome.org/Apps/Photos
Source0:       https://download.gnome.org/sources/%{name}/43/%{name}-%{version}.tar.xz

Patch1:        0001-wip-item-manager-Handle-collection-COLUMNS_URNs-with.patch

BuildRequires: libappstream-glib
BuildRequires: desktop-file-utils
BuildRequires: docbook-style-xsl
BuildRequires: gcc
BuildRequires: gettext >= %{gettext_version}
BuildRequires: itstool
BuildRequires: libxslt
BuildRequires: meson
BuildRequires: pkgconfig(babl)
BuildRequires: pkgconfig(cairo) >= %{cairo_version}
BuildRequires: pkgconfig(cairo-gobject) >= %{cairo_version}
BuildRequires: pkgconfig(gdk-pixbuf-2.0) >= %{gdk_pixbuf_version}
BuildRequires: pkgconfig(gegl-0.4) >= %{gegl_version}
BuildRequires: pkgconfig(geocode-glib-2.0)
BuildRequires: pkgconfig(gexiv2) >= %{gexiv2_version}
BuildRequires: pkgconfig(gio-2.0) >= %{glib2_version}
BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
BuildRequires: pkgconfig(gobject-2.0) >= %{glib2_version}
BuildRequires: pkgconfig(goa-1.0) >= %{goa_version}
BuildRequires: pkgconfig(gsettings-desktop-schemas)
BuildRequires: pkgconfig(gtk+-3.0) >= %{gtk3_version}
BuildRequires: pkgconfig(libdazzle-1.0) >= %{dazzle_version}
BuildRequires: pkgconfig(libhandy-1) >= %{handy_version}
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libportal)
BuildRequires: pkgconfig(libportal-gtk3)
BuildRequires: pkgconfig(tracker-sparql-3.0)

Requires:      baobab
Requires:      gdk-pixbuf2%{?_isa} >= %{gdk_pixbuf_version}
Requires:      gegl04%{?_isa} >= %{gegl_version}
Requires:      glib2%{?_isa} >= %{glib2_version}
Requires:      gnome-settings-daemon
Requires:      gtk3%{?_isa} >= %{gtk3_version}
Requires:      libdazzle%{?_isa} >= %{dazzle_version}
Requires:      libgexiv2%{?_isa} >= %{gexiv2_version}
Requires:      libhandy%{?_isa} >= %{handy_version}
Requires:      tracker3-miners >= %{tracker_miners_version}
Requires:      dleyna-renderer

Provides:      bundled(libgd)

%description
Access, organize and share your photos on GNOME. A simple and elegant
replacement for using a file manager to deal with photos. Enhance, crop
and edit in a snap. Seamless cloud integration is offered through GNOME
Online Accounts.

%package       tests
Summary:       Tests for %{name}
Requires:      python3-dogtail

%description   tests
This package contains the installable tests for %{name}.

%prep
%autosetup -p1

%build
%meson \
  --buildtype=plain \
  -Ddogtail=false \
  -Dflatpak=true \
  -Dinstalled_tests=true \
  -Dmanuals=true

%meson_build

%install
%meson_install

%find_lang %{name} --with-gnome

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/org.gnome.Photos.desktop
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml

%files -f %{name}.lang
%license COPYING
%{_bindir}/%{name}
%{_datadir}/metainfo/org.gnome.Photos.appdata.xml
%{_datadir}/applications/org.gnome.Photos.desktop
%{_datadir}/dbus-1/services/org.gnome.Photos.service
%{_datadir}/dbus-1/services/org.gnome.Photos.Tracker3.Miner.Extract.service
%{_datadir}/dbus-1/services/org.gnome.Photos.Tracker3.Miner.Files.service
%{_datadir}/glib-2.0/schemas/org.gnome.photos.gschema.xml
%{_datadir}/gnome-shell/
%{_datadir}/icons/hicolor/scalable/apps/org.gnome.Photos.svg
%{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Photos-symbolic.svg
%{_datadir}/man/man1/%{name}.1*
%{_datadir}/tracker3-miners/domain-ontologies/org.gnome.Photos.rule
%{_docdir}/%{name}
%{_libdir}/%{name}/libgnome-photos.so
%{_libexecdir}/%{name}-thumbnailer

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

%changelog
* Thu Mar 02 2023 wenlong ding <wenlong.ding@turbolinux.com.cn> - 43.0-2
- Move '%%find_lang %{name}' to %%install, fix not found %{name}.lang if disable %%check build

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

* Mon Mar 28 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 42.0-1
- Update to 42.0 Add gnome-photos.yaml

* Fri Sep 24 2021 Wenlong Ding <wenlong.ding@turbolinux.com.cn> - 40.0-1
- Update to 40

* Fri Jun 18 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 3.38.1-1
- Package init with version 3.38.1
