%global gtksourceview_version 5.3.0
%global libadwaita_version 1.2.0

Name:           gnome-calculator
Version:        44.0
Release:        1
Summary:        A desktop calculator
License:        GPLv3+
URL:            https://wiki.gnome.org/Apps/Calculator
Source0:        https://download.gnome.org/sources/%{name}/44/%{name}-%{version}.tar.xz

BuildRequires:  desktop-file-utils gettext itstool libmpc-devel libsoup3-devel meson mpfr-devel
BuildRequires:  pkgconfig(glib-2.0) pkgconfig(gtk4) pkgconfig(gtksourceview-5) >= %{gtksourceview_version} pkgconfig(libxml-2.0)
BuildRequires:  libappstream-glib vala vala-devel pkgconfig(gee-0.8)
BuildRequires:  pkgconfig(libadwaita-1) >= %{libadwaita_version}

Provides:  gcalctool = %{version}
Obsoletes: gcalctool < %{version}

Requires:      gtksourceview5%{?_isa} >= %{gtksourceview_version}
Requires:      libadwaita%{?_isa} >= %{libadwaita_version}

%description
it is a powerful desktop calculator with logical, scientific
and financial modes. It uses a multi-precision package to
achieve a high degree of accuracy.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package        help
Summary:        Documents for gnome-calculator
Requires:       man
BuildArch:      noarch

%description    help
Man pages for gnome-calculator.

%prep
%autosetup -p1

%build
%meson
%meson_build

%install
%meson_install
%find_lang %{name} --with-gnome --all-name

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

%files -f gnome-calculator.lang
%license COPYING
%{_bindir}/*
%{_libdir}/girepository-1.0/*.typelib
%{_libdir}/libgcalc-2.so.1*
%{_libdir}/libgci-1.so.0*
%{_libexecdir}/*
%{_datadir}/applications/*
%{_datadir}/dbus-1/services/*
%{_datadir}/glib-2.0/schemas/*
%{_datadir}/gnome-shell/
%{_datadir}/icons/hicolor/scalable/apps/org.gnome.Calculator*.svg
%{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Calculator-symbolic.svg
%{_datadir}/metainfo/org.gnome.Calculator.appdata.xml

%files devel
%{_includedir}/gci-2/
%{_includedir}/gcalc-2/
%{_libdir}/libgcalc-2.so
%{_libdir}/libgci-1.so
%{_libdir}/pkgconfig/gcalc-2.pc
%{_libdir}/pkgconfig/gci-1.pc
%{_datadir}/gir-1.0/GCalc-2.gir
%{_datadir}/gir-1.0/GCi-1.gir
%{_datadir}/devhelp/*
%{_datadir}/vala/vapi/gcalc-2.deps
%{_datadir}/vala/vapi/gcalc-2.vapi
%{_datadir}/vala/vapi/gci-1.deps
%{_datadir}/vala/vapi/gci-1.vapi

%files help
%doc NEWS README.md
%{_mandir}/man1/*

%changelog
* Fri Nov 24 2023 lwg <liweiganga@uniontech.com> - 44.0-1
- update to version 44.0

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

* Mon Jun 6 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 42.1-1
- Upgrade to 42.1

* Wed Jun 16 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 3.38.2-1
- Upgrade to 3.38.2
- Delete 0001-Fix-compiler-errors.patch which existed in version 3.38.2
- Add sub package gnome-calculator-devel

* Wed June 10 2020 lizhenhua <lizhenhua21@huawei.com> - 3.30.1-3
- Add patch to fix compiler errors

* Wed Nov 27 2019 huyan <hu.huyan@huawei.com> - 3.30.1-2
- Package Initialization
