%define git 1 %global app_id org.gnome.OCRFeeder %global commit0 bb5c47a5323411fd9d7d5f36307f3640ca441506 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) %global date 20200418 %define release_number 0 %define python2_pkg python3 %define package_python_sane %{python2_pkg}-sane %if 0%{?rhel} && 0%{?rhel} <= 7 %define package_python_sane %{python2_pkg}-pillow-sane %endif %define dir_appdata metainfo %if 0%{?rhel} && 0%{?rhel} <= 7 %define dir_appdata appdata %endif %if 0%{!?_metainfodir:1} %define _metainfodir %{_datadir}/%{dir_appdata} %endif %define dir_metainfo %( echo "%{_metainfodir}" | xargs -I{} basename '{}' ) %define supports_recommends %{nil} %if 0%{?rhel}%{?fedora} %if 0%{?rhel} >= 8 %define supports_recommends 1 %else %if 0%{?fedora} >= 24 %define supports_recommends 1 %endif %endif %else %if 0%{?suse_version} %if 0%{?suse_version} >= 1000 %define supports_recommends 1 %endif %endif %endif %global _default_patch_fuzz 2 Name: ocrfeeder Version: 0.8.3 %if ! 0%{?git} Release: %{release_number}%{?dist} %else Release: %{release_number}.%{date}git%{shortcommit0}%{?dist} %endif License: GPLv3+ Group: Applications/Productivity URL: https://wiki.gnome.org/Apps/OCRFeeder Summary: Document layout analysis and optical character recognition system BuildArch: noarch %if ! 0%{?git} # https://gitlab.gnome.org/GNOME/ocrfeeder/-/archive/release_0.8.1/ocrfeeder-release_0.8.1.tar.bz2 Source0: https://gitlab.gnome.org/GNOME/%{name}/-/archive/release_%{version}/%{name}-release_%{version}.tar.bz2 %else # https://gitlab.gnome.org/GNOME/ocrfeeder/-/archive/1160f3de992467e977ac415e8a9a028f9c768430/ocrfeeder-1160f3de992467e977ac415e8a9a028f9c768430.tar.bz2 Source0: https://gitlab.gnome.org/GNOME/%{name}/-/archive/%{commit0}/%{name}-%{commit0}.tar.bz2 %endif # Upstreamed patches # Upstreamable patches # Package-specific patches # Fix scanner support #0 # Always display Scanner Chooser Dialog # https://gitlab.gnome.org/scx/ocrfeeder/commit/5236cb220e3b98cdec300db5872a877bb09a205f Patch100: ocrfeeder-0.8.1-fix-scanning-0.patch BuildRequires: intltool BuildRequires: gnome-doc-utils # for glib-gettextize BuildRequires: glib2-devel # for gnome-autogen.sh BuildRequires: gnome-common # for GooCanvas-2.0.typelib BuildRequires: goocanvas2 # for Gtk-3.0.typelib BuildRequires: gtk3 # for GtkSpell-3.0.typelib BuildRequires: gtkspell3 BuildRequires: %{python2_pkg}-devel >= 3.5 # for pygobject3 BuildRequires: %{python2_pkg}-gobject BuildRequires: %{python2_pkg}-enchant BuildRequires: %{python2_pkg}-lxml BuildRequires: %{python2_pkg}-pillow BuildRequires: %{package_python_sane} BuildRequires: %{python2_pkg}-reportlab BuildRequires: %{python2_pkg}-odfpy # for rsvg-convert BuildRequires: librsvg2-tools BuildRequires: desktop-file-utils BuildRequires: libappstream-glib Requires: gtk3 Requires: goocanvas2 Requires: gtkspell3 Requires: %{python2_pkg} >= 3.5 Requires: %{python2_pkg}-gobject Requires: %{python2_pkg}-enchant Requires: %{python2_pkg}-lxml Requires: %{python2_pkg}-pillow Requires: %{package_python_sane} Requires: %{python2_pkg}-reportlab Requires: %{python2_pkg}-odfpy Requires: unpaper Requires: ghostscript Requires: GraphicsMagick Requires: yelp Requires: tesseract %if 0%{?supports_recommends} Recommends: gocr Recommends: ocrad Recommends: cuneiform %endif # https://fedoraproject.org/wiki/Packaging:Scriptlets # https://fedoraproject.org/wiki/PackagingDrafts/ScriptletSnippets Requires(post): coreutils Requires(postun): coreutils Requires(posttrans): coreutils # gtk-update-icon-cache Requires(postun): gtk-update-icon-cache Requires(posttrans): gtk-update-icon-cache # update-desktop-database Requires(post): desktop-file-utils Requires(postun): desktop-file-utils %if "%{name}" != "%{app_id}" Provides: %{app_id} = %{version}-%{release} %endif Provides: ocrfeeder-cli = %{version}-%{release} %description OCRFeeder is a document layout analysis and OCR system. Given the images it will automatically outline its contents, distinguish between what's graphics and text and perform OCR over the latter. It generates multiple formats being its main one ODT. It features a complete GTK graphical user interface that allows the users to correct any unrecognized characters, defined or correct bounding boxes, set paragraph styles, clean the input images, import PDFs, save and load the project, export everything to multiple formats, etc. %prep %if ! 0%{?git} %setup -q -n "%{name}-release_%{version}" %else %setup -q -n "%{name}-%{commit0}" %endif %if 0%{?git} %endif %patch100 -p1 %build ./autogen.sh %configure --enable-maintainer-mode %{make_build} %install %make_install # fix shebang for f in "%{buildroot}%{_bindir}/%{name}"*; do sed -i -re 's|^(#!/usr/bin/env python)$|\12|' "${f}" done # install icons icon_in="resources/icons/%{app_id}.svg" icon_out="%{app_id}.png" for s in {16,22,24,32,48,64,72,96,128,192,256,512}; do [[ ! -f "%{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/${icon_out}" ]] || continue rsvg-convert "${icon_in}" -w "${s}" -h "${s}" -a -f png -o "${icon_out}" %{__install} -p -D -m 0644 "${icon_out}" "%{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/%{app_id}.png" done if [[ ! -f "%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{app_id}.svg" ]]; then %{__install} -p -D -m 0644 "${icon_in}" "%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{app_id}.svg" fi # fix appdata dir %if "%{dir_metainfo}" != "metainfo" [[ -d "%{buildroot}%{_metainfodir}" || ! -d "%{buildroot}%{_datadir}/metainfo" ]] || %{__mv} "%{buildroot}%{_datadir}/metainfo" "%{buildroot}%{_metainfodir}" %endif %find_lang "%{name}" --with-gnome %check /usr/bin/desktop-file-validate "%{buildroot}/%{_datadir}/applications/%{app_id}.desktop" /usr/bin/appstream-util validate-relax --nonet "%{buildroot}%{_metainfodir}/%{app_id}.appdata.xml" %post /bin/touch --no-create "%{_datadir}/icons/hicolor" &> /dev/null || : /usr/bin/update-desktop-database &> /dev/null || : %postun /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 /usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &> /dev/null || : %files -f "%{name}.lang" %doc AUTHORS NEWS README TRANSLATORS %license COPYING %{_bindir}/%{name} %{_bindir}/%{name}-cli %{_datadir}/%{name}/ %{_datadir}/applications/%{app_id}.desktop %{_datadir}/icons/hicolor/*/*/%{app_id}.* %{_mandir}/man1/%{name}* %{_metainfodir}/%{app_id}.appdata.xml %{python3_sitelib}/%{name}/ %changelog * Thu May 14 2020 Moritz Barsnick 0.8.3-0.20200418gitbb5c47a - update to 0.8.3 plus latest git commits - remove upstreamed patches - always apply the package-specific patches - requires python3 >= 3.5, so drop the python vs. python2 name magic - add BR: python3-odf * Sun Feb 09 2020 Tomasz Tomasik 0.8.1-4.20200107git1160f3d - Fix PDF import * Thu Jan 23 2020 Tomasz Tomasik 0.8.1-3.20200107git1160f3d - Update to the latest Python2-based version with built-in odfpy * Tue Feb 05 2019 Tomasz Tomasik 0.8.1-2.20181218git51483c4 - Update patches https://gitlab.gnome.org/GNOME/ocrfeeder/merge_requests/1 * Wed Jan 23 2019 Tomasz Tomasik 0.8.1-1.20181218git51483c4 - Update to the latest version * Wed Jan 23 2019 Tomasz Tomasik 0.8.1-1 - Initial packaging