%global __python %{__python3}
%global apiver 3.38

Name:                gedit
Version:             3.38.2
Epoch: 		     1
Release:             2
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/gedit/3.38/gedit-%{version}.tar.xz
Patch1:		     python3-install-path-fix.patch

BuildRequires:       gnome-common pkgconfig(glib-2.0) >= 2.64 pkgconfig(gtk+-3.0) >= 3.22.0
BuildRequires:       pkgconfig(gobject-introspection-1.0) pkgconfig(gsettings-desktop-schemas)
BuildRequires:       pkgconfig(gspell-1) >= 1.0 python3-devel python3-gobject >= 3.0.0
BuildRequires:       pkgconfig(gtksourceview-4) >= 4.0.2 pkgconfig(iso-codes) itstool vala meson
BuildRequires:       pkgconfig(libpeas-gtk-1.0) >= 1.14.1 pkgconfig(libxml-2.0) intltool yelp-tools
BuildRequires:       pkgconfig(pygobject-3.0) desktop-file-utils gettext which /usr/bin/appstream-util
BuildRequires:	     pkgconfig(libsoup-2.4) pkgconfig(tepl-5) >= 4.99.2 gtk-doc procps-ng
Requires:            glib2 >= 2.64 gspell >= 1.0 gtk3 >= 3.22.0 gtksourceview4 >= 4.0.2
Requires:            libpeas-loader-python3 python3-gobject >= 3.0.0 zenity tepl >= 4.99.2
Requires:            gsettings-desktop-schemas gvfs desktop-file-utils >= 0.22-6
Obsoletes:           gedit-collaboration < 3.6.1-6

%description
gedit is a powerful small text editor dedicated to the GNOME desktop.
gedit supports unicode encoding, has most standard text editor functions,
can support syntax highlighting and automatic source code indentation,
printing and editing of multiple documents in one window.
gedit can extend the system through plug-ins, including spelling,
file comparison, and viewing CVS logs, and adjusting indentation levels.

%package devel
Summary:             Support for developing plugins for the gedit text editor
Requires:            gedit = %{epoch}:%{version}-%{release}
%description devel
gedit is a small, but powerful text editor for the GNOME desktop. Use the
package provides, developers can add new functionality to gedit. if you
want to write plugins for gedit,please install gedit-devel.

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

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

%build
%meson -Dgtk_doc=true
%meson_build

%install
%meson_install

%delete_la
%find_lang gedit --with-gnome

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

%files -f gedit.lang
%doc README.md COPYING
%{_datadir}/gedit
%{_datadir}/applications/org.gnome.gedit.desktop
%{python3_sitearch}/gi/overrides/Gedit.py*
%{python3_sitearch}/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,libdocinfo.so,filebrowser.plugin,libfilebrowser.so,modelines.plugin}
%{_libdir}/gedit/plugins/{libmodelines.so,externaltools.plugin,externaltools,pythonconsole.plugin,pythonconsole}
%{_libdir}/gedit/plugins/{quickopen.plugin,quickopen,snippets.plugin,snippets,quickhighlight.plugin,libtime.so}
%{_libdir}/gedit/plugins/{sort.plugin,libsort.so,spell.plugin,libspell.so,time.plugin,libquickhighlight.so}
%{_bindir}/gedit
%{_datadir}/glib-2.0/schemas/{org.gnome.gedit.gschema.xml,org.gnome.gedit.enums.xml,org.gnome.gedit.plugins.time.gschema.xml}
%{_datadir}/glib-2.0/schemas/{org.gnome.gedit.plugins.externaltools.gschema.xml,org.gnome.gedit.plugins.time.enums.xml}
%{_datadir}/glib-2.0/schemas/{org.gnome.gedit.plugins.pythonconsole.gschema.xml,org.gnome.gedit.plugins.filebrowser.enums.xml}
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.filebrowser.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.gedit.plugins.spell.gschema.xml
%{_datadir}/dbus-1/services/org.gnome.gedit.service
%{_datadir}/icons/hicolor/scalable/apps/org.gnome.gedit.svg
%{_datadir}/icons/hicolor/symbolic/apps/org.gnome.gedit-symbolic.svg
%{_datadir}/metainfo/org.gnome.gedit.appdata.xml

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

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

%changelog
* Mon Jun 27 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 1:3.38.2-2
- delete git and add BuildRequires procps-ng

* 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
