File presage.spec of Package presage

#
# spec file for package presage
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)

Name:           presage
Version:        0.8.9
Release:        0
Summary:        Intelligent predictive text entry platform (tools and demos)
License:        GPL-2.0
Group:          Productivity/Text/Utilities
Url:            http://presage.sourceforge.net
Source:         %{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM jzheng@suse.com - fix ncurese builds in openSUSE
Patch0:         presage-0.8.9-ncurses_flag.patch
# PATCH-FIX-UPSTREAM i@marguerite.su - port to cmuclmtk
Patch1:         presage-0.8.9-port_cmuclmtk.patch
# PATCH-FIX-UPSTREAM i@marguerite.su automake 1.12 abuild patch
Patch2:         presage-0.8.9-automake_1.12_abuild.patch
%if 0%{?suse_version}
BuildRequires:  dbus-1-glib-devel
BuildRequires:  dbus-1-python-devel
BuildRequires:  libcppunit-devel
BuildRequires:  sqlite3-devel
%if 0%{?suse_version} >= 1220
BuildRequires:  libXevie-devel
%else
BuildRequires:  xorg-x11-libXv-devel
%endif
BuildRequires:  update-desktop-files
%else
BuildRequires:  cppunit-devel
BuildRequires:  dbus-glib-devel
BuildRequires:  dbus-python-devel
BuildRequires:  desktop-file-utils
BuildRequires:  libXevie-devel
BuildRequires:  sqlite-devel
%endif
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  graphviz
BuildRequires:  graphviz-gd
BuildRequires:  help2man
BuildRequires:  libcmuclmtk-devel
BuildRequires:  libgnome-devel
BuildRequires:  libtool
BuildRequires:  ncurses-devel
BuildRequires:  python-atspi
BuildRequires:  python-devel
BuildRequires:  python-gtk-devel
BuildRequires:  python-wxWidgets
BuildRequires:  python-wxWidgets-devel
BuildRequires:  python-xlib
BuildRequires:  swig
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Presage is an intelligent predictive text entry platform.

This package contains the tools required to generate custom statistical data used by the presage predictive text engine to generate predictions.

This package also contains simple demonstration programs and simulator.

%package -n libpresage-devel
Summary:        Intelligent predictive text entry platform (development files)
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       libpresage1 = %{version}

%description -n libpresage-devel
Presage is an intelligent predictive text entry platform.

This package contains development files.

This package contains the header files needed to compile applications or shared objects that use libpresage.

%package -n libpresage1
Summary:        Intelligent predictive text entry platform (shared library)
Group:          System/Libraries
Requires:       presage-data

%description -n libpresage1
Presage is an intelligent predictive text entry platform.

A predictive text entry system attempts to improve the ease and speed of textual input by predicting words. Word prediction consists in computing which word tokens or word completions are most likely to be entered next. The system analyses the text already entered and combines the information thus extracted with other information sources to calculate the set of most probable tokens.

Presage exploits redundant information embedded in natural languages to generate word predictions. The modular architecture allows its language model to be extended and customized to utilize statistical, syntactic, and semantic information sources.

This package contains the shared library.

%package -n presage-data
Summary:        Intelligent predictive text entry platform (data files)
Group:          System/Libraries
Provides:       libpresage-data = %{version}
Obsoletes:      libpresage-data < %{version}

%description -n presage-data
Presage is an intelligent predictive text entry platform.

This package contains the sample statistical data files and abbreviation files needed by presage.

%package -n libpresage-doc
Summary:        Intelligent predictive text entry platform (documentation)
Group:          Documentation/Other
%if ! 0%{?sles_version}
BuildArch:      noarch
%endif

%description -n libpresage-doc
Presage is an intelligent predictive text entry platform.

This package contains the documentation for libpresage.

Documentation is available in HTML and LaTeX format.

%package -n python-presage
Summary:        Intelligent predictive text entry platform (Python binding)
Group:          System/Libraries
%py_requires

%description -n python-presage
Presage is an intelligent predictive text entry platform.

This package provides the Python binding for libpresage.

This package contains the Python extension module for libpresage.

%package -n dbus-1-presage
Summary:        Intelligent predictive text entry platform (dbus service)
Group:          System/Libraries

%description -n dbus-1-presage
Presage is an intelligent predictive text entry platform.

This package contains the presage D-Bus service.

This package also contains a simple demonstration program that uses the D-Bus service.

%package -n gpresagemate
Summary:        Universial predictive text companion
Group:          Productivity/Text/Utilities

%description -n gpresagemate
Presagemate is a universal predictive text companion. Presagemate works alongside any AT-SPI aware application. The Assistive Technology Service Provider Interface (AT-SPI) is a toolkit-neutral way of providing accessibility facilities in applications. Presagemate works in the background by tracking what keystrokes are typed and displaying predictions in its window. When a prediction is selected, text is sent to the active application.

%package -n python-presagemate
Summary:        Universial predictive text companion
Group:          Productivity/Text/Utilities
Requires:       python-atspi
Requires:       python-gtk
Requires:       python-presage
Requires:       python-xlib
BuildArch:      noarch
%py_requires

%description -n python-presagemate
Pypresagemate is a universal predictive text companion. Pypresagemate works alongside any AT-SPI aware application. The Assistive Technology Service Provider Interface (AT-SPI) is a toolkit-neutral way of providing accessibility facilities in applications. Pypresagemate works in the background by tracking what keystrokes are typed and displaying predictions in its window. When a prediction is selected, text is sent to the active application.

%package -n gprompter
Summary:        Intelligent predictive GTK+ text editor
Group:          Productivity/Text/Editors

%description -n gprompter
gprompter is a cross-platform predictive text editor, based on presage, the intelligent predictive text entry platform.

gprompter displays predictions in a contextual pop-up box as each letter is typed. Predictions can be easily selected and inserted in the document.

%package -n pyprompter
Summary:        Intelligent predictive wxPython text editor
Group:          Productivity/Text/Editors
Requires:       python-presagemate
Requires:       python-wxWidgets
BuildArch:      noarch
%py_requires

%description -n pyprompter
This package contains the wxPython predictive text editor pyprompter.

pyprompter is a cross-platform predictive text editor.

pyprompter displays predictions in a contextual pop-up box as each letter is typed. Predictions can be easily selected and inserted in the document.

%prep
%setup -q
find . -type f -exec sed -i  's/\r//g' "{}" \;
%patch0 -p1
%patch1 -p1
%if 0%{?suse_version} >= 1220
%patch2 -p1
%endif
echo "[D-BUS Service]" > apps/dbus/org.gnome.presage.service.in
echo "Name=org.gnome.presage.beta" >> apps/dbus/org.gnome.presage.service.in
echo "Exec={bindir}/presage_dbus_service --start" >> apps/dbus/org.gnome.presage.service.in
echo "User=root" >> apps/dbus/org.gnome.presage.service.in

%build
export LIBS+="-lm -lX11 -lgmodule-2.0 -lncurses"
autoreconf -fi
%configure
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}

rm -rf %{buildroot}%{_libdir}/*.a
rm -rf %{buildroot}%{_libdir}/*.la

%if 0%{?suse_version}

pushd %{buildroot}%{python_sitelib}/prompter/
%py_compile .
popd
pushd %{buildroot}%{python_sitearch}/
%py_compile .
popd

%suse_update_desktop_file gprompter Utility DesktopUtility
%suse_update_desktop_file pyprompter Utility DesktopUtility

%fdupes %{buildroot}

%else

desktop-file-install --add-category="Utility" --delete-original --dir=%{buildroot}%{_datadir}/applications \
%{buildroot}/%{_datadir}/applications/gprompter.desktop
desktop-file-install --add-category="Utility" --delete-original --dir=%{buildroot}%{_datadir}/applications \
%{buildroot}/%{_datadir}/applications/pyprompter.desktop

fdupes -n -q -r %{buildroot}

%endif

%post -n libpresage1 -p /sbin/ldconfig

%postun -n libpresage1 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog NEWS README COPYING THANKS TODO
%{_bindir}/presage_demo
%{_bindir}/presage_demo_text
%{_mandir}/man1/presage_demo.1.gz
%{_bindir}/presage_simulator
%{_bindir}/text2ngram
%{_mandir}/man1/presage_demo_text.1.gz
%{_mandir}/man1/presage_simulator.1.gz
%{_mandir}/man1/text2ngram.1.gz

%files -n dbus-1-presage
%defattr(-,root,root)
%{_bindir}/presage_dbus_python_demo
%{_bindir}/presage_dbus_service
%{python_sitelib}/presage_dbus_service.py
%{python_sitelib}/presage_dbus_service.pyc
%{python_sitelib}/presage_dbus_service.pyo
%{_datadir}/dbus-1/services/org.gnome.presage.service
%{_mandir}/man1/presage_dbus_python_demo.1.gz
%{_mandir}/man1/presage_dbus_service.1.gz

%files -n libpresage1
%defattr(-,root,root)
%{_libdir}/libpresage.so.1
%{_libdir}/libpresage.so.1.1.1

%files -n presage-data
%defattr(-,root,root)
%config %{_sysconfdir}/presage.xml
%{_datadir}/presage
%exclude %{_datadir}/presage/html
%exclude %{_datadir}/presage/latex
%exclude %{_datadir}/presage/getting_started.txt

%files -n libpresage-doc
%defattr(-,root,root)
%{_datadir}/presage/html/
%{_datadir}/presage/latex/
%{_datadir}/presage/getting_started.txt

%files -n gpresagemate
%defattr(-,root,root)
%{_bindir}/gpresagemate

%files -n python-presagemate
%defattr(-,root,root)
%{_bindir}/pypresagemate
%{python_sitelib}/presagemate

%files -n libpresage-devel
%defattr(-,root,root)
%{_includedir}/presageCallback.h
%{_includedir}/presageException.h
%{_includedir}/presage.h
%{_libdir}/libpresage.so

%files -n python-presage
%defattr(-,root,root)
%{_bindir}/presage_python_demo
%{python_sitearch}/_presage.so
%{python_sitearch}/presage.py
%{python_sitearch}/presage.pyc
%if 0%{?fedora}
%{python_sitearch}/presage.pyo
%endif
%{_mandir}/man1/presage_python_demo.1.gz
%{python_sitearch}/python_presage-0.8.9-py%{py_ver}.egg-info

%files -n pyprompter
%defattr(-,root,root)
%{_bindir}/pyprompter
%{python_sitelib}/prompter
%{python_sitelib}/pyprompter-0.8.9-py%{py_ver}.egg-info
%{_datadir}/applications/pyprompter.desktop
%{_datadir}/icons/hicolor/scalable/apps/pyprompter.svg
%{_mandir}/man1/pyprompter.1.gz
%{_datadir}/pixmaps/pyprompter.*

%files -n gprompter
%defattr(-,root,root)
%{_bindir}/gprompter
%{_datadir}/applications/gprompter.desktop
%{_datadir}/icons/hicolor/scalable/apps/gprompter.svg
%{_mandir}/man1/gprompter.1.gz
%{_datadir}/pixmaps/gprompter.*

%changelog