2012-11-23 21:31:23 +01:00
|
|
|
{ stdenv, fetchurl, fetchgit, hotplugSupport ? true, libusb ? null, gt68xxFirmware ? null }:
|
2011-12-05 18:32:45 +01:00
|
|
|
let
|
2012-11-23 21:31:23 +01:00
|
|
|
firmware = gt68xxFirmware { inherit fetchurl; };
|
2011-12-05 18:32:45 +01:00
|
|
|
in
|
2012-11-23 21:31:23 +01:00
|
|
|
assert hotplugSupport -> (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux");
|
2011-12-05 18:32:45 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2012-11-23 21:31:23 +01:00
|
|
|
name = "sane-backends-1.0.22.git20121123";
|
|
|
|
|
2011-12-05 18:32:45 +01:00
|
|
|
src = fetchurl {
|
2012-11-23 21:31:23 +01:00
|
|
|
url = "http://www.sane-project.org/snapshots/sane-backends-git20121123.tar.gz";
|
|
|
|
sha256 = "d13a8c9e85af52f7be2e45c70cb93a76ec04b76e7fc983809e7d70389b6e7ae5";
|
2011-12-05 18:32:45 +01:00
|
|
|
};
|
2012-11-23 21:31:23 +01:00
|
|
|
|
2011-12-05 18:32:45 +01:00
|
|
|
udevSupport = hotplugSupport;
|
|
|
|
|
|
|
|
buildInputs = if libusb != null then [libusb] else [];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
if test "$udevSupport" = "1"; then
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/etc/udev/rules.d/
|
2011-12-05 18:32:45 +01:00
|
|
|
./tools/sane-desc -m udev > $out/etc/udev/rules.d/60-libsane.rules || \
|
|
|
|
cp tools/udev/libsane.rules $out/etc/udev/rules.d/60-libsane.rules
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall =
|
2012-11-23 21:31:23 +01:00
|
|
|
if gt68xxFirmware != null then
|
2011-12-05 18:32:45 +01:00
|
|
|
"mkdir -p \${out}/share/sane/gt68xx ; ln -s " + firmware.fw +
|
|
|
|
" \${out}/share/sane/gt68xx/" + firmware.name
|
|
|
|
else "";
|
|
|
|
}
|