8 stdenv.mkDerivation rec {
9 pname = "libsane-dsseries";
13 url = "https://download.brother.com/welcome/dlf100974/${pname}-${version}.x86_64.rpm";
14 sha256 = "1wfdbfbf51cc7njzikdg48kwpnpc0pg5s6p0s0y3z0q7y59x2wbq";
17 nativeBuildInputs = [ rpmextract ];
20 mkdir ${pname}-${version} && pushd ${pname}-${version}
26 substituteInPlace etc/udev/rules.d/50-Brother_DSScanner.rules \
27 --replace 'GROUP="users"' 'GROUP="scanner", ENV{libsane_matched}="yes"'
29 mkdir -p etc/sane.d/dll.d
30 echo "dsseries" > etc/sane.d/dll.d/dsseries.conf
36 cp -dr usr/lib64 $out/lib
40 for f in `find $out/lib/sane/ -type f`; do
41 # Make it possible to find libstdc++.so.6
42 patchelf --set-rpath ${lib.getLib stdenv.cc.cc}/lib:$out/lib/sane $f
44 # Horrible kludge: The driver hardcodes /usr/lib/sane/ as a dlopen path.
45 # We can directly modify the binary to force a relative lookup instead.
46 # The new path is NULL-padded to the same length as the original path.
47 sed -i "s|/usr/lib/sane/%s|%s\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|g" $f
52 description = "Brother DSSeries SANE backend driver";
53 homepage = "http://www.brother.com";
54 platforms = lib.platforms.linux;
55 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
56 license = lib.licenses.unfree;
57 maintainers = with lib.maintainers; [ callahad ];