summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-01-22 16:03:29 +0100
committerGitHub <noreply@github.com>2020-01-22 16:03:29 +0100
commita61db03041a7a61cc27301b3d84982fe59abf995 (patch)
treedd595ad9991b3f1da9f70047cf06881617700aa0 /pkgs/tools
parentbe25ee9d21be6d901f6a5cd64809b895b71b905c (diff)
parent61381b2f883c8b85919c41618d4e1aa6d829fe54 (diff)
downloadnixpkgs-a61db03041a7a61cc27301b3d84982fe59abf995.tar
nixpkgs-a61db03041a7a61cc27301b3d84982fe59abf995.tar.gz
nixpkgs-a61db03041a7a61cc27301b3d84982fe59abf995.tar.bz2
nixpkgs-a61db03041a7a61cc27301b3d84982fe59abf995.tar.lz
nixpkgs-a61db03041a7a61cc27301b3d84982fe59abf995.tar.xz
nixpkgs-a61db03041a7a61cc27301b3d84982fe59abf995.tar.zst
nixpkgs-a61db03041a7a61cc27301b3d84982fe59abf995.zip
Merge pull request #77494 from dtzWill/update/ocrmypdf-9.4.0
ocrmypdf: 9.2.0 -> 9.5.0
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/text/ocrmypdf/default.nix16
-rw-r--r--pkgs/tools/text/ocrmypdf/liblept.patch13
2 files changed, 22 insertions, 7 deletions
diff --git a/pkgs/tools/text/ocrmypdf/default.nix b/pkgs/tools/text/ocrmypdf/default.nix
index 13353daa171..cdc6878bb5a 100644
--- a/pkgs/tools/text/ocrmypdf/default.nix
+++ b/pkgs/tools/text/ocrmypdf/default.nix
@@ -10,6 +10,7 @@
 , stdenv
 , tesseract4
 , unpaper
+, substituteAll
 }:
 
 let
@@ -28,14 +29,14 @@ let
 
 in buildPythonApplication rec {
   pname = "ocrmypdf";
-  version = "9.2.0";
+  version = "9.5.0";
   disabled = ! python3Packages.isPy3k;
 
   src = fetchFromGitHub {
     owner = "jbarlow83";
     repo = "OCRmyPDF";
     rev = "v${version}";
-    sha256 = "1mvc6x5nn242z65pxv39ch71vaikgi89bb0sjbfy2jbw91vk41xa";
+    sha256 = "0rvwxykyscpcvfgm8zzyvjgzl9x9ddi9cxmqyxrc031mxpc0lzyy";
   };
 
   nativeBuildInputs = with python3Packages; [
@@ -68,11 +69,12 @@ in buildPythonApplication rec {
     setuptools
   ] ++ runtimeDeps;
 
-  postPatch = ''
-    substituteInPlace src/ocrmypdf/leptonica.py \
-      --replace "lept = ffi.dlopen(_libpath)" \
-      'lept = ffi.dlopen("${stdenv.lib.makeLibraryPath [leptonica]}/liblept${stdenv.hostPlatform.extensions.sharedLibrary}")'
-  '';
+  patches = [
+    (substituteAll {
+      src = ./liblept.patch;
+      liblept = "${stdenv.lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}";
+    })
+  ];
 
   # The tests take potentially 20+ minutes, depending on machine
   doCheck = false;
diff --git a/pkgs/tools/text/ocrmypdf/liblept.patch b/pkgs/tools/text/ocrmypdf/liblept.patch
new file mode 100644
index 00000000000..ed413a8b37b
--- /dev/null
+++ b/pkgs/tools/text/ocrmypdf/liblept.patch
@@ -0,0 +1,13 @@
+diff --git a/src/ocrmypdf/leptonica.py b/src/ocrmypdf/leptonica.py
+index 328b063..b993cc9 100644
+--- a/src/ocrmypdf/leptonica.py
++++ b/src/ocrmypdf/leptonica.py
+@@ -46,7 +46,7 @@ if os.name == 'nt':
+     os.environ['PATH'] = shim_paths_with_program_files()
+ else:
+     libname = 'lept'
+-_libpath = find_library(libname)
++_libpath = '@liblept@'
+ if not _libpath:
+     raise MissingDependencyError(
+         """