diff --git a/pkgs/applications/graphics/tesseract/tesseract3.nix b/pkgs/applications/graphics/tesseract/tesseract3.nix index 16365674706e..bf19d0f77eb6 100644 --- a/pkgs/applications/graphics/tesseract/tesseract3.nix +++ b/pkgs/applications/graphics/tesseract/tesseract3.nix @@ -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 = [ diff --git a/pkgs/applications/graphics/tesseract/tesseract4.nix b/pkgs/applications/graphics/tesseract/tesseract4.nix index 36c4c694a16a..aecdf58186d0 100644 --- a/pkgs/applications/graphics/tesseract/tesseract4.nix +++ b/pkgs/applications/graphics/tesseract/tesseract4.nix @@ -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; diff --git a/pkgs/applications/misc/qt-box-editor/default.nix b/pkgs/applications/misc/qt-box-editor/default.nix index 9480a32aae3d..7987208b885a 100644 --- a/pkgs/applications/misc/qt-box-editor/default.nix +++ b/pkgs/applications/misc/qt-box-editor/default.nix @@ -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 ' src/TessTools.h + + substituteInPlace qt-box-editor.pro \ + --replace '-llept' '-lleptonica' ''; meta = with lib; { diff --git a/pkgs/applications/video/ccextractor/default.nix b/pkgs/applications/video/ccextractor/default.nix index 26954375aff5..3d6238463470 100644 --- a/pkgs/applications/video/ccextractor/default.nix +++ b/pkgs/applications/video/ccextractor/default.nix @@ -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 ' src/lib_ccx/ocr.c + '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/CMakeLists.txt \ --replace 'add_definitions(-DGPAC_CONFIG_LINUX)' 'add_definitions(-DGPAC_CONFIG_DARWIN)' ''; diff --git a/pkgs/development/libraries/jbig2enc/default.nix b/pkgs/development/libraries/jbig2enc/default.nix new file mode 100644 index 000000000000..26b21aa7c957 --- /dev/null +++ b/pkgs/development/libraries/jbig2enc/default.nix @@ -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"; + }; +} diff --git a/pkgs/development/libraries/leptonica/default.nix b/pkgs/development/libraries/leptonica/default.nix index 448a22f54997..fd020603b523 100644 --- a/pkgs/development/libraries/leptonica/default.nix +++ b/pkgs/development/libraries/leptonica/default.nix @@ -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 ]; diff --git a/pkgs/development/python-modules/tesserocr/default.nix b/pkgs/development/python-modules/tesserocr/default.nix index 73b5a5727a38..9e3e1560c208 100644 --- a/pkgs/development/python-modules/tesserocr/default.nix +++ b/pkgs/development/python-modules/tesserocr/default.nix @@ -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 diff --git a/pkgs/tools/cd-dvd/vobsub2srt/default.nix b/pkgs/tools/cd-dvd/vobsub2srt/default.nix index 2d764d2f7da0..612f4ebf04d8 100644 --- a/pkgs/tools/cd-dvd/vobsub2srt/default.nix +++ b/pkgs/tools/cd-dvd/vobsub2srt/default.nix @@ -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 ]; diff --git a/pkgs/tools/graphics/jbig2enc/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch b/pkgs/tools/graphics/jbig2enc/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch deleted file mode 100644 index 13e18fd04476..000000000000 --- a/pkgs/tools/graphics/jbig2enc/53ce5fe7e73d7ed95c9e12b52dd4984723f865fa.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 53ce5fe7e73d7ed95c9e12b52dd4984723f865fa Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= -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); diff --git a/pkgs/tools/graphics/jbig2enc/default.nix b/pkgs/tools/graphics/jbig2enc/default.nix deleted file mode 100644 index ea5008dcf5cb..000000000000 --- a/pkgs/tools/graphics/jbig2enc/default.nix +++ /dev/null @@ -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; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 49528704efeb..1c61ee6febd6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };