%global glib2_version 2.64
%global gtk3_version 3.22
%global gtksourceview_version 4.0.2
%global libpeas_version 1.14.1
%global gspell_version 1.0
%global pygo_version 3.0.0

%global __provides_exclude_from ^%{_libdir}/gedit/plugins/
%global apiver 41

Name:	       gedit
Epoch:	       2
Version:       42.2
Release:       1
Summary:       Text editor for the GNOME desktop
License:       GPLv2+ and GFDL-1.1-or-later
URL:	       https://wiki.gnome.org/Apps/Gedit
Source0:       https://download.gnome.org/sources/%{name}/42/%{name}-%{version}.tar.xz

BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(gsettings-desktop-schemas)
BuildRequires: pkgconfig(gspell-1) >= %{gspell_version}
BuildRequires: pkgconfig(gtk+-3.0) >= %{gtk3_version}
BuildRequires: pkgconfig(gtksourceview-4) >= %{gtksourceview_version}
BuildRequires: pkgconfig(iso-codes)
BuildRequires: pkgconfig(libpeas-gtk-1.0) >= %{libpeas_version}
BuildRequires: pkgconfig(libsoup-3.0)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(pygobject-3.0)
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: gtk-doc
BuildRequires: which
BuildRequires: yelp-tools
BuildRequires: itstool
BuildRequires: meson >= 0.61.5
BuildRequires: vala
BuildRequires: python3-devel
BuildRequires: python3-gobject >= %{pygo_version}
BuildRequires: libappstream-glib

Requires: glib2%{?_isa} >= %{glib2_version}
Requires: gspell%{?_isa} >= %{gspell_version}
Requires: gtk3%{?_isa} >= %{gtk3_version}
Requires: gtksourceview4%{?_isa} >= %{gtksourceview_version}
Requires: libpeas-loader-python
Requires: python3-gobject >= %{pygo_version}
# the run-command plugin uses zenity
Requires: zenity
Requires: gsettings-desktop-schemas
Requires: gvfs-client

Obsoletes: gedit-collaboration < 3.6.1-6
Obsoletes: gedit-plugin-zeitgeist < 3.35.90


%description
gedit is a small, but powerful text editor designed specifically for
the GNOME desktop. It has most standard text editor functions and fully
supports international text in Unicode. Advanced features include syntax
highlighting and automatic indentation of source code, printing and editing
of multiple documents in one window.

gedit is extensible through a plugin system, which currently includes
support for spell checking, comparing files, viewing CVS ChangeLogs, and
adjusting indentation levels. Further plugins can be found in the
gedit-plugins package.

%package devel
Summary: Support for developing plugins for the gedit text editor
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}

%description devel
gedit is a small, but powerful text editor for the GNOME desktop.
This package allows you to develop plugins that add new functionality
to gedit.

Install gedit-devel if you want to write plugins for gedit.

%package help
Summary:  documentation for user of gedit.
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
%description help
documentation for user of gedit.

%prep
%autosetup -n %{name}-%{version} -p1

%build
%meson -Dgtk_doc=true

# parallel make disabled to work around desktop file translations going missing
%define __ninja_common_opts -v
%meson_build

%install
%meson_install
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/gi/overrides
%py_byte_compile %{__python3} %{buildroot}%{_libdir}/gedit/plugins/

%find_lang %{name} --with-gnome

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

%files -f %{name}.lang
%doc README.md NEWS
%license COPYING
%{_bindir}/gedit
%{_datadir}/gedit/
%{_datadir}/applications/org.gnome.gedit.desktop
%{python3_sitelib}/gi/overrides/Gedit.py*
%{python3_sitelib}/gi/overrides/__pycache__
%{_libdir}/gedit/girepository-1.0/
%dir %{_libdir}/gedit
%dir %{_libdir}/gedit/plugins
%{_libdir}/gedit/libgedit-%{apiver}.so
%{_libdir}/gedit/plugins/docinfo.plugin
%{_libdir}/gedit/plugins/libdocinfo.so
%{_libdir}/gedit/plugins/filebrowser.plugin
%{_libdir}/gedit/plugins/libfilebrowser.so
%{_libdir}/gedit/plugins/openlinks.plugin
%{_libdir}/gedit/plugins/libopenlinks.so
%{_libdir}/gedit/plugins/modelines.plugin
%{_libdir}/gedit/plugins/libmodelines.so
%{_libdir}/gedit/plugins/externaltools.plugin
%{_libdir}/gedit/plugins/externaltools
%{_libdir}/gedit/plugins/pythonconsole.plugin
%{_libdir}/gedit/plugins/pythonconsole
%{_libdir}/gedit/plugins/quickopen.plugin
%{_libdir}/gedit/plugins/quickopen
%{_libdir}/gedit/plugins/snippets.plugin
%{_libdir}/gedit/plugins/snippets
%{_libdir}/gedit/plugins/quickhighlight.plugin
%{_libdir}/gedit/plugins/libquickhighlight.so
%{_libdir}/gedit/plugins/sort.plugin
%{_libdir}/gedit/plugins/libsort.so
%{_libdir}/gedit/plugins/spell.plugin
%{_libdir}/gedit/plugins/libspell.so
%{_libdir}/gedit/plugins/time.plugin
%{_libdir}/gedit/plugins/libtime.so
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.enums.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.externaltools.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.pythonconsole.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.filebrowser.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.filebrowser.enums.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.spell.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.time.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.time.enums.xml
%{_datadir}/dbus-1/services/org.gnome.gedit.service
%{_datadir}/icons/hicolor/*/apps/org.gnome.gedit.svg
%{_datadir}/icons/hicolor/symbolic/apps/org.gnome.gedit-symbolic.svg
%{_metainfodir}/org.gnome.gedit.appdata.xml

%files devel
%{_includedir}/gedit-%{apiver}/
%{_libdir}/pkgconfig/gedit.pc
%{_datadir}/gtk-doc/
%{_datadir}/vala/

%files help
%license COPYING
%{_mandir}/man1/*

%changelog
* Mon Sep 5 2022 zhanglin <lin.zhang@turbolinux.com.cn> - 2:42.2-1
- Update to 42.2

* Mon Jun 20 2022 zhanglin <lin.zhang@turbolinux.com.cn> - 1:3.38.2-4
- fix build when Meson >= 0.61.5
- add patch modify-meson-build-tepl6.patch
- add patch fix-i18n-merge-file.patch

* Mon Apr 18 2022 zhanglin <lin.zhang@turbolinux.com.cn> - 3.38.2-3
- Add GFDL Version GFDL-1.1-or-later

* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 3.38.2-2
- DESC: delete -S git from %autosetup

* Mon May 24 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 3.38.2-1
- Upgrade to 3.38.2
- Update Epoch, Version, Release, Source0, BuildRequires, Requires
- Add patch 'python3-install-path-fix.patch', change files list

* Fri May 15 2020 Jeffery.Gao <gaojianxing@huawei.com> - 3.30.2-2
- Package init
