#
# Conditional build:
-%bcond_with foma # use foma by linking with libfoma (GPL v2-strict, which is not compliant)
+%bcond_without python3 # Python 3 binding
+%bcond_without readline # readline in interactive programs
#
Summary: Helsinki Finite-State Transducer (library and application suite)
Summary(pl.UTF-8): Helsinki Finite-State Transducer (biblioteka i zestaw aplikacji)
Name: hfst
-Version: 3.1.0
-Release: 1
-License: GPL v3
+Version: 3.11.0
+Release: 5
+License: LGPL v3 (library), GPL v3 (tools)
Group: Applications/Text
-Source0: http://downloads.sourceforge.net/hfst/%{name}-%{version}.tar.gz
-# Source0-md5: 384a0727bfabb256a3a26077fc9a68d9
+#Source0Download: https://github.com/hfst/hfst/releases
+Source0: https://github.com/hfst/hfst/releases/download/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 6cbdddcb9ef28aa5681081a8a1dc6b54
Patch0: %{name}-pc.patch
URL: http://www.ling.helsinki.fi/kieliteknologia/tutkimus/hfst/
-BuildRequires: SFST-devel
+# bundled library is used
+#BuildRequires: SFST-devel
BuildRequires: autoconf >= 2.62
BuildRequires: automake >= 1:1.11
BuildRequires: bison
-%{?with_foma:BuildRequires: foma-devel}
BuildRequires: flex >= 2.5.35
+BuildRequires: glib2-devel >= 1:2.16
BuildRequires: libstdc++-devel
-BuildRequires: libtool >= 2:2.0
-BuildRequires: openfst-devel
+BuildRequires: libtool >= 2:2.2
+# disabled in sources
+#BuildRequires: libxml2-devel >= 2
+BuildRequires: ncurses-devel
+# bundled library is used
+#BuildRequires: openfst-devel
+BuildRequires: pkgconfig >= 1:0.14
+BuildRequires: python >= 1:2.4
+%{?with_python3:BuildRequires: python3 >= 1:3.2}
+%{?with_readline:BuildRequires: readline-devel}
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+%{?with_python3:BuildRequires: swig-python}
+BuildRequires: zlib-devel
+Requires: glib2 >= 1:2.16
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
narzędzi opartych na technice przetwarzania ze skończoną liczbą
stanów z wagami lub bez.
+%package tagger
+Summary: HFST Tagger scripts
+Summary(pl.UTF-8): Skrypty HFST Tagger
+License: GPL v3
+Group: Applications/Text
+Requires: %{name} = %{version}-%{release}
+
+%description tagger
+HFST Tagger scripts written in Python.
+
+%description tagger -l pl.UTF-8
+Skrypty HFST Tagger napisane w Pythonie.
+
%package devel
Summary: Header files for HFST library
Summary(pl.UTF-8): Pliki nagłówkowe biblioteki HFST
+License: LGPL v3
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
-Requires: SFST-devel
-%{?with_foma:Requires: foma-devel}
+#Requires: SFST-devel
+Requires: glib2-devel >= 1:2.16
Requires: libstdc++-devel
-Requires: openfst-devel
+#Requires: openfst-devel
+Requires: readline-devel
%description devel
Header files for HFST library.
%package static
Summary: Static HFST library
Summary(pl.UTF-8): Statyczna biblioteka HFST
+License: LGPL v3
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
%description static -l pl.UTF-8
Statyczna biblioteka HFST.
+%package -n python-hfst
+Summary: Python 2 binding for HFST library
+Summary(pl.UTF-8): Wiązanie Pythona 2 do biblioteki HFST
+License: LGPL v3
+Group: Libraries/Python
+Requires: %{name} = %{version}-%{release}
+
+%description -n python-hfst
+Python 2 binding for HFST library.
+
+%description -n python-hfst -l pl.UTF-8
+Wiązanie Pythona 2 do biblioteki HFST.
+
+%package -n python3-hfst
+Summary: Python 3 binding for HFST library
+Summary(pl.UTF-8): Wiązanie Pythona 3 do biblioteki HFST
+License: LGPL v3
+Group: Libraries/Python
+Requires: %{name} = %{version}-%{release}
+
+%description -n python3-hfst
+Python 3 binding for HFST library.
+
+%description -n python3-hfst -l pl.UTF-8
+Wiązanie Pythona 3 do biblioteki HFST.
+
%prep
%setup -q
%patch0 -p1
%{__autoheader}
%{__automake}
%configure \
- FOMACLI=/usr/bin/foma \
+ --enable-calculate \
+ --enable-foma-wrapper \
+ --enable-lexc \
+ --enable-lexc-wrapper \
+ --enable-proc \
--disable-silent-rules \
- --enable-static \
- %{!?with_foma:--without-foma}
+ --enable-tagger \
+ --enable-xfst \
+ %{?with_readline:--with-readline} \
+ --with-unicode-handler=glib
-%{__make}
+# parallel build is broken with foma backend
+%{__make} -j1
+
+cd python
+%py_build
+%if %{with python3}
+%py3_build
+%endif
%install
rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_bindir}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
# for transducer data
install -d $RPM_BUILD_ROOT%{_datadir}/hfst
+cd python
+%py_install
+%py_postclean
+%if %{with python3}
+%py3_install
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc AUTHORS ChangeLog NEWS README THANKS
+%doc AUTHORS NEWS README THANKS
%attr(755,root,root) %{_bindir}/hfst-*
+%attr(755,root,root) %{_bindir}/hfst_foma
%attr(755,root,root) %{_bindir}/htwolcpre*
%attr(755,root,root) %{_libdir}/libhfst.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libhfst.so.5
+%attr(755,root,root) %ghost %{_libdir}/libhfst.so.46
%dir %{_datadir}/hfst
%{_mandir}/man1/hfst-*.1*
+%{_mandir}/man1/htwolcpre?.1*
+
+%files tagger
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/hfst_tagger_compute_data_statistics.py
+%{py_sitescriptdir}/hfst_tagger_compute_data_statistics.py[co]
+%{py_sitescriptdir}/tagger_aux.py[co]
+%{_mandir}/man1/hfst_tagger_compute_data_statistics.py.1*
%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libhfst.so
%{_includedir}/hfst
+%{_aclocaldir}/hfst.m4
%{_pkgconfigdir}/hfst.pc
%files static
%defattr(644,root,root,755)
%{_libdir}/libhfst.a
+
+%files -n python-hfst
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py_sitedir}/_libhfst.so
+%{py_sitedir}/hfst
+%{py_sitedir}/libhfst.py[co]
+%{py_sitedir}/libhfst_swig-%{version}_beta-py*.egg-info
+
+%if %{with python3}
+%files -n python3-hfst
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py3_sitedir}/_libhfst.cpython-*.so
+%{py3_sitedir}/hfst
+%{py3_sitedir}/libhfst.py
+%{py3_sitedir}/__pycache__/libhfst.cpython-*.py[co]
+%{py3_sitedir}/libhfst_swig-%{version}_beta-py*.egg-info
+%endif