From 899ee6ec3d77d505405012ec588e8ecc1cec1a01 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 16 Jan 2025 20:46:36 +0100 Subject: [PATCH 1/2] k2pdfopt: disable tesseract --- pkgs/by-name/k2/k2pdfopt/package.nix | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/k2/k2pdfopt/package.nix b/pkgs/by-name/k2/k2pdfopt/package.nix index a7da6638c61b..8f1e5b64e9bd 100644 --- a/pkgs/by-name/k2/k2pdfopt/package.nix +++ b/pkgs/by-name/k2/k2pdfopt/package.nix @@ -21,12 +21,15 @@ mupdf, enableDJVU ? true, djvulibre, - enableGOCR ? false, - gocr, # Disabled by default due to crashes - enableTesseract ? true, + enableGOCR ? false, # Disabled by default due to crashes + gocr, + # Tesseract support is currently broken + # See: https://github.com/NixOS/nixpkgs/issues/368349 + enableTesseract ? false, leptonica, tesseract5, opencl-headers, + fetchDebianPatch, }: # k2pdfopt is a pain to package. It requires modified versions of mupdf, @@ -88,6 +91,20 @@ stdenv.mkDerivation rec { patches = [ ./0001-Fix-CMakeLists.patch + (fetchDebianPatch { + inherit pname; + version = "${version}+ds"; + debianRevision = "3.1"; + patch = "0007-k2pdfoptlib-k2ocr.c-conditionally-enable-tesseract-r.patch"; + hash = "sha256-uJ9Gpyq64n/HKqo0hkQ2dnkSLCKNN4DedItPGzHfqR8="; + }) + (fetchDebianPatch { + inherit pname; + version = "${version}+ds"; + debianRevision = "3.1"; + patch = "0009-willuslib-CMakeLists.txt-conditionally-add-source-fi.patch"; + hash = "sha256-cBSlcuhsw4YgAJtBJkKLW6u8tK5gFwWw7pZEJzVMJDE="; + }) ]; postPatch = '' From 3ecfcd5d988aab4f17418df66c34a50d885fdd11 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 16 Jan 2025 20:49:55 +0100 Subject: [PATCH 2/2] k2pdfopt: reenable leptonica Co-authored-by: Martin Schwaighofer --- pkgs/by-name/k2/k2pdfopt/package.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/k2/k2pdfopt/package.nix b/pkgs/by-name/k2/k2pdfopt/package.nix index 8f1e5b64e9bd..110cc469c0a9 100644 --- a/pkgs/by-name/k2/k2pdfopt/package.nix +++ b/pkgs/by-name/k2/k2pdfopt/package.nix @@ -26,8 +26,9 @@ # Tesseract support is currently broken # See: https://github.com/NixOS/nixpkgs/issues/368349 enableTesseract ? false, - leptonica, tesseract5, + enableLeptonica ? true, + leptonica, opencl-headers, fetchDebianPatch, }: @@ -256,10 +257,8 @@ stdenv.mkDerivation rec { ++ lib.optional enableMuPDF mupdf_modded ++ lib.optional enableDJVU djvulibre ++ lib.optional enableGOCR gocr - ++ lib.optionals enableTesseract [ - leptonica_modded - tesseract_modded - ]; + ++ lib.optional enableTesseract tesseract_modded + ++ lib.optional (enableLeptonica || enableTesseract) leptonica_modded; dontUseCmakeBuildDir = true;