2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchurl, cups, libusb-compat-0_1, libxml2 }:
|
2016-01-26 04:05:02 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2018-08-20 21:11:29 +02:00
|
|
|
arch = if stdenv.hostPlatform.system == "x86_64-linux"
|
2016-01-26 04:05:02 +01:00
|
|
|
then "x86_64"
|
|
|
|
else "i386";
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "samsung-unified-linux-driver";
|
2016-01-26 04:05:02 +01:00
|
|
|
version = "1.00.37";
|
2012-12-05 04:37:44 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-01-26 04:05:02 +01:00
|
|
|
sha256 = "0r66l9zp0p1qgakh4j08hynwsr4lsgq5yrpxyr0x4ldvl0z2b1bb";
|
2015-04-01 19:25:34 +02:00
|
|
|
url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${version}.tar.gz";
|
2012-12-05 04:37:44 +01:00
|
|
|
};
|
|
|
|
|
2016-10-29 21:37:59 +02:00
|
|
|
buildInputs = [
|
|
|
|
cups
|
2020-04-28 05:29:39 +02:00
|
|
|
libusb-compat-0_1
|
2017-03-09 11:05:52 +01:00
|
|
|
libxml2
|
2016-10-29 21:37:59 +02:00
|
|
|
];
|
2016-01-26 04:05:02 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2016-10-29 21:37:59 +02:00
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -R ${arch}/{gettext,pstosecps,rastertospl,smfpnetdiscovery,usbresetter} $out/bin
|
2016-01-26 04:05:02 +01:00
|
|
|
|
|
|
|
mkdir -p $out/etc/sane.d/dll.d/
|
|
|
|
install -m644 noarch/etc/smfp.conf $out/etc/sane.d
|
2016-10-29 21:37:59 +02:00
|
|
|
echo smfp >> $out/etc/sane.d/dll.d/smfp-scanner.conf
|
2012-12-05 04:37:44 +01:00
|
|
|
|
2016-01-26 04:05:02 +01:00
|
|
|
mkdir -p $out/lib
|
|
|
|
install -m755 ${arch}/libscmssc.so* $out/lib
|
2012-12-05 04:37:44 +01:00
|
|
|
|
2016-01-26 04:05:02 +01:00
|
|
|
mkdir -p $out/lib/cups/backend
|
2016-10-29 21:37:59 +02:00
|
|
|
ln -s $out/bin/smfpnetdiscovery $out/lib/cups/backend
|
2016-01-26 04:05:02 +01:00
|
|
|
|
|
|
|
mkdir -p $out/lib/cups/filter
|
2016-10-29 21:37:59 +02:00
|
|
|
ln -s $out/bin/{pstosecps,rastertospl} $out/lib/cups/filter
|
|
|
|
ln -s $ghostscript/bin/gs $out/lib/cups/filter
|
2016-01-26 04:05:02 +01:00
|
|
|
|
|
|
|
mkdir -p $out/lib/sane
|
|
|
|
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
|
2016-10-29 21:37:59 +02:00
|
|
|
chmod -x $out/lib/udev/rules.d/60_smfp_samsung.rules
|
2016-01-26 04:05:02 +01:00
|
|
|
)
|
|
|
|
|
2016-10-29 21:37:59 +02:00
|
|
|
mkdir -p $out/share
|
|
|
|
cp -R noarch/share/* $out/share
|
|
|
|
gzip -9 $out/share/ppd/*.ppd
|
2016-01-26 04:05:02 +01:00
|
|
|
rm -r $out/share/locale/*/*/install.mo
|
2016-10-29 21:37:59 +02:00
|
|
|
|
|
|
|
mkdir -p $out/share/cups
|
|
|
|
cd $out/share/cups
|
|
|
|
ln -s ../ppd .
|
|
|
|
ln -s ppd model
|
2016-01-26 04:05:02 +01:00
|
|
|
'';
|
2012-12-05 04:37:44 +01:00
|
|
|
|
2016-10-29 21:37:59 +02:00
|
|
|
preFixup = ''
|
2017-03-09 11:05:52 +01:00
|
|
|
for bin in "$out/bin/"*; do
|
|
|
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$bin"
|
2021-01-15 14:21:58 +01:00
|
|
|
patchelf --set-rpath "$out/lib:${lib.getLib cups}/lib" "$bin"
|
2017-03-09 11:05:52 +01:00
|
|
|
done
|
2016-10-29 21:37:59 +02:00
|
|
|
|
2021-01-15 14:21:58 +01:00
|
|
|
patchelf --set-rpath "$out/lib:${lib.getLib cups}/lib" "$out/lib/libscmssc.so"
|
2020-04-28 05:29:39 +02:00
|
|
|
patchelf --set-rpath "$out/lib:${libxml2.out}/lib:${libusb-compat-0_1.out}/lib" "$out/lib/sane/libsane-smfp.so.1.0.1"
|
2016-10-29 21:37:59 +02:00
|
|
|
|
2017-03-09 11:05:52 +01:00
|
|
|
ln -s ${stdenv.cc.cc.lib}/lib/libstdc++.so.6 $out/lib/
|
2016-10-29 21:37:59 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
# all binaries are already stripped
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
# we did this in prefixup already
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2016-01-26 04:05:02 +01:00
|
|
|
description = "Unified Linux Driver for Samsung printers and scanners";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://www.bchemnet.com/suldr";
|
|
|
|
downloadPage = "http://www.bchemnet.com/suldr/driver/";
|
2015-03-02 17:05:29 +01:00
|
|
|
license = licenses.unfree;
|
2016-01-26 04:05:02 +01:00
|
|
|
|
|
|
|
# Tested on linux-x86_64. Might work on linux-i386.
|
|
|
|
# Probably won't work on anything else.
|
2015-03-02 17:05:29 +01:00
|
|
|
platforms = platforms.linux;
|
2012-12-05 04:37:44 +01:00
|
|
|
};
|
|
|
|
}
|