2015-12-14 18:23:29 +01:00
|
|
|
{ stdenv, fetchurl
|
2015-12-17 05:03:12 +01:00
|
|
|
, avahi, libusb, libv4l, net_snmp
|
2015-12-17 05:04:22 +01:00
|
|
|
, gettext, pkgconfig
|
2015-12-14 03:39:08 +01:00
|
|
|
, gt68xxFirmware ? null, snapscanFirmware ? null
|
|
|
|
, hotplugSupport ? true
|
2015-12-20 21:44:23 +01:00
|
|
|
, version, src, ...
|
2013-11-09 14:35:35 +01:00
|
|
|
}:
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-12-21 00:01:37 +01:00
|
|
|
assert hotplugSupport ->
|
|
|
|
builtins.elem stdenv.system [ "i686-linux" "x86_64-linux" ];
|
2005-11-03 18:20:38 +01:00
|
|
|
|
2012-11-26 16:17:31 +01:00
|
|
|
let
|
2015-12-20 21:44:23 +01:00
|
|
|
|
|
|
|
udevSupport = hotplugSupport;
|
|
|
|
|
2012-11-26 16:17:31 +01:00
|
|
|
in
|
2015-12-20 21:44:23 +01:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit src;
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-12-20 21:44:23 +01:00
|
|
|
name = "sane-backends-${version}";
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-08-27 17:24:42 +02:00
|
|
|
outputs = [ "out" "doc" "man" ];
|
|
|
|
|
2015-12-14 18:23:29 +01:00
|
|
|
configureFlags = []
|
|
|
|
++ stdenv.lib.optional (avahi != null) "--enable-avahi"
|
|
|
|
++ stdenv.lib.optional (libusb != null) "--enable-libusb_1_0";
|
2013-09-25 20:15:27 +02:00
|
|
|
|
2015-12-17 05:03:12 +01:00
|
|
|
buildInputs = [ avahi libusb libv4l net_snmp ];
|
2015-12-17 05:04:22 +01:00
|
|
|
nativeBuildInputs = [ gettext pkgconfig ];
|
2007-08-08 22:33:36 +02:00
|
|
|
|
2009-04-23 15:31:10 +02:00
|
|
|
postInstall = ''
|
|
|
|
if test "$udevSupport" = "1"; then
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/etc/udev/rules.d/
|
2014-11-15 23:07:54 +01:00
|
|
|
./tools/sane-desc -m udev > $out/etc/udev/rules.d/49-libsane.rules || \
|
|
|
|
cp tools/udev/libsane.rules $out/etc/udev/rules.d/49-libsane.rules
|
2009-04-23 15:31:10 +02:00
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall =
|
2012-11-26 16:17:31 +01:00
|
|
|
if gt68xxFirmware != null then
|
2015-12-21 00:01:37 +01:00
|
|
|
"mkdir -p \${out}/share/sane/gt68xx ; ln -s " + gt68xxFirmware.fw +
|
|
|
|
" \${out}/share/sane/gt68xx/" + gt68xxFirmware.name
|
2013-08-25 21:19:21 +02:00
|
|
|
else if snapscanFirmware != null then
|
|
|
|
"mkdir -p \${out}/share/sane/snapscan ; ln -s " + snapscanFirmware +
|
|
|
|
" \${out}/share/sane/snapscan/your-firmwarefile.bin"
|
2015-12-17 04:18:31 +01:00
|
|
|
"mkdir -p \${out}/etc/sane.d ; " +
|
|
|
|
"echo epson2 >> \${out}/etc/sane.d/dll.conf"
|
2009-04-23 15:31:10 +02:00
|
|
|
else "";
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-12-05 20:27:52 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-12-20 21:44:23 +01:00
|
|
|
inherit version;
|
|
|
|
|
2015-12-05 22:27:27 +01:00
|
|
|
description = "SANE (Scanner Access Now Easy) backends";
|
|
|
|
longDescription = ''
|
|
|
|
Collection of open-source SANE backends (device drivers).
|
|
|
|
SANE is a universal scanner interface providing standardized access to
|
|
|
|
any raster image scanner hardware: flatbed scanners, hand-held scanners,
|
|
|
|
video- and still-cameras, frame-grabbers, etc. For a list of supported
|
|
|
|
scanners, see http://www.sane-project.org/sane-backends.html.
|
|
|
|
'';
|
2015-12-20 21:44:23 +01:00
|
|
|
homepage = "http://www.sane-project.org/";
|
2015-12-05 20:27:52 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-12-05 20:27:52 +01:00
|
|
|
maintainers = with maintainers; [ nckx simons ];
|
|
|
|
platforms = platforms.linux;
|
2012-11-26 16:17:31 +01:00
|
|
|
};
|
2005-11-03 18:20:38 +01:00
|
|
|
}
|