summary refs log tree commit diff
path: root/pkgs/development/libraries/scmccid/default.nix
blob: f18107c48a5ebcea76261209f60c8eb3eacfdcd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{stdenv, fetchurl, patchelf, libusb}:

assert stdenv ? gcc && stdenv.gcc.libc != null;

stdenv.mkDerivation rec {
  name = "scmccid-5.0.11";
  
  src = if stdenv.system == "i686-linux" then (fetchurl {
      url = "http://www.scmmicro.com/support/download/scmccid_5.0.11_linux.tar.gz";
      sha256 = "1r5wkarhzl09ncgj55baizf573czw0nplh1pgddzx9xck66kh5bm";
    })
    else if stdenv.system == "x86_64-linux" then (fetchurl {
        url = "http://www.scmmicro.com/support/download/scmccid_5.0.11_linux_x64.tar.gz";
        sha256 = "0k9lzlk01sl4ycfqgrqqy3bildz0mcr1r0kkicgjz96l4s0jgz0i";
    })
    else throw "Architecture not supported";

  buildInputs = [ patchelf ];

  installPhase = ''
    RPATH=${libusb}/lib:${stdenv.gcc.libc}/lib

    for a in proprietary/*/Contents/Linux/*.so*; do
        if ! test -L $a; then
            patchelf --set-rpath $RPATH $a
        fi
    done

    mkdir -p $out/pcsc/drivers
    cp -R proprietary/* $out/pcsc/drivers
  '';

  meta = {
    homepage = http://www.scmmicro.com/support/pc-security-support/downloads.html;
    description = "PCSC drivers for linux, for the SCM SCR3310 v2.0 card and others";
    license = "nonfree";
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}