%define _version      0.044
%define _ocre_version %(echo %{_version} | sed 's|\\.|_|g')

Summary:       OCR E/asy (and free/libre)
Name:          ocre
Version:       %{_version}
Release:       0%{?dist}.4sunshine
# source says "GPL"
License:       GPLv2+
Group:         Applications/Multimedia
URL:           http://lem.eui.upm.es/ocre.html
Source0:       ftp://lem.eui.upm.es/pub/ocre/%{name}_v%{_ocre_version}.tgz
Source1:       ftp://lem.eui.upm.es/pub/ocre/%{name}-decsWood-%{version}.tgz
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gcc
BuildRequires: make
BuildRequires: glib2-devel
BuildRequires: gtk2-devel
BuildRequires: aspell-devel

%description
o.c.r. easy (and free/libre)
input: PGM/PBM file 
output: ASCII characters in standard output
process: segmentation, and more comparison 

%prep
%setup -q
# sed -i "s|-Isrc|-Isrc -I.|" ocre/Makefile
# drop bogus pre-defined dependencies
sed -i 's|include ddepend|# include ddepend|' ocre/Makefile

%build
pushd %{name}
touch src/opcionesp.h src/opcionesp.c
make %{?_smp_mflags} CFLAGS1="%{optflags} -fcommon"
export TACA=`mktemp`
iconv -f latin1 -t utf8 man/ocre-es.1 -o $TACA
mv $TACA man/ocre-es.1
popd


%install
pushd %{name}
export DESTDIR=%{buildroot}%{_prefix}
make -e install installman
#rm -rf %{buildroot}/bin
#rm -rf %{buildroot}/share
tar -xvzf %{SOURCE1} 
mkdir -p %{buildroot}/%{_datadir}/ocre
mv decsWood* %{buildroot}/%{_datadir}/ocre/
popd

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root, 0755)
%{!?_licensedir:%global license %%doc}
%license ocre/GPL 

%{_bindir}/%{name}
%{_mandir}/es/man1/%{name}.1*
%{_mandir}/man1/%{name}.1*
%{_datadir}/%{name}


%changelog
* Mon Nov 21 2022 Moritz Barsnick <moritz+rpm@barsnick.net> 0.044-0.4sunshine
- rebuild

* Fri Jul 30 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 0.044-0.3sunshine
- BR make
- add -fcommon to CFLAGS to work around failures with recent gcc

* Mon Nov 05 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 0.044-0.2sunshine
- BR gcc

* Wed Oct 18 2017 Moritz Barsnick <moritz+rpm@barsnick.net> 0.044-0.1sunshine
- update to 0.044
- use %%license tag where available

* Mon Aug 11 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 0.043-0.3sunshine
- drop use of bogus dependencies (they clash with newer glib2-devel, for example)

* Thu Apr 10 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 0.043-0.2sunshine
- add BR glib2-devel
- rpmlint fixes:
  - assume GPL, as stated in source, implies GPLv2+
  - bogus date in %%changelog
  - bogus %%make macro

* Wed Apr 09 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 0.043-0.1sunshine
- update to 0.043

* Thu Jun 21 2012 Moritz Barsnick <moritz+rpm@barsnick.net> 0.042-0.1sunshine
- update to 0.042

* Mon May 14 2012 Moritz Barsnick <moritz+rpm@barsnick.net> 0.041-0.1sunshine
- update to 0.041

* Thu Apr 19 2012 Moritz Barsnick <moritz+rpm@barsnick.net> 0.040-0.1sunshine
- update to 0.040

* Mon Aug 22 2011 Moritz Barsnick <moritz+rpm@barsnick.net> 0.039-0.1sunshine
- update to 0.039

* Sat Jul 16 2011 Moritz Barsnick <moritz+rpm@barsnick.net> 0.038-0.1sunshine
- update to 0.038

* Tue May 17 2011 Moritz Barsnick <moritz+rpm@barsnick.net> 0.036-0.1sunshine
- update to 0.036

* Sat Apr 30 2011 Moritz Barsnick <moritz+rpm@barsnick.net> 0.035-0.1sunshine
- update to 0.035

* Tue Mar 02 2010 Moritz Barsnick <moritz+rpm@barsnick.net> 0.034-0.1sunshine
- update to 0.034
- drop the Makefile sed include hack

* Fri Nov 27 2009 Moritz Barsnick <moritz+rpm@barsnick.net> 0.033-0.1sunshine
- update to 0.033

* Tue Oct 20 2009 Moritz Barsnick <moritz+rpm@barsnick.net> 0.032-0.1sunshine
- update to 0.032
- provide upstream Source URLs and use originally named source package

* Mon Feb 23 2009 Moritz Barsnick <moritz+rpm@barsnick.net> 0.031-0.2sunshine
- rebuild for F10 on sunshine

* Fri Jan 23 2009 Moritz Barsnick <moritz+rpm@barsnick.net> 0.031-0.1sunshine
- update to 0.031
- build for F8 on sunshine
- use %%{optflags}
- add the rather obvious BR gtk2-devel
- add BR aspell-devel
- use normed BuildRoot
- use macros for paths
- adapt to new source package paths

* Wed Dec 13 2006 Ismael Olea <ismael@olea.org> 0.026-1olea
- updated to 0.026

* Sun Dec 10 2006 Ismael Olea <ismael@olea.org> 0.018-2qilnx_2olea
- cleaning spec file.

* Wed Jun 22 2005 Alessandro Ramazzina <alessandro.ramazzina@qilinux.it> 0.018-2qilnx
- rebuild and moved from devel-contrib repository to devel repository

* Tue Jun 21 2005 Matteo Bernasconi <voyagernm@virgilio.it> 0.018-1qilnx
- First Build