mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
ocrmypdf: prefer patch + substituteAll
This commit is contained in:
parent
24c14a8fc9
commit
6b1937818e
@ -10,6 +10,7 @@
|
||||
, stdenv
|
||||
, tesseract4
|
||||
, unpaper
|
||||
, substituteAll
|
||||
}:
|
||||
|
||||
let
|
||||
@ -68,11 +69,12 @@ in buildPythonApplication rec {
|
||||
setuptools
|
||||
] ++ runtimeDeps;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/ocrmypdf/leptonica.py \
|
||||
--replace '_libpath = find_library(libname)' \
|
||||
'_libpath = "${stdenv.lib.getLib leptonica}/lib/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;
|
||||
|
13
pkgs/tools/text/ocrmypdf/liblept.patch
Normal file
13
pkgs/tools/text/ocrmypdf/liblept.patch
Normal file
@ -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(
|
||||
"""
|
Loading…
Reference in New Issue
Block a user