Merge pull request #210409 from r-ryantm/auto-update/leptonica

leptonica: 1.82.0 -> 1.83.0
This commit is contained in:
Robert Scott 2023-02-12 19:04:25 +00:00 committed by GitHub
commit ba40f8ea1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 100 additions and 108 deletions

View File

@ -3,15 +3,23 @@
stdenv.mkDerivation rec {
pname = "tesseract";
version = "3.05.00";
version = "3.05.02";
src = fetchFromGitHub {
owner = "tesseract-ocr";
repo = "tesseract";
rev = version;
hash = "sha256-YHj00gG/3SW0ILTiQwphiCxuP9OCDya27hyFQB27mYc=";
hash = "sha256-28osuZnVwkJpNTYkU+5D5PI8xtViFzGCMScHzkS2H20=";
};
# 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
'';
enableParallelBuilding = true;
nativeBuildInputs = [

View File

@ -3,26 +3,20 @@
stdenv.mkDerivation rec {
pname = "tesseract";
version = "4.1.1";
version = "4.1.3";
src = fetchFromGitHub {
owner = "tesseract-ocr";
repo = "tesseract";
rev = version;
hash = "sha256-lu/Y5mlCI8AajhiWaID0fGo5PghEQZdgt2X0K9c/QrE=";
hash = "sha256-sV3w53ky13ESc0dGPutMGQ4TcmOeWJkvUwBPIyzSTc8=";
};
patches = [
# https://github.com/tesseract-ocr/tesseract/issues/3447
(fetchpatch {
url = "https://github.com/tesseract-ocr/tesseract/commit/dbc79b09d195490dfa3f7d338eadac07ad6683f7.patch";
sha256 = "sha256-lGlg0etuU4RXfdq1QH2bYObdeGrFHKf9O8zMUAbfNIQ=";
})
(fetchpatch {
url = "https://github.com/tesseract-ocr/tesseract/commit/6dc4b184b1ebf2e68461f6b63f63a033bc7245f7.patch";
sha256 = "sha256-DwIX3r5NmeajI6WgIVHDbkhLH/ygJIjPO5XrbzWQhSw=";
})
];
# 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
'';
enableParallelBuilding = true;

View File

@ -10,23 +10,25 @@
mkDerivation {
pname = "qt-box-editor";
version = "unstable-2019-07-12";
version = "unstable-2019-07-14";
src = fetchFromGitHub {
owner = "zdenop";
repo = "qt-box-editor";
rev = "75a68b466868ba41ba2886caa796057403fe1901";
sha256 = "0zwsyy7cnbhy5aazwlkhd9y8bnzlgy1gffqa46abajn4809b95k3";
rev = "cba2929dabc6c715acd1a282ba161fee914c87f6";
hash = "sha256-3dWnAu0CLO3atjbC1zJEnL3vzsIEecDDDhW3INMfCv4=";
};
buildInputs = [ qtbase qtsvg leptonica tesseract ];
nativeBuildInputs = [ qmake ];
# remove with next release
# https://github.com/zdenop/qt-box-editor/pull/78
# https://github.com/zdenop/qt-box-editor/issues/87
postPatch = ''
printf "INSTALLS += target\ntarget.path = $out/bin" >> qt-box-editor.pro
sed -i '/allheaders.h/a#include <leptonica/pix_internal.h>' src/TessTools.h
substituteInPlace qt-box-editor.pro \
--replace '-llept' '-lleptonica'
'';
meta = with lib; {

View File

@ -23,7 +23,10 @@ stdenv.mkDerivation rec {
sha256 = "sha256-usVAKBkdd8uz9cD5eLd0hnwGonOJLscRdc+iWDlNXVc=";
};
postPatch = lib.optionalString stdenv.isDarwin ''
postPatch = ''
# https://github.com/CCExtractor/ccextractor/issues/1467
sed -i '/allheaders.h/a#include <leptonica/pix_internal.h>' src/lib_ccx/ocr.c
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace src/CMakeLists.txt \
--replace 'add_definitions(-DGPAC_CONFIG_LINUX)' 'add_definitions(-DGPAC_CONFIG_DARWIN)'
'';

View File

@ -0,0 +1,60 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, leptonica
, zlib
, libwebp
, giflib
, libjpeg
, libpng
, libtiff
, autoreconfHook
}:
stdenv.mkDerivation rec {
pname = "jbig2enc";
version = "0.29";
src = fetchFromGitHub {
owner = "agl";
repo = "jbig2enc";
rev = version;
hash = "sha256-IAL4egXgaGmCilzcryjuvOoHhahyrfGWY68GBfXXgAM=";
};
buildInputs = [ autoreconfHook ];
propagatedBuildInputs = [
leptonica
zlib
libwebp
giflib
libjpeg
libpng
libtiff
];
patches = [
(fetchpatch {
name = "fix-build-leptonica-1.83.patch";
url = "https://github.com/agl/jbig2enc/commit/ea050190466f5336c69c6a11baa1cb686677fcab.patch";
hash = "sha256-+kScjFgDEU9F7VOUNAhm2XBjGm49fzAH8hYhmTm8xv8=";
})
];
# This is necessary, because the resulting library has
# /tmp/nix-build-jbig2enc/src/.libs before /nix/store/jbig2enc/lib
# in its rpath, which means that patchelf --shrink-rpath removes
# the /nix/store one. By cleaning up before fixup, we ensure that
# the /tmp/nix-build-jbig2enc/src/.libs directory is gone.
preFixup = ''
make clean
'';
meta = {
description = "Encoder for the JBIG2 image compression format";
license = lib.licenses.asl20;
platforms = lib.platforms.all;
homepage = "https://github.com/agl/jbig2enc";
};
}

View File

@ -4,11 +4,11 @@
stdenv.mkDerivation rec {
pname = "leptonica";
version = "1.82.0";
version = "1.83.0";
src = fetchurl {
url = "http://www.leptonica.org/source/${pname}-${version}.tar.gz";
sha256 = "sha256-FVMC7pFGaMJ7b+PKn/LaY7JF9tYvMGHI8nVjd0uK4tY=";
sha256 = "sha256-IGWR3VjPhO84CDba0TO1jJ0a+SSR9amCXDRqFiBEvP4=";
};
nativeBuildInputs = [ autoreconfHook pkg-config ];

View File

@ -24,6 +24,11 @@ buildPythonPackage rec {
sha256 = "1bmj76gi8401lcqdaaznfmz9yf11myy1bzivqwwq08z3dwzxswck";
};
# https://github.com/sirfz/tesserocr/issues/314
postPatch = ''
sed -i '/allheaders.h/a\ pass\n\ncdef extern from "leptonica/pix_internal.h" nogil:' tesseract.pxd
'';
nativeBuildInputs = [
cython
pkg-config

View File

@ -11,6 +11,8 @@ stdenv.mkDerivation rec {
sha256 = "sha256-i6V2Owb8GcTcWowgb/BmdupOSFsYiCF2SbC9hXa26uY=";
};
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-std=c++11" ];
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ libtiff ];
propagatedBuildInputs = [ tesseract ];

View File

@ -1,47 +0,0 @@
From 53ce5fe7e73d7ed95c9e12b52dd4984723f865fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= <zdenop@gmail.com>
Date: Sun, 6 Apr 2014 21:25:27 +0200
Subject: [PATCH] fix build with leptonica 1.70
---
configure.ac | 1 +
src/jbig2.cc | 13 +++++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index fe37c22..753a607 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,7 @@ AC_CHECK_LIB([lept], [findFileFormatStream], [], [
echo "Error! Leptonica not detected."
exit -1
])
+AC_CHECK_FUNCS(expandBinaryPower2Low,,)
# test for function - it should detect leptonica dependecies
# Check for possible dependancies of leptonica.
diff --git a/src/jbig2.cc b/src/jbig2.cc
index e10f042..515c1ef 100644
--- a/src/jbig2.cc
+++ b/src/jbig2.cc
@@ -130,11 +130,16 @@ segment_image(PIX *pixb, PIX *piximg) {
// input color image, so we have to do it this way...
// is there a better way?
// PIX *pixd = pixExpandBinary(pixd4, 4);
- PIX *pixd = pixCreate(piximg->w, piximg->h, 1);
- pixCopyResolution(pixd, piximg);
- if (verbose) pixInfo(pixd, "mask image: ");
- expandBinaryPower2Low(pixd->data, pixd->w, pixd->h, pixd->wpl,
+ PIX *pixd;
+#ifdef HAVE_EXPANDBINARYPOWER2LOW
+ pixd = pixCreate(piximg->w, piximg->h, 1);
+ pixCopyResolution(pixd, piximg);
+ expandBinaryPower2Low(pixd->data, pixd->w, pixd->h, pixd->wpl,
pixd4->data, pixd4->w, pixd4->h, pixd4->wpl, 4);
+#else
+ pixd = pixExpandBinaryPower2(pixd4, 4);
+#endif
+ if (verbose) pixInfo(pixd, "mask image: ");
pixDestroy(&pixd4);
pixDestroy(&pixsf4);

View File

@ -1,35 +0,0 @@
{ lib, stdenv, fetchFromGitHub, leptonica, zlib, libwebp, giflib, libjpeg, libpng, libtiff }:
stdenv.mkDerivation rec {
pname = "jbig2enc";
version = "0.28";
src = fetchFromGitHub {
owner = "agl";
repo = "jbig2enc";
rev = "${version}-dist";
hash = "sha256-Y3IVTjvO5tqn/O076y/llnTyenKpbx1WyT/JFZ/s0VY=";
};
propagatedBuildInputs = [ leptonica zlib libwebp giflib libjpeg libpng libtiff ];
patches = [
# https://github.com/agl/jbig2enc/commit/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa
./53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch
];
# This is necessary, because the resulting library has
# /tmp/nix-build-jbig2enc/src/.libs before /nix/store/jbig2enc/lib
# in its rpath, which means that patchelf --shrink-rpath removes
# the /nix/store one. By cleaning up before fixup, we ensure that
# the /tmp/nix-build-jbig2enc/src/.libs directory is gone.
preFixup = ''
make clean
'';
meta = {
description = "Encoder for the JBIG2 image compression format";
license = lib.licenses.asl20;
platforms = lib.platforms.all;
};
}

View File

@ -10794,8 +10794,6 @@ with pkgs;
pdf-quench = callPackage ../applications/misc/pdf-quench { };
jbig2enc = callPackage ../tools/graphics/jbig2enc { };
pdfarranger = callPackage ../applications/misc/pdfarranger { };
briss = callPackage ../tools/graphics/briss { };
@ -20525,6 +20523,8 @@ with pkgs;
jbig2dec = callPackage ../development/libraries/jbig2dec { };
jbig2enc = callPackage ../development/libraries/jbig2enc { };
jcal = callPackage ../development/libraries/jcal { };
jbigkit = callPackage ../development/libraries/jbigkit { };