1 { lib, fetchurl, perlPackages, wrapGAppsHook3,
3 librsvg, sane-backends, sane-frontends,
5 imagemagick, libtiff, djvulibre, poppler_utils, ghostscript, unpaper, pdftk,
7 xvfb-run, liberation_ttf, file, tesseract }:
9 perlPackages.buildPerlPackage rec {
14 url = "mirror://sourceforge/gscan2pdf/gscan2pdf-${version}.tar.xz";
15 hash = "sha256-QAs6fsQDe9+nKM/OAVZUHB034K72jHsKoA2LY2JQa8Y=";
19 # fixes an error with utf8 file names. See https://sourceforge.net/p/gscan2pdf/bugs/400
20 ./image-utf8-fix.patch
23 nativeBuildInputs = [ wrapGAppsHook3 ];
26 [ librsvg sane-backends sane-frontends ] ++
34 GlibObjectIntrospection
59 fontSubstitute = "${liberation_ttf}/share/fonts/truetype/LiberationSans-Regular.ttf";
61 # Required for the program to properly load its SVG assets
62 substituteInPlace bin/gscan2pdf \
63 --replace "/usr/share" "$out/share"
65 # Substitute the non-free Helvetica font in the tests
66 sed -i 's|-pointsize|-font ${fontSubstitute} -pointsize|g' t/*.t
71 find $out -type f -name "*.pod" -delete
73 # Add runtime dependencies
74 wrapProgram "$out/bin/gscan2pdf" \
75 --prefix PATH : "${sane-backends}/bin" \
76 --prefix PATH : "${imagemagick}/bin" \
77 --prefix PATH : "${libtiff}/bin" \
78 --prefix PATH : "${djvulibre}/bin" \
79 --prefix PATH : "${poppler_utils}/bin" \
80 --prefix PATH : "${ghostscript}/bin" \
81 --prefix PATH : "${unpaper}/bin" \
82 --prefix PATH : "${pdftk}/bin"
85 enableParallelBuilding = true;
87 installTargets = [ "install" ];
89 outputs = [ "out" "man" ];
102 tesseract # tests are expecting tesseract 3.x precisely
103 ] ++ (with perlPackages; [
108 # Temporarily disable a dubiously failing test:
109 # t/169_import_scan.t ........................... 1/1
110 # # Failed test 'variable-height scan imported with expected size'
111 # # at t/169_import_scan.t line 50.
114 # # Looks like you failed 1 test of 1.
115 # t/169_import_scan.t ........................... Dubious, test returned 1 (wstat 256, 0x100)
116 rm t/169_import_scan.t
118 # Disable a test failing because of a warning interfering with the pinned output
119 # t/3722_user_defined.t ......................... 1/2
120 # Failed test 'user_defined caught error injected in queue'
121 # at t/3722_user_defined.t line 41.
123 # WARNING: The convert command is deprecated in IMv7, use "magick" instead of "convert" or "magick convert"'
125 # Looks like you failed 1 test of 2.
126 rm t/3722_user_defined.t
128 export XDG_CACHE_HOME="$(mktemp -d)"
129 xvfb-run -s '-screen 0 800x600x24' \
134 description = "GUI to produce PDFs or DjVus from scanned documents";
135 homepage = "https://gscan2pdf.sourceforge.net/";
136 license = licenses.gpl3;
137 maintainers = with maintainers; [ pacien ];
138 mainProgram = "gscan2pdf";