From af911744fdbb10cc21d3267c09adc9a06c53d9f3 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Tue, 26 Jan 2016 04:05:02 +0100 Subject: [PATCH] samsung-unified-linux-driver: add 1.00.37 Very experimental. Probably very broken. Adds support for newer models but removes it for some older ones. Hence not the default yet, if ever. --- .../drivers/samsung/{ => 4.00.39}/builder.sh | 0 .../cups/drivers/samsung/4.00.39/default.nix | 40 ++++++++ pkgs/misc/cups/drivers/samsung/default.nix | 96 ++++++++++++++----- pkgs/top-level/all-packages.nix | 3 +- 4 files changed, 115 insertions(+), 24 deletions(-) rename pkgs/misc/cups/drivers/samsung/{ => 4.00.39}/builder.sh (100%) create mode 100644 pkgs/misc/cups/drivers/samsung/4.00.39/default.nix diff --git a/pkgs/misc/cups/drivers/samsung/builder.sh b/pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh similarity index 100% rename from pkgs/misc/cups/drivers/samsung/builder.sh rename to pkgs/misc/cups/drivers/samsung/4.00.39/builder.sh diff --git a/pkgs/misc/cups/drivers/samsung/4.00.39/default.nix b/pkgs/misc/cups/drivers/samsung/4.00.39/default.nix new file mode 100644 index 000000000000..27d21f862852 --- /dev/null +++ b/pkgs/misc/cups/drivers/samsung/4.00.39/default.nix @@ -0,0 +1,40 @@ +# Tested on linux-x86_64. Might work on linux-i386. Probably won't work on anything else. + +# To use this driver in NixOS, add it to printing.drivers in configuration.nix. +# configuration.nix might look like this when you're done: +# { pkgs, ... }: { +# printing = { +# enable = true; +# drivers = [ pkgs.samsungUnifiedLinuxDriver ]; +# }; +# (more stuff) +# } +# (This advice was tested on 2010 August 2.) + +{ stdenv, fetchurl, cups, gcc, ghostscript, glibc, patchelf }: + +# Do not bump lightly! Visit +# to see what will break when upgrading. Consider a new versioned attribute. +stdenv.mkDerivation rec { + name = "samsung-UnifiedLinuxDriver-${version}"; + version = "4.00.39"; + + src = fetchurl { + url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${version}.tar.gz"; + sha256 = "144b4xggbzjfq7ga5nza7nra2cf6qn63z5ls7ba1jybkx1vm369k"; + }; + + buildInputs = [ cups gcc ghostscript glibc patchelf ]; + + inherit cups gcc ghostscript glibc; + + builder = ./builder.sh; + + meta = with stdenv.lib; { + description = "Samsung's Linux printing drivers; includes binaries without source code"; + homepage = http://www.samsung.com/; + license = licenses.unfree; + platforms = platforms.linux; + maintainers = with maintainers; [ nckx ]; + }; +} diff --git a/pkgs/misc/cups/drivers/samsung/default.nix b/pkgs/misc/cups/drivers/samsung/default.nix index 27d21f862852..34b5f58aed51 100644 --- a/pkgs/misc/cups/drivers/samsung/default.nix +++ b/pkgs/misc/cups/drivers/samsung/default.nix @@ -1,39 +1,89 @@ -# Tested on linux-x86_64. Might work on linux-i386. Probably won't work on anything else. +{ stdenv, fetchurl, patchelf, cups, libusb, libxml2 }: -# To use this driver in NixOS, add it to printing.drivers in configuration.nix. -# configuration.nix might look like this when you're done: -# { pkgs, ... }: { -# printing = { -# enable = true; -# drivers = [ pkgs.samsungUnifiedLinuxDriver ]; -# }; -# (more stuff) -# } -# (This advice was tested on 2010 August 2.) +let -{ stdenv, fetchurl, cups, gcc, ghostscript, glibc, patchelf }: + arch = if stdenv.system == "x86_64-linux" + then "x86_64" + else "i386"; -# Do not bump lightly! Visit -# to see what will break when upgrading. Consider a new versioned attribute. -stdenv.mkDerivation rec { - name = "samsung-UnifiedLinuxDriver-${version}"; - version = "4.00.39"; +in stdenv.mkDerivation rec { + name = "samsung-unified-linux-driver-${version}"; + version = "1.00.37"; src = fetchurl { + sha256 = "0r66l9zp0p1qgakh4j08hynwsr4lsgq5yrpxyr0x4ldvl0z2b1bb"; url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${version}.tar.gz"; - sha256 = "144b4xggbzjfq7ga5nza7nra2cf6qn63z5ls7ba1jybkx1vm369k"; }; - buildInputs = [ cups gcc ghostscript glibc patchelf ]; + nativeBuildInputs = [ patchelf ]; - inherit cups gcc ghostscript glibc; + phases = [ "unpackPhase" "installPhase" ]; - builder = ./builder.sh; + 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) \ + --set-rpath ${cups}/lib:$(cat $NIX_CC/nix-support/orig-cc)/lib:${stdenv.glibc}/lib \ + - ${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 + + 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 + + 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 \ + --set-rpath $(cat $NIX_CC/nix-support/orig-cc)/lib:${stdenv.glibc}/lib:${libusb}/lib:${libxml2}/lib \ + - ${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 + ''; meta = with stdenv.lib; { - description = "Samsung's Linux printing drivers; includes binaries without source code"; - homepage = http://www.samsung.com/; + description = "Unified Linux Driver for Samsung printers and scanners"; + homepage = http://www.bchemnet.com/suldr; + downloadPage = http://www.bchemnet.com/suldr/driver/; license = licenses.unfree; + + # Tested on linux-x86_64. Might work on linux-i386. + # Probably won't work on anything else. platforms = platforms.linux; maintainers = with maintainers; [ nckx ]; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d909f127b3ff..ecaab504e322 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15628,7 +15628,8 @@ let mfcj470dw = callPackage_i686 ../misc/cups/drivers/mfcj470dw { }; - samsung-unified-linux-driver = callPackage ../misc/cups/drivers/samsung { }; + samsung-unified-linux-driver_1_00_37 = callPackage ../misc/cups/drivers/samsung { }; + samsung-unified-linux-driver = callPackage ../misc/cups/drivers/samsung/4.00.39 { }; sane-backends = callPackage ../applications/graphics/sane/backends { gt68xxFirmware = config.sane.gt68xxFirmware or null;