2016-01-26 03:05:02 +00:00
|
|
|
{ stdenv, fetchurl, patchelf, cups, libusb, libxml2 }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
arch = if stdenv.system == "x86_64-linux"
|
|
|
|
then "x86_64"
|
|
|
|
else "i386";
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "samsung-unified-linux-driver-${version}";
|
|
|
|
version = "1.00.37";
|
2012-12-05 03:37:44 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-01-26 03:05:02 +00:00
|
|
|
sha256 = "0r66l9zp0p1qgakh4j08hynwsr4lsgq5yrpxyr0x4ldvl0z2b1bb";
|
2015-04-01 17:25:34 +00:00
|
|
|
url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${version}.tar.gz";
|
2012-12-05 03:37:44 +00:00
|
|
|
};
|
|
|
|
|
2016-01-26 03:05:02 +00:00
|
|
|
nativeBuildInputs = [ patchelf ];
|
|
|
|
|
|
|
|
phases = [ "unpackPhase" "installPhase" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
my_patchelf() {
|
|
|
|
opts=(); while [[ "$1" != - ]]; do opts+=( "$1" ); shift; done; shift
|
|
|
|
for binary in "$@"; do
|
|
|
|
echo "Patching ELF file: $binary"
|
|
|
|
patchelf "''${opts[@]}" $binary
|
|
|
|
ldd $binary | grep "not found" && exit 1
|
|
|
|
done; true
|
|
|
|
}
|
|
|
|
|
|
|
|
my_patchelf \
|
|
|
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
2016-08-23 01:33:36 +00:00
|
|
|
--set-rpath ${cups.out}/lib:$(cat $NIX_CC/nix-support/orig-cc)/lib:${stdenv.glibc}/lib \
|
2016-01-26 03:05:02 +00:00
|
|
|
- ${arch}/{pstosecps,rastertospl,smfpnetdiscovery}
|
|
|
|
|
|
|
|
mkdir -p $out/etc/sane.d/dll.d/
|
|
|
|
install -m644 noarch/etc/smfp.conf $out/etc/sane.d
|
|
|
|
echo smfp >> $out/etc/sane.d/dll.d/smfp-scanner
|
2012-12-05 03:37:44 +00:00
|
|
|
|
2016-01-26 03:05:02 +00:00
|
|
|
mkdir -p $out/lib
|
|
|
|
my_patchelf \
|
|
|
|
--set-rpath $(cat $NIX_CC/nix-support/orig-cc)/lib:${stdenv.glibc}/lib \
|
|
|
|
- ${arch}/libscmssc.so*
|
|
|
|
install -m755 ${arch}/libscmssc.so* $out/lib
|
2012-12-05 03:37:44 +00:00
|
|
|
|
2016-01-26 03:05:02 +00:00
|
|
|
mkdir -p $out/lib/cups/backend
|
|
|
|
install -m755 ${arch}/smfpnetdiscovery $out/lib/cups/backend
|
|
|
|
|
|
|
|
mkdir -p $out/lib/cups/filter
|
|
|
|
install -m755 ${arch}/{pstosecps,rastertospl} $out/lib/cups/filter
|
|
|
|
|
|
|
|
mkdir -p $out/lib/sane
|
|
|
|
my_patchelf \
|
2016-08-22 21:04:39 +00:00
|
|
|
--set-rpath $(cat $NIX_CC/nix-support/orig-cc)/lib:${stdenv.lib.makeLibraryPath [ stdenv.glibc libusb libxml2 ] } \
|
2016-01-26 03:05:02 +00:00
|
|
|
- ${arch}/libsane-smfp.so*
|
|
|
|
install -m755 ${arch}/libsane-smfp.so* $out/lib/sane
|
|
|
|
ln -s libsane-smfp.so.1.0.1 $out/lib/sane/libsane-smfp.so.1
|
|
|
|
ln -s libsane-smfp.so.1 $out/lib/sane/libsane-smfp.so
|
|
|
|
|
|
|
|
mkdir -p $out/lib/udev/rules.d
|
|
|
|
(
|
|
|
|
OEM_FILE=noarch/oem.conf
|
|
|
|
INSTALL_LOG_FILE=/dev/null
|
|
|
|
. noarch/scripting_utils
|
|
|
|
. noarch/package_utils
|
|
|
|
. noarch/scanner-script.pkg
|
|
|
|
fill_full_template noarch/etc/smfp.rules.in $out/lib/udev/rules.d/60_smfp_samsung.rules
|
|
|
|
)
|
|
|
|
|
|
|
|
mkdir -p $out/share/ppd
|
|
|
|
gzip -9 noarch/share/ppd/*.ppd
|
|
|
|
cp -R noarch/share/ppd $out/share/ppd/suld
|
|
|
|
|
|
|
|
cp -R noarch/share/locale $out/share
|
|
|
|
rm -r $out/share/locale/*/*/install.mo
|
|
|
|
'';
|
2012-12-05 03:37:44 +00:00
|
|
|
|
2015-03-02 16:05:29 +00:00
|
|
|
meta = with stdenv.lib; {
|
2016-01-26 03:05:02 +00:00
|
|
|
description = "Unified Linux Driver for Samsung printers and scanners";
|
|
|
|
homepage = http://www.bchemnet.com/suldr;
|
|
|
|
downloadPage = http://www.bchemnet.com/suldr/driver/;
|
2015-03-02 16:05:29 +00:00
|
|
|
license = licenses.unfree;
|
2016-01-26 03:05:02 +00:00
|
|
|
|
|
|
|
# Tested on linux-x86_64. Might work on linux-i386.
|
|
|
|
# Probably won't work on anything else.
|
2015-03-02 16:05:29 +00:00
|
|
|
platforms = platforms.linux;
|
2015-04-01 17:25:34 +00:00
|
|
|
maintainers = with maintainers; [ nckx ];
|
2012-12-05 03:37:44 +00:00
|
|
|
};
|
|
|
|
}
|