1 { lib, stdenv, fetchurl, cups, libusb-compat-0_1, libxml2 }:
5 arch = if stdenv.hostPlatform.system == "x86_64-linux"
9 in stdenv.mkDerivation rec {
10 pname = "samsung-unified-linux-driver";
14 sha256 = "0r66l9zp0p1qgakh4j08hynwsr4lsgq5yrpxyr0x4ldvl0z2b1bb";
15 url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${version}.tar.gz";
28 cp -R ${arch}/{gettext,pstosecps,rastertospl,smfpnetdiscovery,usbresetter} $out/bin
30 mkdir -p $out/etc/sane.d/dll.d/
31 install -m644 noarch/etc/smfp.conf $out/etc/sane.d
32 echo smfp >> $out/etc/sane.d/dll.d/smfp-scanner.conf
35 install -m755 ${arch}/libscmssc.so* $out/lib
37 mkdir -p $out/lib/cups/backend
38 ln -s $out/bin/smfpnetdiscovery $out/lib/cups/backend
40 mkdir -p $out/lib/cups/filter
41 ln -s $out/bin/{pstosecps,rastertospl} $out/lib/cups/filter
42 ln -s $ghostscript/bin/gs $out/lib/cups/filter
44 mkdir -p $out/lib/sane
45 install -m755 ${arch}/libsane-smfp.so* $out/lib/sane
46 ln -s libsane-smfp.so.1.0.1 $out/lib/sane/libsane-smfp.so.1
47 ln -s libsane-smfp.so.1 $out/lib/sane/libsane-smfp.so
49 mkdir -p $out/lib/udev/rules.d
51 OEM_FILE=noarch/oem.conf
52 INSTALL_LOG_FILE=/dev/null
53 . noarch/scripting_utils
54 . noarch/package_utils
55 . noarch/scanner-script.pkg
56 fill_full_template noarch/etc/smfp.rules.in $out/lib/udev/rules.d/60_smfp_samsung.rules
57 chmod -x $out/lib/udev/rules.d/60_smfp_samsung.rules
61 cp -R noarch/share/* $out/share
62 gzip -9 $out/share/ppd/*.ppd
63 rm -r $out/share/locale/*/*/install.mo
65 mkdir -p $out/share/cups
74 for bin in "$out/bin/"*; do
75 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$bin"
76 patchelf --set-rpath "$out/lib:${lib.getLib cups}/lib" "$bin"
79 patchelf --set-rpath "$out/lib:${lib.getLib cups}/lib" "$out/lib/libscmssc.so"
80 patchelf --set-rpath "$out/lib:${libxml2.out}/lib:${libusb-compat-0_1.out}/lib" "$out/lib/sane/libsane-smfp.so.1.0.1"
82 ln -s ${lib.getLib stdenv.cc.cc}/lib/libstdc++.so.6 $out/lib/
85 # all binaries are already stripped
88 # we did this in prefixup already
92 description = "Unified Linux Driver for Samsung printers and scanners";
93 homepage = "http://www.bchemnet.com/suldr";
94 downloadPage = "http://www.bchemnet.com/suldr/driver/";
95 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
96 license = licenses.unfree;
98 # Tested on linux-x86_64. Might work on linux-i386.
99 # Probably won't work on anything else.
100 platforms = platforms.linux;