utsushi: 3.57.0 -> 3.59.2

+ building from gitlab source
+ reorderd dependencies to be in logical/alphabetical order
+ replaced patches with substituteInPlace, as patches broke the installChecks
  and substituteInPlace may be more robust than making new patches for each
  release. Also the compiled source is now closer to upstream than
  before.
+ added installChecks
+ added all supported devices as listed on epson.net
This commit is contained in:
wucke13 2019-10-01 00:28:23 +02:00
parent ccc06a7e01
commit 9eb00acbbe
5 changed files with 96 additions and 349 deletions

View File

@ -1,64 +1,62 @@
{ stdenv, fetchurl, autoreconfHook, boost, gtkmm2 { stdenv, fetchFromGitLab, autoreconfHook, pkg-config, boost, gtkmm2
, pkg-config, libtool, udev, libjpeg, file, texlive , imagemagick, sane-backends, tesseract4, udev, libusb}:
, libusb, libtiff, imagemagick, sane-backends, tesseract }:
/*
Alternatively, this package could use the "community source" at
https://gitlab.com/utsushi/utsushi/
Epson provides proprietary plugins for networking, ocr and some more
scanner models. Those are not (yet ?) packaged here.
*/
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "utsushi"; pname = "utsushi";
version = "3.57.0"; version = "3.59.2";
src = fetchurl { src = fetchFromGitLab{
url = "http://support.epson.net/linux/src/scanner/imagescanv3/common/imagescan_${version}.orig.tar.gz"; owner = pname;
sha256 = "0qy6n6nbisbvy0q3idj7hpmj9i85cd0a18klfd8nsqsa2nkg57ny"; repo = "imagescan";
rev = version;
sha256 = "06gp97dfnf43l6kb988scmm66q9n5rc7ndwv3rykrdpyhy8rbi05";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config
autoreconfHook autoreconfHook
libtool pkg-config
]; ];
buildInputs = [ buildInputs = [
boost boost.dev
libusb gtkmm2.dev
libtiff
libjpeg
udev
imagemagick imagemagick
sane-backends sane-backends
gtkmm2 udev.dev
file libusb.dev
tesseract
]; ];
patches = [ NIX_CFLAGS_COMPILE = [
./patches/absolute-path-to-convert.patch "-Wno-error=deprecated-declarations"
./patches/print-errors.patch "-Wno-error=parentheses"
./patches/absolute_path_for_tesseract.patch "-Wno-error=unused-variable"
]; ];
postPatch = '' postPatch = ''
# remove vendored dependencies # remove vendored dependencies
rm -r upstream/boost rm -r upstream/boost
# create fake udev and sane config # create fake udev and sane config
mkdir -p $out/etc/{sane.d,udev/rules.d} mkdir -p $out/etc/{sane.d,udev/rules.d}
touch $out/etc/sane.d/dll.conf touch $out/etc/sane.d/dll.conf
# absolute paths to conver & tesseract
substituteInPlace filters/magick.cpp \
--replace '"convert' '"${imagemagick}/bin/convert'
substituteInPlace filters/reorient.cpp \
--replace '"tesseract' '"${tesseract4}/bin/tesseract'
substituteInPlace filters/get-text-orientation \
--replace '=tesseract' '=${tesseract4}/bin/tesseract'
''; '';
configureFlags = [ configureFlags = [
"--with-boost-libdir=${boost}/lib" "--with-boost-libdir=${boost}/lib"
"--with-sane-confdir=${placeholder "out"}/etc/sane.d" "--with-sane-confdir=${placeholder "out"}/etc/sane.d"
"--with-udev-confdir=${placeholder "out"}/etc/udev" "--with-udev-confdir=${placeholder "out"}/etc/udev"
"--with-sane"
"--with-gtkmm" "--with-gtkmm"
"--with-jpeg" "--with-jpeg"
"--with-magick" "--with-magick"
"--with-magick-pp"
"--with-sane" "--with-sane"
"--with-tiff" "--with-tiff"
]; ];
@ -67,89 +65,78 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
meta = { doInstallCheck = true;
meta = with stdenv.lib; {
description = "SANE utsushi backend for some Epson scanners"; description = "SANE utsushi backend for some Epson scanners";
longDescription = '' longDescription = ''
ImageScanV3 (aka utsushi) scanner driver. ImageScanV3 (aka utsushi) scanner driver. Non-free plugins are not
Non-free plugins are not included so no network support. included, so no network support. To use the SANE backend, in
To use the SANE backend, in /etc/nixos/configuration.nix: <literal>/etc/nixos/configuration.nix</literal>:
hardware.sane = { <literal>
enable = true; hardware.sane = {
extraBackends = [ pkgs.utsushi ]; enable = true;
}; extraBackends = [ pkgs.utsushi ];
services.udev.packages = [ pkgs.utsushi ]; };
services.udev.packages = [ pkgs.utsushi ];
</literal>
Supported hardware: Supported hardware:
- DS-40 DS-1610, DS-1630, DS-1660W, DS-310, DS-320, DS-360W, DS-40, DS-410,
- DS-70 DS-50000, DS-510, DS-520, DS-530, DS-535, DS-535H, DS-5500, DS-560,
- DS-80W DS-570W, DS-575W, DS-60000, DS-6500, DS-70, DS-70000, DS-7500, DS-760,
- DS-410 DS-770, DS-775, DS-780N, DS-80W, DS-860, EC-4020 Series, EC-4030 Series,
- DS-510 EC-4040 Series, EP-10VA Series, EP-30VA Series, EP-708A Series, EP-709A
- DS-520 Series, EP-710A Series, EP-711A Series, EP-712A Series, EP-808A Series,
- DS-530 EP-810A Series, EP-811A Series, EP-812A Series, EP-879A Series, EP-880A
- DS-535 Series, EP-881A Series, EP-882A Series, EP-978A3 Series, EP-979A3 Series,
- DS-535H EP-982A3 Series, EP-M570T Series, ES-200, ES-300W, ES-300WR, ES-400,
- DS-560 ES-50, ES-50, ES-500W, ES-500WR, ES-55R, ES-60W, ES-60WB, ES-60WW,
- DS-575W ES-65WR, ET-16500 Series, ET-2500 Series, ET-2550 Series, ET-2600 Series,
- DS-760 ET-2610 Series, ET-2650 Series, ET-2700 Series, ET-2710 Series, ET-2720
- DS-775 Series, ET-2750 Series, ET-2760 Series, ET-3600 Series, ET-3700 Series,
- DS-780N ET-3710 Series, ET-3750 Series, ET-3760 Series, ET-4500 Series, ET-4550
- DS-860 Series, ET-4700 Series, ET-4750 Series, ET-4760 Series, ET-7700 Series,
- DS-1630 ET-7750 Series, ET-8700 Series, ET-M2140 Series, ET-M2170 Series,
- DS-5500 ET-M3140 Series, ET-M3170 Series, ET-M3180 Series, EW-052A Series,
- DS-6500 EW-452A Series, EW-M5071FT Series, EW-M571T Series, EW-M630T Series,
- DS-7500 EW-M660FT Series, EW-M670FT Series, EW-M770T Series, EW-M970A3T Series,
- DS-50000 FF-640, FF-680W, GT-S650, L1455 Series, L220 Series, L222 Series, L3050
- DS-60000 Series, L3060 Series, L3070 Series, L3100 Series, L3110 Series, L3150
- DS-70000 Series, L3160 Series, L360 Series, L362 Series, L364 Series, L365 Series,
- EP-10VA Series L366 Series, L375 Series, L380 Series, L382 Series, L385 Series, L386
- EP-808A Series Series, L395 Series, L396 Series, L405 Series, L4150 Series, L4160
- EP-978A3 Series Series, L455 Series, L475 Series, L485 Series, L486 Series, L495 Series,
- ES-50 L5190 Series, L565 Series, L566 Series, L575 Series, L605 Series, L6160
- ES-55R Series, L6170 Series, L6190 Series, L655 Series, L7160 Series, L7180
- ES-60W Series, LX-10000F, LX-10000FK, LX-10010MF, LX-7000F, M2140 Series, M2170
- ES-65WR Series, M3140 Series, M3170 Series, M3180 Series, PX-048A Series, PX-049A
- ES-300WR Series, PX-M160T Series, PX-M270FT Series, PX-M270T Series, PX-M380F,
- ES-400 PX-M381FL, PX-M5080F Series, PX-M5081F Series, PX-M680F Series, PX-M7050
- ES-500WR Series, PX-M7050FP, PX-M7050FX, PX-M7070FX, PX-M7110F, PX-M7110FP,
- ES-8500 PX-M780F Series, PX-M781F Series, PX-M840FX, PX-M860F, PX-M880FX,
- ET-2500 Series PX-M884F, PX-M885F, PX-M886FL, Perfection V19, Perfection V39, ST-2000
- ET-2550 Series Series, ST-3000 Series, ST-4000 Series, ST-M3000 Series, WF-2750 Series,
- ET-4500 Series WF-2760 Series, WF-2810 Series, WF-2830 Series, WF-2850 Series, WF-2860
- ET-4550 Series Series, WF-3720 Series, WF-3730 Series, WF-4720 Series, WF-4730 Series,
- Expression 1640XL WF-4740 Series, WF-6530 Series, WF-6590 Series, WF-7710 Series, WF-7720
- FF-680W Series, WF-8510 Series, WF-8590 Series, WF-C17590 Series, WF-C20590
- L220/L360 Series Series, WF-C5710 Series, WF-C5790 Series, WF-C5790BA, WF-C579R Series,
- L365/L366 Series WF-C579RB, WF-C8610 Series, WF-C8690 Series, WF-C8690B, WF-C869R Series,
- L380 Series WF-M20590 Series, WF-M5799 Series, WF-R8590 Series, XP-2100 Series,
- L455 Series XP-220 Series, XP-230 Series, XP-235 Series, XP-240 Series, XP-243 245
- L565/L566 Series 247 Series, XP-255 257 Series, XP-3100 Series, XP-332 335 Series, XP-340
- L655 Series Series, XP-342 343 345 Series, XP-352 355 Series, XP-4100 Series, XP-430
- PX-M840FX Series, XP-432 435 Series, XP-440 Series, XP-442 445 Series, XP-452 455
- PX-M860F Series, XP-5100 Series, XP-530 Series, XP-540 Series, XP-6000 Series,
- PX-M884F XP-6100 Series, XP-630 Series, XP-640 Series, XP-7100 Series, XP-830
- PX-M7050 Series Series, XP-8500 Series, XP-8600 Series, XP-900 Series, XP-960 Series,
- PX-M7050FX Series XP-970 Series
- WF-4720 '';
- WF-6530 Series homepage = "https://gitlab.com/utsushi/imagescan";
- WF-6590 Series license = licenses.gpl3Plus;
- WF-8510/8590 Series maintainers = with maintainers; [ wucke13 ];
- WF-R8590 Series platforms = platforms.linux;
- XP-220 Series
- XP-230 Series
- XP-235 Series
- XP-332 335 Series
- XP-430 Series
- XP-432 435 Series
- XP-530 Series
- XP-540
- XP-630 Series
- XP-640
- XP-830 Series
- XP-960 Series
'';
license = stdenv.lib.licenses.gpl3Plus;
broken = true;
}; };
} }

View File

@ -1,166 +0,0 @@
Index: utsushi-0.57.0/configure.ac
===================================================================
--- utsushi-0.57.0.orig/configure.ac
+++ utsushi-0.57.0/configure.ac
@@ -221,6 +221,9 @@ AS_IF([test xno != x$enable_code_coverag
[AC_MSG_ERROR([code coverage support requires a GNU C/C++ compiler])])
])
AM_PROG_AR
+AC_PATH_PROG([AWK],[awk])
+AC_DEFINE_UNQUOTED([AWK], ["$AWK"],
+ [Path to awk.])
PKG_PROG_PKG_CONFIG
@@ -379,27 +382,31 @@ AM_CONDITIONAL([have_libmagick_pp], [tes
AS_IF([test xno != "x$with_magick"],
AS_CASE("x$with_magick",
[xGraphicsMagick],
- [AC_CHECK_PROGS([MAGICK_CONVERT], [gm])
- AS_IF([test xgm != x$MAGICK_CONVERT],
+ [[AC_PATH_PROG(MAGICK_CONVERT, gm)]
+ AS_IF([test x == x$MAGICK_CONVERT],
[AC_MSG_ERROR([$with_magick requested but not found])])
AC_DEFINE([HAVE_GRAPHICS_MAGICK], [1])
- MAGICK_CONVERT="gm convert"
+ HAVE_MAGICK=1
+ MAGICK_CONVERT="$MAGICK_CONVERT convert"
],
[xImageMagick],
- [AC_CHECK_PROGS([MAGICK_CONVERT], [convert])
- AS_IF([test xconvert != x$MAGICK_CONVERT],
+ [[AC_PATH_PROG(MAGICK_CONVERT, convert)]
+ AS_IF([test x == x$MAGICK_CONVERT],
[AC_MSG_ERROR([$with_magick requested but not found])])
AC_DEFINE([HAVE_IMAGE_MAGICK], [1])
+ HAVE_MAGICK=1
],
[xyes|xcheck],
- [AC_CHECK_PROGS([MAGICK_CONVERT], [gm convert])
+ [[AC_PATH_PROGS([MAGICK_CONVERT], [gm convert])]
AS_CASE(x$MAGICK_CONVERT,
- [xgm],
+ [x*gm],
[AC_DEFINE([HAVE_GRAPHICS_MAGICK], [1])
- MAGICK_CONVERT="gm convert"
+ HAVE_MAGICK=1
+ MAGICK_CONVERT="$MAGICK_CONVERT convert"
],
- [xconvert],
+ [x*convert],
[AC_DEFINE([HAVE_IMAGE_MAGICK], [1])
+ HAVE_MAGICK=1
],
[dnl default case
AS_IF([test xcheck != "x$with_magick"],
@@ -410,7 +417,7 @@ AS_IF([test xno != "x$with_magick"],
AC_MSG_ERROR([unknown value: --with-magick=$with_magick])
]))
AC_DEFINE_UNQUOTED([MAGICK_CONVERT], ["$MAGICK_CONVERT"])
-AM_CONDITIONAL([have_magick], [test x != "x$MAGICK_CONVERT"])
+AM_CONDITIONAL([have_magick], [test x != "x$HAVE_MAGICK"])
AS_IF([test xno != "x$with_gtkmm"],
[PKG_CHECK_MODULES([LIBGTKMM], [gtkmm-2.4 >= 2.20],
Index: utsushi-0.57.0/filters/magick.cpp
===================================================================
--- utsushi-0.57.0.orig/filters/magick.cpp
+++ utsushi-0.57.0/filters/magick.cpp
@@ -81,19 +81,18 @@ chomp (char *str)
}
bool
-magick_version_before_(const char *magick, const char *cutoff)
+magick_version_before_(const char *cutoff)
{
FILE *fp = NULL;
int errc = 0;
- if (0 == strcmp ("GraphicsMagick", magick))
- fp = popen ("gm convert -version"
- "| awk '/^GraphicsMagick/{print $2}'", "r");
- if (fp) errc = errno;
-
- if (0 == strcmp ("ImageMagick", magick))
- fp = popen ("convert -version"
- "| awk '/^Version:/{print $3}'", "r");
+#if HAVE_GRAPHICS_MAGICK
+ fp = popen (MAGICK_CONVERT " -version"
+ "| " AWK " '/^GraphicsMagick/{print $2}'", "r");
+#elif HAVE_IMAGE_MAGICK
+ fp = popen (MAGICK_CONVERT " -version"
+ "| " AWK " '/^Version:/{print $3}'", "r");
+#endif
if (fp) errc = errno;
if (fp)
@@ -106,42 +105,32 @@ magick_version_before_(const char *magic
if (version)
{
- log::debug ("found %1%-%2%") % magick % version;
+ log::debug ("found " MAGICK_CONVERT "version %1%") % version;
return (0 > strverscmp (version, cutoff));
}
}
if (errc)
- log::alert ("failure checking %1% version: %2%")
- % magick
+ log::alert ("failure checking " MAGICK_CONVERT " version: %1%")
% strerror (errc);
return false;
}
bool
-graphics_magick_version_before_(const char *cutoff)
-{
- return magick_version_before_("GraphicsMagick", cutoff);
-}
-
-bool
-image_magick_version_before_(const char *cutoff)
-{
- return magick_version_before_("ImageMagick", cutoff);
-}
-
-bool
auto_orient_is_usable ()
{
static int usable = -1;
if (-1 == usable)
{
- if (HAVE_GRAPHICS_MAGICK) // version -auto-orient was added
- usable = !graphics_magick_version_before_("1.3.18");
- if (HAVE_IMAGE_MAGICK) // version known to work
- usable = !image_magick_version_before_("6.7.8-9");
+#if HAVE_GRAPHICS_MAGICK
+ // version -auto-orient was added
+ usable = !magick_version_before_("1.3.18");
+#elif HAVE_IMAGE_MAGICK
+ // version known to work
+ usable = !magick_version_before_("6.7.8-9");
+#endif
if (-1 == usable)
usable = false;
usable = (usable ? 1 : 0);
@@ -392,7 +381,7 @@ magick::arguments (const context& ctx)
if (color_correction_)
{
if (HAVE_IMAGE_MAGICK
- && !image_magick_version_before_("6.6.1-0"))
+ && !magick_version_before_("6.6.1-0"))
argv += " -color-matrix";
else
argv += " -recolor";
@@ -416,7 +405,7 @@ magick::arguments (const context& ctx)
size_t mat_size = ((HAVE_IMAGE_MAGICK) ? 6 : 5);
if (HAVE_IMAGE_MAGICK
- && !image_magick_version_before_("6.6.1-0"))
+ && !magick_version_before_("6.6.1-0"))
argv += " -color-matrix";
else
argv += " -recolor";

View File

@ -1,56 +0,0 @@
Index: utsushi-0.57.0/filters/reorient.cpp
===================================================================
--- utsushi-0.57.0.orig/filters/reorient.cpp
+++ utsushi-0.57.0/filters/reorient.cpp
@@ -96,8 +96,8 @@ chomp (char *str)
bool
tesseract_version_before_(const char *cutoff)
{
- FILE *fp = popen ("tesseract --version 2>&1"
- "| awk '/^tesseract/{ print $2 }'", "r");
+ FILE *fp = popen (TESSERACT " --version 2>&1"
+ "| " AWK " '/^tesseract/{ print $2 }'", "r");
int errc = errno;
if (fp)
@@ -126,7 +126,7 @@ tesseract_version_before_(const char *cu
bool
have_tesseract_language_pack_(const char *lang)
{
- std::string cmd("tesseract --list-langs 2>&1"
+ std::string cmd(TESSERACT " --list-langs 2>&1"
"| sed -n '/^");
cmd += lang;
cmd += "$/p'";
@@ -291,7 +291,7 @@ reorient::reorient ()
if (found)
{
- if (have_tesseract_()) engine_ = "tesseract";
+ if (have_tesseract_()) engine_ = TESSERACT;
if (have_ocr_engine_()) engine_ = abs_path_name;
}
freeze_options (); // initializes option tracking member variables
Index: utsushi-0.57.0/configure.ac
===================================================================
--- utsushi-0.57.0.orig/configure.ac
+++ utsushi-0.57.0/configure.ac
@@ -196,6 +196,8 @@ AC_DEFINE([HAVE_IMAGE_MAGICK_PP],
[0], [Define to 1 if ImageMagick's C++ API is usable])
AC_DEFINE([MAGICK_CONVERT],
[], [Define to an appropriate command-line invocation for convert])
+AC_DEFINE([TESSERACT],
+ [], [Define to an appropriate command-line invocation for tesseract])
AC_DEFINE([WITH_INCLUDED_BOOST],
[0], [Define to 1 if using the included Boost sources])
@@ -419,6 +421,9 @@ AS_IF([test xno != "x$with_magick"],
AC_DEFINE_UNQUOTED([MAGICK_CONVERT], ["$MAGICK_CONVERT"])
AM_CONDITIONAL([have_magick], [test x != "x$HAVE_MAGICK"])
+AC_PATH_PROG([TESSERACT], [tesseract], [tesseract])
+AC_DEFINE_UNQUOTED([TESSERACT], ["$TESSERACT"])
+
AS_IF([test xno != "x$with_gtkmm"],
[PKG_CHECK_MODULES([LIBGTKMM], [gtkmm-2.4 >= 2.20],
[AC_DEFINE([HAVE_LIBGTKMM], [1])],

View File

@ -1,15 +0,0 @@
Index: utsushi-0.57.0/lib/log.cpp
===================================================================
--- utsushi-0.57.0.orig/lib/log.cpp
+++ utsushi-0.57.0/lib/log.cpp
@@ -26,8 +26,8 @@
namespace utsushi {
-log::priority log::threshold = log::FATAL;
-log::category log::matching = log::NOTHING;
+log::priority log::threshold = log::ERROR;
+log::category log::matching = log::ALL;
template<>
std::basic_ostream< char >&

View File

@ -1,3 +0,0 @@
absolute-path-to-convert.patch
print-errors.patch
absolute_path_for_tesseract.patch