%define gtk3_version 3.24
%define glib_version 2.58
%define vte_version 0.66
%define libhandy_version 1.5.0
%define gettext_version 0.19.8
%define app_id org.gnome.Console
%define realname gnome-console

%define gitdate 20211218
%define commit 7f370f4e
%define gitrev .%{gitdate}.git%{commit}

Name: gnome-console-development
Version: 0.5.0
Release: 0%{?gitrev}%{?dist}
Summary: A minimal terminal for GNOME

License: GPLv3+
URL: https://gitlab.gnome.org/GNOME/console
Source0: https://gitlab.gnome.org/GNOME/console/-/archive/%{commit}/console-%{commit}.tar.gz

Patch0: 0001-meson-Drop-rpath.patch
Patch1: 0002-Revert-terminal-improve-text-pasting.patch

BuildRequires: pkgconfig(gsettings-desktop-schemas)
BuildRequires: pkgconfig(gtk+-3.0) >= %{gtk3_version}
BuildRequires: pkgconfig(gio-2.0) >= %{glib_version}
BuildRequires: pkgconfig(libhandy-1) >= %{libhandy_version}
BuildRequires: pkgconfig(vte-2.91) >= %{vte_version}
BuildRequires: pkgconfig(libgtop-2.0)
BuildRequires: desktop-file-utils
BuildRequires: gettext >= %{gettext_version}
BuildRequires: clang
BuildRequires: meson
BuildRequires: ninja-build
BuildRequires: sassc
BuildRequires: nautilus-devel

Requires: gsettings-desktop-schemas
Requires: gtk3%{?_isa} >= %{gtk3_version}
Requires: libhandy1%{?_isa} >= %{libhandy_version}
Requires: vte291%{?_isa} >= %{vte_version}
Requires: libgtop2%{?_isa}

Obsoletes: kgx-development
Obsoletes: kgx-generic-development
Conflicts: kgx-development
Conflicts: kgx-generic-development
Provides:  kgx-development = %{version}-%{release}
Provides:  kgx-generic-development = %{version}-%{release}

%description
A simple user-friendly terminal emulator for the GNOME desktop.

%package nautilus
Summary: GNOME Console extension for Nautilus
Requires: %{name}%{?_isa} = %{version}-%{release}

Obsoletes: kgx-development-nautilus
Obsoletes: kgx-generic-development-nautilus
Conflicts: kgx-development-nautilus
Conflicts: kgx-generic-development-nautilus
Provides:  kgx-development-nautilus = %{version}-%{release}
Provides:  kgx-generic-development-nautilus = %{version}-%{release}

%description nautilus
This package provides a Nautilus extension that adds the 'Open in Console'
option to the right-click context menu in Nautilus.

%prep
%setup -q -n console-%{commit}
%patch0 -p1
%patch1 -p1

%build
%meson
%meson_build

%install
%meson_install
%find_lang kgx --with-gnome

%files -f kgx.lang
%license COPYING
%doc README.md
%{_bindir}/kgx
%{_datadir}/dbus-1/services/%{app_id}.service
%{_datadir}/glib-2.0/schemas/%{app_id}.gschema.xml
%{_datadir}/applications/%{app_id}.desktop
%{_datadir}/icons/hicolor/*/apps/%{app_id}.svg
%{_datadir}/icons/hicolor/symbolic/apps/%{app_id}-symbolic.svg
%{_datadir}/metainfo/%{app_id}.metainfo.xml
%{_libdir}/kgx/libkgx.so

%files nautilus
%{_libdir}/nautilus/extensions-3.0/libkgx-nautilus.so

%changelog
* Thu Oct 24 2019 Christopher Davis <christopherdavis@gnome.org> - master-0
- Initial RPM