@@ -0,0 +1,73 @@
1+{ stdenv
2+, fetchurl
3+, pkg-config
4+, gtk3
5+, gtkspell3
6+, isocodes
7+, goocanvas2
8+, intltool
9+, itstool
10+, libxml2
11+, gnome3
12+, python3
13+, gobject-introspection
14+, wrapGAppsHook
15+, tesseract4
16+, extraOcrEngines ? [] # other supported engines are: ocrad gocr cuneiform
17+}:
18+
19+stdenv.mkDerivation rec {
20+ pname = "ocrfeeder";
21+ version = "0.8.3";
22+
23+ src = fetchurl {
24+ url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
25+ sha256 = "12f5gnq92ffnd5zaj04df7jrnsdz1zn4zcgpbf5p9qnd21i2y529";
26+ };
27+
28+ nativeBuildInputs = [
29+ pkg-config
30+ wrapGAppsHook
31+ intltool
32+ itstool
33+ libxml2
34+ ];
35+
36+ buildInputs = [
37+ gtk3
38+ gobject-introspection
39+ goocanvas2
40+ gtkspell3
41+ isocodes
42+ (python3.withPackages(ps: with ps; [
43+ pyenchant
44+ sane
45+ pillow
46+ reportlab
47+ odfpy
48+ pygobject3
49+ ]))
50+ ];
51+
52+ # https://gitlab.gnome.org/GNOME/ocrfeeder/-/issues/22
53+ postConfigure = ''
54+ substituteInPlace src/ocrfeeder/util/constants.py \
55+ --replace /usr/share/xml/iso-codes ${isocodes}/share/xml/iso-codes
56+ '';
57+
58+ enginesPath = stdenv.lib.makeBinPath ([
59+ tesseract4
60+ ] ++ extraOcrEngines);
61+
62+ preFixup = ''
63+ gappsWrapperArgs+=(--prefix PATH : "${enginesPath}")
64+ '';
65+
66+ meta = with stdenv.lib; {
67+ homepage = "https://wiki.gnome.org/Apps/OCRFeeder";
68+ description = "Complete Optical Character Recognition and Document Analysis and Recognition program";
69+ maintainers = with maintainers; [ doronbehar ];
70+ license = licenses.gpl3Plus;
71+ platforms = platforms.linux;
72+ };
73+}