2021-01-19 06:50:56 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config
|
2018-12-18 18:02:13 +00:00
|
|
|
, leptonica, libpng, libtiff, icu, pango, opencl-headers }:
|
2018-12-18 18:02:12 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "tesseract";
|
2023-01-28 16:19:10 +00:00
|
|
|
version = "3.05.02";
|
2018-12-18 18:02:12 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tesseract-ocr";
|
|
|
|
repo = "tesseract";
|
|
|
|
rev = version;
|
2023-01-28 16:19:10 +00:00
|
|
|
hash = "sha256-28osuZnVwkJpNTYkU+5D5PI8xtViFzGCMScHzkS2H20=";
|
2018-12-18 18:02:12 +00:00
|
|
|
};
|
|
|
|
|
2023-01-28 16:19:10 +00:00
|
|
|
# leptonica 1.83 made internal structures private. using internal headers isn't
|
|
|
|
# great, but tesseract3's days are numbered anyway
|
|
|
|
postPatch = ''
|
|
|
|
for f in textord/devanagari_processing.cpp cube/cube_line_object.h cube/cube_line_segmenter.h cube/cube_utils.h ; do
|
|
|
|
sed -i '/allheaders.h/a#include "pix_internal.h"' "$f"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2018-12-18 18:02:12 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-05-02 10:38:50 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
autoreconfHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
leptonica
|
|
|
|
libpng
|
|
|
|
libtiff
|
|
|
|
icu
|
|
|
|
pango
|
|
|
|
opencl-headers
|
|
|
|
];
|
2018-12-18 18:02:12 +00:00
|
|
|
|
|
|
|
LIBLEPT_HEADERSDIR = "${leptonica}/include";
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "OCR engine";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/tesseract-ocr/tesseract";
|
2021-01-15 13:21:58 +00:00
|
|
|
license = lib.licenses.asl20;
|
2022-06-26 17:12:18 +00:00
|
|
|
maintainers = with lib.maintainers; [ viric erikarvstedt ];
|
2021-01-15 13:21:58 +00:00
|
|
|
platforms = with lib.platforms; linux ++ darwin;
|
2024-02-11 02:19:15 +00:00
|
|
|
mainProgram = "tesseract";
|
2018-12-18 18:02:12 +00:00
|
|
|
};
|
|
|
|
}
|