2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, autoreconfHook, autoconf-archive, pkg-config
|
2024-06-05 15:53:02 +00:00
|
|
|
, leptonica, libpng, libtiff, icu, pango, opencl-headers }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "tesseract";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "4.1.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tesseract-ocr";
|
|
|
|
repo = "tesseract";
|
|
|
|
rev = version;
|
2023-02-16 17:41:37 +00:00
|
|
|
hash = "sha256-sV3w53ky13ESc0dGPutMGQ4TcmOeWJkvUwBPIyzSTc8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
# leptonica 1.83 made internal structures private. using internal headers isn't
|
|
|
|
# great, but tesseract4's days are numbered anyway
|
|
|
|
postPatch = ''
|
|
|
|
sed -i '/allheaders.h/a#include "pix_internal.h"' src/textord/devanagari_processing.cpp
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
# gcc-13 compat fix, simulate this upstream patch:
|
|
|
|
# https://github.com/tesseract-ocr/tesseract/commit/17e795aaae7d40dbcb7d3365835c2f55ecc6355d.patch
|
|
|
|
# https://github.com/tesseract-ocr/tesseract/commit/c0db7b7e930322826e09981360e39fdbd16cc9b0.patch
|
|
|
|
|
|
|
|
sed -i src/ccutil/helpers.h -e '1i #include <climits>'
|
|
|
|
sed -i src/ccutil/helpers.h -e '1i #include <cstdint>'
|
|
|
|
sed -i src/dict/matchdefs.h -e '1i #include <cstdint>'
|
2023-02-16 17:41:37 +00:00
|
|
|
'';
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
autoreconfHook
|
|
|
|
autoconf-archive
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
leptonica
|
|
|
|
libpng
|
|
|
|
libtiff
|
|
|
|
icu
|
|
|
|
pango
|
|
|
|
opencl-headers
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "OCR engine";
|
|
|
|
homepage = "https://github.com/tesseract-ocr/tesseract";
|
2021-01-17 00:15:33 +00:00
|
|
|
license = lib.licenses.asl20;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with lib.maintainers; [ viric erikarvstedt ];
|
2021-01-17 00:15:33 +00:00
|
|
|
platforms = with lib.platforms; linux ++ darwin;
|
2024-02-29 20:09:43 +00:00
|
|
|
mainProgram = "tesseract";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|