File gimagereader.spec of Package gimagereader

#
# spec file for package gimagereader
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           gimagereader
Version:        3.4.3
Release:        0
Summary:        A front-end to tesseract-ocr
License:        GPL-3.0-or-later
URL:            https://github.com/manisandro/gimagereader
Source0:        https://github.com/manisandro/gimagereader/releases/download/v%{version}/%{name}-%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  curl-devel
BuildRequires:  desktop-file-utils
BuildRequires:  enchant-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  libQt5DBus-devel
BuildRequires:  libQt5Network-devel
BuildRequires:  libQt5PrintSupport-devel
BuildRequires:  libQt5Widgets-devel
BuildRequires:  libQt5Xml-devel
BuildRequires:  libdjvulibre-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpodofo-devel
BuildRequires:  libpoppler-qt5-devel
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  libquazip-qt5-devel
BuildRequires:  libuuid-devel
BuildRequires:  libzip-devel
BuildRequires:  python3-gobject
BuildRequires:  qtspell-qt5-devel
BuildRequires:  sane-backends-devel
%if 0%{?suse_version} > 1310
BuildRequires:  cairomm-devel
BuildRequires:  gtkmm3-devel
BuildRequires:  gtksourceviewmm-devel
BuildRequires:  gtkspellmm3-devel
BuildRequires:  json-glib-devel
BuildRequires:  libpoppler-glib-devel
BuildRequires:  pkgconfig(libxml++-2.6)
%endif
%if 0%{?suse_version} > 1320
BuildRequires:  tesseract-ocr-devel
%else
BuildRequires:  tesseract-devel
%endif

BuildRequires:  libboost_headers-devel >= 1.85

%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
%autosetup -p1


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


%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
%{_bindir}/update-desktop-database &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

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

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


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

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

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

%files common -f %{name}.lang
%license COPYING
%doc AUTHORS 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
%{_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
%{_bindir}/%{name}-qt5
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/%{name}-qt5.appdata.xml
%{_datadir}/applications/%{name}-qt5.desktop

%changelog
openSUSE Build Service is sponsored by