2021-02-05 17:12:51 +00:00
|
|
|
{ lib, fetchurl, perlPackages, wrapGAppsHook,
|
2020-04-24 23:36:52 +00:00
|
|
|
# libs
|
|
|
|
librsvg, sane-backends, sane-frontends,
|
|
|
|
# runtime dependencies
|
|
|
|
imagemagick, libtiff, djvulibre, poppler_utils, ghostscript, unpaper, pdftk,
|
|
|
|
# test dependencies
|
2021-05-20 23:08:51 +00:00
|
|
|
xvfb-run, liberation_ttf, file, tesseract }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-17 00:15:33 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
perlPackages.buildPerlPackage rec {
|
|
|
|
pname = "gscan2pdf";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "2.12.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/gscan2pdf/${version}/${pname}-${version}.tar.xz";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-UrBt0QkSk7IP4mZYFoxFNJQ1Qmcb53CemvlYfsxjZ/s=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ wrapGAppsHook ];
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[ librsvg sane-backends sane-frontends ] ++
|
|
|
|
(with perlPackages; [
|
|
|
|
Gtk3
|
2021-02-22 21:28:39 +00:00
|
|
|
Gtk3ImageView
|
2020-04-24 23:36:52 +00:00
|
|
|
Gtk3SimpleList
|
|
|
|
Cairo
|
|
|
|
CairoGObject
|
|
|
|
Glib
|
|
|
|
GlibObjectIntrospection
|
|
|
|
GooCanvas2
|
2021-02-22 21:28:39 +00:00
|
|
|
GraphicsTIFF
|
|
|
|
IPCSystemSimple
|
2020-10-07 09:15:18 +00:00
|
|
|
LocaleCodes
|
2020-04-24 23:36:52 +00:00
|
|
|
LocaleGettext
|
2021-02-22 21:28:39 +00:00
|
|
|
PDFBuilder
|
|
|
|
ImagePNGLibpng
|
2020-04-24 23:36:52 +00:00
|
|
|
ImageSane
|
|
|
|
SetIntSpan
|
2021-08-05 21:33:18 +00:00
|
|
|
ImageMagick
|
2020-04-24 23:36:52 +00:00
|
|
|
ConfigGeneral
|
|
|
|
ListMoreUtils
|
|
|
|
HTMLParser
|
|
|
|
ProcProcessTable
|
|
|
|
LogLog4perl
|
|
|
|
TryTiny
|
|
|
|
DataUUID
|
|
|
|
DateCalc
|
|
|
|
IOString
|
|
|
|
FilesysDf
|
|
|
|
SubOverride
|
|
|
|
]);
|
|
|
|
|
|
|
|
postPatch = let
|
|
|
|
fontSubstitute = "${liberation_ttf}/share/fonts/truetype/LiberationSans-Regular.ttf";
|
|
|
|
in ''
|
|
|
|
# Required for the program to properly load its SVG assets
|
|
|
|
substituteInPlace bin/gscan2pdf \
|
|
|
|
--replace "/usr/share" "$out/share"
|
|
|
|
|
|
|
|
# Substitute the non-free Helvetica font in the tests
|
|
|
|
sed -i 's|-pointsize|-font ${fontSubstitute} -pointsize|g' t/*.t
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# Remove impurity
|
|
|
|
find $out -type f -name "*.pod" -delete
|
|
|
|
|
|
|
|
# Add runtime dependencies
|
|
|
|
wrapProgram "$out/bin/gscan2pdf" \
|
2020-07-18 16:06:22 +00:00
|
|
|
--prefix PATH : "${sane-backends}/bin" \
|
2020-04-24 23:36:52 +00:00
|
|
|
--prefix PATH : "${imagemagick}/bin" \
|
|
|
|
--prefix PATH : "${libtiff}/bin" \
|
|
|
|
--prefix PATH : "${djvulibre}/bin" \
|
|
|
|
--prefix PATH : "${poppler_utils}/bin" \
|
|
|
|
--prefix PATH : "${ghostscript}/bin" \
|
|
|
|
--prefix PATH : "${unpaper}/bin" \
|
|
|
|
--prefix PATH : "${pdftk}/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installTargets = [ "install" ];
|
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
imagemagick
|
|
|
|
libtiff
|
|
|
|
djvulibre
|
|
|
|
poppler_utils
|
|
|
|
ghostscript
|
|
|
|
unpaper
|
|
|
|
pdftk
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
xvfb-run
|
2020-04-24 23:36:52 +00:00
|
|
|
file
|
|
|
|
tesseract # tests are expecting tesseract 3.x precisely
|
2021-02-22 21:28:39 +00:00
|
|
|
] ++ (with perlPackages; [
|
|
|
|
TestPod
|
|
|
|
]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
2021-02-22 21:28:39 +00:00
|
|
|
# Temporarily disable a dubiously failing test:
|
|
|
|
# t/169_import_scan.t ........................... 1/1
|
|
|
|
# # Failed test 'variable-height scan imported with expected size'
|
|
|
|
# # at t/169_import_scan.t line 50.
|
|
|
|
# # got: '179'
|
|
|
|
# # expected: '296'
|
|
|
|
# # Looks like you failed 1 test of 1.
|
|
|
|
# t/169_import_scan.t ........................... Dubious, test returned 1 (wstat 256, 0x100)
|
|
|
|
rm t/169_import_scan.t
|
2021-10-06 13:57:05 +00:00
|
|
|
# t/1604_import_multipage_DjVu.t ................ Dubious, test returned 255 (wstat 65280, 0xff00)
|
|
|
|
rm t/1604_import_multipage_DjVu.t
|
2021-02-22 21:28:39 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# Disable a test which passes but reports an incorrect status
|
|
|
|
# t/0601_Dialog_Scan.t .......................... All 14 subtests passed
|
|
|
|
# t/0601_Dialog_Scan.t (Wstat: 139 Tests: 14 Failed: 0)
|
|
|
|
# Non-zero wait status: 139
|
|
|
|
rm t/0601_Dialog_Scan.t
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
xvfb-run -s '-screen 0 800x600x24' \
|
|
|
|
make test
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A GUI to produce PDFs or DjVus from scanned documents";
|
|
|
|
homepage = "http://gscan2pdf.sourceforge.net/";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ pacien ];
|
|
|
|
};
|
|
|
|
}
|