File gocr.spec of Package gocr

#
# spec file for package gocr
#
# 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:           gocr
Version:        0.50
Release:        0
Summary:        Optical Character Recognition Program
License:        GPL-2.0+
Group:          Productivity/Graphics/Other
Url:            http://jocr.sourceforge.net/
Source0:        http://www-e.uni-magdeburg.de/jschulen/ocr/%{name}-%{version}.tar.gz
Source1:        gocr.desktop
%if 0%{?suse_version} > 1210
BuildRequires:  desktop-file-utils
%else
BuildRequires:  update-desktop-files
%endif
BuildRequires:  libnetpbm-devel
BuildRequires:  transfig
Requires:       jpeg
Requires:       netpbm
Requires:       transfig
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
GOCR is an optical character recognition program. It reads images in
many formats and outputs a text file. It is also able to recognize
and translate barcodes.

%package gui
Summary:        Optical Character Recognition Program - Basic Graphical Interface
Group:          Productivity/Graphics/Other
Requires:       %{name} = %{version}
Requires:       tk
Supplements:    packageand(gocr:tk)

%description gui
GOCR is an optical character recognition program. It reads images in
many formats and outputs a text file. It is also able to recognize
and translate barcodes.

This package contains a basic graphical interface for GOCR.

%prep
%setup -q

# Fix rpmlint warning "hidden-file-or-dir"
rm -f examples/.#Makefile.1.22

# Fix rpmlint warning "doc-file-dependency"
chmod 644 examples/score

# Remove build time references so build-compare can do its work (fix rpmlint warning "file-contains-current-date")
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" src/gocr.c

%build
# configure does not check if netpbm headers are installed in /usr/include/netpbm
export CPPFLAGS=-I%{_includedir}/netpbm
%configure
make %{?_smp_mflags}
make %{?_smp_mflags} examples

%install
%make_install

# Fix rpmlint warning "spurious-executable-perm"
chmod 644 %{buildroot}%{_mandir}/man1/gocr.1

# Fix doc files path in manpage
perl -pi -e "s|/usr/share/doc/gocr-\\\fBX.XX\\\fR/|/usr/share/doc/packages/gocr/|" %{buildroot}%{_mandir}/man1/gocr.1

# Install desktop file
%if 0%{?suse_version} > 1210
desktop-file-install %{SOURCE1}
%else
%suse_update_desktop_file -i %{name}
%endif

%files
%defattr(-,root,root,-)
%doc AUTHORS BUGS CREDITS HISTORY README READMEde.txt TODO gpl.html
%doc doc/{examples.txt,gocr.html,unicode.txt}
%doc examples/
%doc %{_mandir}/man1/gocr.1%{ext_man}
%{_bindir}/gocr

%files gui
%defattr(-,root,root,-)
%{_bindir}/gocr.tcl
%{_datadir}/applications/gocr.desktop

%changelog