forked from mirrors/nixpkgs
6f7ab306ef
https://sourceforge.net/p/gscan2pdf/mailman/message/37313105/ https://sourceforge.net/p/gscan2pdf/mailman/message/37353051/
134 lines
3.5 KiB
Nix
134 lines
3.5 KiB
Nix
{ lib, fetchurl, perlPackages, wrapGAppsHook,
|
|
# libs
|
|
librsvg, sane-backends, sane-frontends,
|
|
# runtime dependencies
|
|
imagemagick, libtiff, djvulibre, poppler_utils, ghostscript, unpaper, pdftk,
|
|
# test dependencies
|
|
xvfb-run, liberation_ttf, file, tesseract }:
|
|
|
|
with lib;
|
|
|
|
perlPackages.buildPerlPackage rec {
|
|
pname = "gscan2pdf";
|
|
version = "2.12.3";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://sourceforge/gscan2pdf/${version}/${pname}-${version}.tar.xz";
|
|
sha256 = "tdXTcoI7DnrBsXtXR0r07hz0lDcAjZJad+o4wwxHcOk=";
|
|
};
|
|
|
|
nativeBuildInputs = [ wrapGAppsHook ];
|
|
|
|
buildInputs =
|
|
[ librsvg sane-backends sane-frontends ] ++
|
|
(with perlPackages; [
|
|
Gtk3
|
|
Gtk3ImageView
|
|
Gtk3SimpleList
|
|
Cairo
|
|
CairoGObject
|
|
Glib
|
|
GlibObjectIntrospection
|
|
GooCanvas2
|
|
GraphicsTIFF
|
|
IPCSystemSimple
|
|
LocaleCodes
|
|
LocaleGettext
|
|
PDFBuilder
|
|
ImagePNGLibpng
|
|
ImageSane
|
|
SetIntSpan
|
|
ImageMagick
|
|
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" \
|
|
--prefix PATH : "${sane-backends}/bin" \
|
|
--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
|
|
|
|
xvfb-run
|
|
file
|
|
tesseract # tests are expecting tesseract 3.x precisely
|
|
] ++ (with perlPackages; [
|
|
TestPod
|
|
]);
|
|
|
|
checkPhase = ''
|
|
# 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
|
|
# t/1604_import_multipage_DjVu.t ................ Dubious, test returned 255 (wstat 65280, 0xff00)
|
|
rm t/1604_import_multipage_DjVu.t
|
|
|
|
# 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
|
|
|
|
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 ];
|
|
};
|
|
}
|