LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File tesseract-gui.spec of Package tesseract-gui (Project home:flyos)

#
# spec file for package tesseract-gui
#
# 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/
#


Name:           tesseract-gui
Version:        2.9
Release:        0
License:        GPL-3.0+
Summary:        GTK+ Based GUI for Tesseract
Url:            http://tesseract-gui.sourceforge.net/
Group:          Productivity/Graphics/Other
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
BuildRequires:  hicolor-icon-theme
BuildRequires:  python-base
BuildRequires:  rsvg-view
BuildRequires:  update-desktop-files
Requires:       ImageMagick
Requires:       python-gtk
Requires:       tesseract-ocr >= 3.00
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Tesseract-GUI is not a front-end for tesseract-ocr.
It is just a graphical way to use it with simple image manipulation
thru ImageMagick.

Some features are:
* Auto-index: Process lots of images and index and rename all output
  text files automatically.
* Rotate: To correct the angle of images after scan and before covert
  them.
* Crop: Convert just an area of the image. You can use it to create
  columns.
* Contrast: Lighten or darken the edge of the characters of the image.
* Generalize: Apply the changes to every image.
* Concatenate: Now you can create an only final text file with this
  option.

%prep
%setup -q
sed -i 's/env python/python/' bin/%{name}.py

%build

%install
# Create a desktop file because the original one is incorrect.
cat > %{name}.desktop << EOF
[Desktop Entry]
Name=Tesseract GUI
GenericName=GTK+ Based GUI for Tesseract
GenericName[ru]=Графическая оболочка для Tesseract
Type=Application
Exec=tesseract-gui
Icon=tesseract-gui
Categories=Graphics;OCR;Scanning;
Comment=Manipulate and OCR scanned images
Comment[ru]=Оптическое распознавание отсканированных изображений
Terminal=false
StartupNotify=true
EOF

install -Dm 0755 bin/%{name}.py \
    %{buildroot}%{_datadir}/%{name}/%{name}.py
install -dm 0755 %{buildroot}%{_bindir}/
ln -s ../share/%{name}/%{name}.py %{buildroot}%{_bindir}/%{name}
install -m 0644 share/tesseract-gui/* \
    %{buildroot}%{_datadir}/%{name}/

# Python byte compile.
pushd %{buildroot}%{_datadir}/%{name}/
%py_compile .
popd

# Install icons of various sizes.
install -Dm 0644 share/icons/%{name}-icon.svg \
    %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
for s in 256 128 96 64 48 32 22 16 ; do
install -dm 0755 \
    %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps
rsvg-convert -w ${s} -h ${s} share/icons/%{name}-icon.svg -o \
    %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/%{name}.png
done

%suse_update_desktop_file -i %{name}

%post
%icon_theme_cache_post

%postun
%icon_theme_cache_postun

%files
%defattr(-,root,root,-)
%doc README
%{_bindir}/%{name}
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/*/%{name}.*

%changelog