Downgrading the opensc library version to 0.11.7, that required
[nixpkgs-libre.git] / pkgs / development / libraries / opensc-dnie / default.nix
blobd36a3b157cc7154880c737add114489581469e05
1 {stdenv, fetchurl, writeScript, patchelf, glib, opensc, openssl, openct, libtool, pcsclite,
2 zlib}:
4 # Version 1.4.6-2 works only with opensc 0.11.7
5 assert opensc.name == "opensc-0.11.7";
7 stdenv.mkDerivation rec {
8   name = "opensc-dnie-1.4.6-2";
9   
10   src = if (stdenv.system == "i686-linux") then (fetchurl {
11       url = http://www.dnielectronico.es/descargas/PKCS11_para_Sistemas_Unix/1.4.6.Ubuntu_Jaunty_32/Ubuntu_Jaunty_opensc-dnie_1.4.6-2_i386.deb.tar;
12       sha256 = "1i6r9ahjr0rkcxjfzkg2rrib1rjsjd5raxswvvfiya98q8rlv39i";
13     })
14     else if (stdenv.system == "x86_64-linux") then (fetchurl { url = http://www.dnielectronico.es/descargas/PKCS11_para_Sistemas_Unix/1.4.6.Ubuntu_Jaunty_64/Ubuntu_Jaunty_opensc-dnie_1.4.6-2_amd64.deb.tar;
15       sha256 = "1py2bxavdcj0crhk1lwqzjgya5lvyhdfdbr4g04iysj56amxb7f9";
16     })
17     else throw "Architecture not supported";
19   buildInputs = [ patchelf glib ];
21   builder = writeScript (name + "-builder.sh") ''
22     source $stdenv/setup
23     tar xf $src
24     ar x opensc-dnie*
25     tar xf data.tar.gz
27     RPATH=${glib}/lib:${opensc}/lib:${openssl}/lib:${openct}/lib:${libtool}/lib:${pcsclite}/lib:${stdenv.gcc.libc}/lib:${zlib}/lib
29     for a in usr/lib/*.so*; do
30         if ! test -L $a; then
31             patchelf --set-rpath $RPATH $a
32         fi
33     done
35     sed -i s,/usr,$out, usr/lib/pkgconfig/*
36    
37     ensureDir $out
38     cp -R usr/lib $out
39     cp -R usr/share $out
40   '';
42   meta = {
43     homepage = http://www.dnielectronico.es/descargas/;
44     description = "Opensc plugin to access the Spanish national ID smartcard";
45     license = "nonfree";
46     maintainers = with stdenv.lib.maintainers; [viric];
47     platforms = with stdenv.lib.platforms; linux;
48   };