374ff8b
%global _hardened_build 1
374ff8b
fca9437
Name:           libvoikko
311003d
Version:        4.3.2
78e4554
Release:        %autorelease
fca9437
Summary:        Voikko is a library for spellcheckers and hyphenators
fca9437
6838ca2
License:        GPL-2.0-or-later
374ff8b
URL:            https://voikko.puimula.org
1d6dbda
# The usual format of stable release URLs
374ff8b
Source0:        https://www.puimula.org/voikko-sources/%{name}/%{name}-%{version}.tar.gz
1d6dbda
# The usual format of test release URLs
374ff8b
#Source0:        https://www.puimula.org/htp/testing/%%{name}-%%{version}rc1.tar.gz
374ff8b
374ff8b
# See https://voikko.puimula.org/sources.html for the key fingerprint.
374ff8b
# I did
374ff8b
#  gpg --recv-keys "AC5D 65F1 0C85 96D7 E2DA  E263 3D30 9B60 4AE3 942E"
374ff8b
# and then
374ff8b
#  gpg2 --export --export-options export-minimal AC5D65F10C8596D7E2DAE2633D309B604AE3942E > gpgkey-AC5D65F10C8596D7E2DAE2633D309B604AE3942E.gpg
374ff8b
Source1:        http://www.puimula.org/voikko-sources/%{name}/%{name}-%{version}.tar.gz.asc
374ff8b
Source2:        gpgkey-AC5D65F10C8596D7E2DAE2633D309B604AE3942E.gpg
fca9437
0b2ca17
Requires: voikko-fi
402cd5f
BuildRequires:  gcc-c++
5e7e44b
BuildRequires:  python3-devel
d6d6f7e
BuildRequires: make
374ff8b
BuildRequires: gnupg2
fca9437
fca9437
%description
fca9437
This is libvoikko, library for spellcheckers and hyphenators using Malaga
fca9437
natural language grammar development tool. The library is written in C.
fca9437
fca9437
Currently only Finnish is supported, but the API of the library has been
fca9437
designed to allow adding support for other languages later. Note however that
fca9437
Malaga is rather low level tool that requires implementing the whole morphology
fca9437
of a language as a left associative grammar. Therefore languages that have
fca9437
simple or even moderately complex morphologies and do not require morphological
fca9437
analysis in their hyphenators should be implemented using other tools such as
fca9437
Hunspell.
fca9437
fca9437
%package        devel
fca9437
Summary:        Development files for %{name}
22e51a5
Requires:       %{name}%{?_isa} = %{version}-%{release}
22e51a5
Requires:       pkgconfig
fca9437
fca9437
%description    devel
fca9437
The %{name}-devel package contains libraries and header files for
fca9437
developing applications that use %{name}.
fca9437
0b39fcd
%package -n     voikko-tools
0b39fcd
Summary:        Test tools for %{name}
22e51a5
Requires:       %{name}%{?_isa} = %{version}-%{release}
0b39fcd
0b39fcd
%description -n voikko-tools
0b39fcd
This package contains voikkospell and voikkohyphenate, small command line
0b39fcd
tools for testing libvoikko. These tools may also be useful for shell
0b39fcd
scripts.
fca9437
3c88a56
%package -n python3-libvoikko
35f57d2
Summary:        Python interface to %{name}
1e92642
Requires:       %{name} = %{version}-%{release}
5d20fb7
BuildArch:      noarch
35f57d2
3c88a56
%description -n python3-libvoikko
35f57d2
Python interface to libvoikko, library of Finnish language tools.
35f57d2
This module can be used to perform various natural language analysis
35f57d2
tasks on Finnish text.
35f57d2
fca9437
%prep
374ff8b
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
374ff8b
374ff8b
%autosetup
fca9437
fca9437
fca9437
%build
374ff8b
# Use vfst for now, no hfst yet. We need to package hfst-ospell for the hfst dictionaries.
374ff8b
# Use /usr/lib/voikko for the dictionaries, this is where the voikko-fi package will put them.
dae3fb1
# The dictonary path has been agreed on in reviews and fedora-devel discussions.
dae3fb1
# This way the voikko-fi package can be noarch.
dae3fb1
%configure --disable-hfst --with-dictionary-path=%{_prefix}/lib/voikko
3958114
# Remove rpath,
3958114
# https://fedoraproject.org/wiki/Packaging/Guidelines#Removing_Rpath
3958114
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
3958114
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
374ff8b
%make_build CXXFLAGS="$CXXFLAGS"
fca9437
fca9437
fca9437
%install
fca9437
make install INSTALL="install -p" DESTDIR=$RPM_BUILD_ROOT
fca9437
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
fca9437
# Remove static archive
fca9437
find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';'
35f57d2
# Install the Python interface
3c88a56
install -d $RPM_BUILD_ROOT%{python3_sitelib}
3c88a56
install -pm 0644 python/libvoikko.py $RPM_BUILD_ROOT%{python3_sitelib}/
dae3fb1
# Make the directory for the dictionary data files, so this package can own it.
dae3fb1
mkdir -p %{buildroot}%{_prefix}/lib/voikko
fca9437
fca9437
fca9437
%files
dae3fb1
%doc ChangeLog README
dae3fb1
%license COPYING
dae3fb1
%dir %{_prefix}/lib/voikko
374ff8b
%{_libdir}/libvoikko.so.1*
0b39fcd
0b39fcd
%files -n voikko-tools
fca9437
%{_bindir}/voikkospell
fca9437
%{_bindir}/voikkohyphenate
1d6dbda
%{_bindir}/voikkogc
374ff8b
%{_bindir}/voikkovfstc
5bb75b9
%{_mandir}/man1/voikkohyphenate.1*
5bb75b9
%{_mandir}/man1/voikkospell.1*
5bb75b9
%{_mandir}/man1/voikkogc.1*
374ff8b
%{_mandir}/man1/voikkovfstc.1*
fca9437
fca9437
%files devel
fca9437
%{_includedir}/*
374ff8b
%{_libdir}/libvoikko.so
d6adad0
%{_libdir}/pkgconfig/libvoikko.pc
fca9437
3c88a56
%files -n python3-libvoikko
374ff8b
%pycached %{python3_sitelib}/%{name}.py
35f57d2
fca9437
%changelog
78e4554
%autochangelog