File gimagereader.spec of Package gimagereader

Name:          gimagereader
Version:       3.3.0
Release:       1%{?dist}
Summary:       A front-end to tesseract-ocr

License:       GPL-3.0+
URL:           https://github.com/manisandro/gimagereader
Source0:       https://github.com/manisandro/gimagereader/releases/download/v%{version}/%{name}-%{version}.tar.xz


BuildRequires: cmake
%if 0%{?suse_version} > 1310
BuildRequires: gtkmm3-devel
BuildRequires: gtkspellmm3-devel
BuildRequires: gtksourceviewmm-devel
BuildRequires: cairomm-devel
BuildRequires: libpoppler-glib-devel
BuildRequires: json-glib-devel
BuildRequires: pkgconfig(libxml++-2.6)
%endif
%if 0%{?suse_version} > 1320
BuildRequires: tesseract-ocr-devel
%else
BuildRequires: tesseract-devel
%endif
BuildRequires: sane-backends-devel
BuildRequires: intltool
BuildRequires: desktop-file-utils
BuildRequires: libqt5-qtbase-devel
BuildRequires: libQt5DBus-devel
BuildRequires: libQt5Network-devel
BuildRequires: libQt5Widgets-devel
BuildRequires: libQt5Xml-devel
BuildRequires: libQt5PrintSupport-devel
BuildRequires: qtspell-qt5-devel
BuildRequires: libpoppler-qt5-devel
BuildRequires: hicolor-icon-theme
BuildRequires: libqjson-devel
BuildRequires: libpodofo-devel
BuildRequires: enchant-devel
BuildRequires: libdjvulibre-devel
BuildRequires: libzip-devel
BuildRequires: libuuid-devel
BuildRequires: python3-gobject
BuildRequires: libquazip-qt5-devel

Requires:      hicolor-icon-theme

%description
gImageReader is a simple front-end to tesseract. Features include:
 - Automatic page layout detection
 - User can manually define and adjust recognition regions
 - Import images from disk, scanning devices, clipboard and screenshots
 - Supports multipage PDF documents
 - Recognized text displayed directly next to the image
 - Editing of output text, including search/replace and removing line breaks
 - Spellchecking for output text (if corresponding dictionary installed)


%if 0%{?suse_version} > 1310
%package gtk
Summary:       A Gtk+ front-end to tesseract-ocr
Group:         Productivity/Graphics/Other
Requires:      %{name}-common = %{version}-%{release}

%description gtk
gImageReader is a simple front-end to tesseract. Features include:
 - Automatic page layout detection
 - User can manually define and adjust recognition regions
 - Import images from disk, scanning devices, clipboard and screenshots
 - Supports multipage PDF documents
 - Recognized text displayed directly next to the image
 - Editing of output text, including search/replace and removing line breaks
 - Spellchecking for output text (if corresponding dictionary installed)
This package contains the Gtk+ front-end.
%endif


%package qt
Summary:       A Qt front-end to tesseract-ocr
Group:         Productivity/Graphics/Other
Requires:      %{name}-common = %{version}-%{release}

%description qt
gImageReader is a simple front-end to tesseract. Features include:
 - Automatic page layout detection
 - User can manually define and adjust recognition regions
 - Import images from disk, scanning devices, clipboard and screenshots
 - Supports multipage PDF documents
 - Recognized text displayed directly next to the image
 - Editing of output text, including search/replace and removing line breaks
 - Spellchecking for output text (if corresponding dictionary installed)
This package contains the Qt front-end.

%package common
Summary:       Common files for %{name}
Group:         Productivity/Graphics/Other
BuildArch:     noarch

%description common
Common files for %{name}.


%prep
%setup -q


%build
%if 0%{?suse_version} > 1310
mkdir build_gtk
(
cd build_gtk
%cmake -DINTERFACE_TYPE=gtk -DENABLE_VERSIONCHECK=0 -DMANUAL_DIR="%{_defaultdocdir}/%{name}-common" ../..
make %{?_smp_mflags}
)
%endif
mkdir build_qt
(
cd build_qt
%cmake -DINTERFACE_TYPE=qt5 -DENABLE_VERSIONCHECK=0 -DMANUAL_DIR="%{_defaultdocdir}/%{name}-common" ../..
make %{?_smp_mflags}
)


%install
%if 0%{?suse_version} > 1310
%make_install -C build_gtk/build
%{_bindir}/desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}-gtk.desktop
%endif
%make_install -C build_qt/build
%{_bindir}/desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}-qt5.desktop

%find_lang %{name}


%if 0%{?suse_version} > 1310
%post gtk
/usr/bin/update-desktop-database &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :


%postun gtk
/usr/bin/update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ] ; then
    /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans gtk
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%endif


%post qt
/usr/bin/update-desktop-database &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :


%postun qt
/usr/bin/update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans qt
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files common -f %{name}.lang
%defattr (-, root, root)
%doc AUTHORS COPYING NEWS README.md
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%doc %{_defaultdocdir}/%{name}-common/manual*.html

%if 0%{?suse_version} > 1310
%files gtk
%defattr (-, root, root)
%{_bindir}/%{name}-gtk
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/%{name}-gtk.appdata.xml
%{_datadir}/applications/%{name}-gtk.desktop
%{_datadir}/glib-2.0/schemas/org.gnome.%{name}.gschema.xml
%endif

%files qt
%defattr (-, root, root)
%{_bindir}/%{name}-qt5
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/%{name}-qt5.appdata.xml
%{_datadir}/applications/%{name}-qt5.desktop

%changelog
* Fri Sep 28 2018 Sandro mani <manisandro@gmail.com> - 3.3.0-1
- Update to 3.3.0

* Sun Feb 18 2018 Jaime Marquínez Ferrrándiz <jaime.marquinez.ferrandiz@fastmail.net> - 3.2.3-2
- Build with qt5

* Sat Jul 01 2017 Sandro Mani <manisandro@gmail.com> - 3.2.3-1
- gImageReader 3.2.3

* Fri Jun 30 2017 Sandro Mani <manisandro@gmail.com> - 3.2.2-1
- gImageReader 3.2.2

* Fri Feb 10 2017 Sandro Mani <manisandro@gmail.com> - 3.2.1-1
- gImageReader 3.2.1

* Wed Nov 23 2016 Sandro Mani <manisandro@gmail.com> - 3.2.0-1
- gImageReader 3.2.0

* Mon Oct 17 2016 Sandro Mani <manisandro@gmail.com> - 3.1.99-1
- gImageReader 3.1.99

* Tue May 03 2016 Sandro Mani <manisandro@gmail.com> - 3.1.91-1
- gImageReader 3.1.91

* Thu Apr 28 2016 Sandro Mani <manisandro@gmail.com> - 3.1.90-1
- gImageReader 3.1.90

* Tue Jun 30 2015 Sandro Mani <manisandro@gmail.com> - 3.1.2-1
- gImageReader 3.1.2

* Thu Jun 11 2015 Sandro Mani <manisandro@gmail.com> - 3.1.1-1
- gImageReader 3.1.1

* Fri May 01 2015 Sandro Mani <manisandro@gmail.com> - 3.1-1
- gImageReader 3.1

* Sun Jan 04 2015 Sandro Mani <manisandro@gmail.com> - 3.0.1-1
- gImageReader 3.0.1

- Fri Dec 12 2014 Sandro Mani <manisandro@gmail.com> - 3.0-1
- gImageReader 3.0

* Sat Dec 06 2014 Sandro Mani <manisandro@gmail.com> - 2.94-0.1
- gImageReader 2.94.
openSUSE Build Service is sponsored by