Name:             gnumeric
Epoch:            1
Version:          1.12.55
Release:          1
Summary:          Spreadsheet program for GNOME
#LGPLv2+:
#plugins/gda/plugin-gda.c
#plugins/fn-financial/sc-fin.c
#plugins/plan-perfect/charset.c
#src/widgets/gnumeric-lazy-list.h
#GPLv3+:
#src/parser.c
License:          GPLv2+ and GPLv3+ and LGPLv2+
URL:              http://www.gnumeric.org
Source:           https://download.gnome.org/sources/%{name}/1.12/%{name}-%{version}.tar.xz
BuildRequires:    bison
BuildRequires:    desktop-file-utils
BuildRequires:    docbook-dtds
BuildRequires:    gcc
BuildRequires:    goffice-devel >= 0.10.46
BuildRequires:    intltool
BuildRequires:    itstool
BuildRequires:    libappstream-glib
%if 0%{?fedora} >= 37
BuildRequires:    libgda-ui-devel
%endif
BuildRequires:    make
BuildRequires:    perl-devel
BuildRequires:    perl-generators
BuildRequires:    perl(ExtUtils::Embed)
BuildRequires:    perl(Getopt::Long)
BuildRequires:    perl(IO::Compress::Gzip)
BuildRequires:    psiconv-devel
BuildRequires:    pygobject3-devel
BuildRequires:    python3-devel
BuildRequires:    zlib-devel
Requires:         hicolor-icon-theme

%description
Gnumeric is a spreadsheet program for the GNOME GUI desktop
environment.


%package devel
Summary:          Files necessary to develop gnumeric-based applications
Requires:         %{name}%{?_isa} = %{epoch}:%{version}-%{release}

%description devel
Gnumeric is a spreadsheet program for the GNOME GUI desktop
environment. The gnumeric-devel package includes files necessary to
develop gnumeric-based applications.


%package plugins-extras
Summary:          Additional plugins for Gnumeric incl. Perl and Python support
Requires:         %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires:         perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires:         python(abi) = %{python3_version}

%description plugins-extras
This package contains the following additional plugins for gnumeric:
* gda and gnomedb plugins:
  Database functions for retrieval of data from a database.
* perl plugin:
  This plugin allows writing of plugins in Perl.
* python-loader plugin:
  This plugin allows writing of plugins in Python.
* py-func plugin:
  Sample Python plugin providing some (useless) functions.
* gnome-glossary:
  Support for saving GNOME Glossary in .po files. 


%prep
%autosetup -p1
chmod -x plugins/excel/rc4.?


%build
%configure --disable-silent-rules --disable-maintainer-mode
# Don't use rpath!
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build


%install
%make_install

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

mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --delete-original                                  \
  --remove-category Science                                             \
  $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop

appstream-util validate-relax --nonet $RPM_BUILD_ROOT%{_metainfodir}/%{name}.appdata.xml

#remove .la files
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

# Bytecompile Python plugins
%py_byte_compile %{__python3} $RPM_BUILD_ROOT%{_libdir}/%{name}/%{version}/plugins

%ldconfig_scriptlets


%files -f %{name}.lang
%doc HACKING AUTHORS ChangeLog NEWS BUGS README
%license COPYING
%{_bindir}/*
%{_libdir}/libspreadsheet-%{version}.so
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/%{version}
%exclude %{_libdir}/%{name}/%{version}/plugins/perl-*
%if 0%{?fedora} >= 37
%exclude %{_libdir}/%{name}/%{version}/plugins/gdaif
%endif
%exclude %{_libdir}/%{name}/%{version}/plugins/psiconv
%exclude %{_libdir}/%{name}/%{version}/plugins/gnome-glossary
%exclude %{_libdir}/%{name}/%{version}/plugins/py-*
%exclude %{_libdir}/%{name}/%{version}/plugins/python-*
%{_datadir}/glib-2.0/schemas/org.gnome.gnumeric.*
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/%{version}
%{_datadir}/applications/%{name}.desktop
%{_metainfodir}/%{name}.appdata.xml
%{_mandir}/man1/*

%files devel
%{_libdir}/libspreadsheet.so
%{_libdir}/pkgconfig/libspreadsheet-1.12.pc
%{_includedir}/libspreadsheet-1.12

%files plugins-extras
%{_libdir}/%{name}/%{version}/plugins/perl-*
%if 0%{?fedora} >= 37
%{_libdir}/%{name}/%{version}/plugins/gdaif
%endif
%{_libdir}/%{name}/%{version}/plugins/psiconv
%{_libdir}/%{name}/%{version}/plugins/gnome-glossary
%{_libdir}/%{name}/%{version}/plugins/py-*
%{_libdir}/%{name}/%{version}/plugins/python-* 
%{_libdir}/goffice/*/plugins/gnumeric/gnumeric.so
%{_libdir}/goffice/*/plugins/gnumeric/plugin.xml


%changelog
* Fri May 26 2023 wangtaozhi <wangtaozhi@kylinsec.com.cn> - 1:1.12.55-1
- Package init
