aboutsummaryrefslogtreecommitdiff
path: root/pkgs/libatsha204/default.nix
blob: 2415985125e1a50d46b0ceb59203badba1bc65c6 (plain)
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
{ stdenv, lib, fetchgit
, pkg-config, perl, patchelf
,glibc , openssl, unbound
}:

stdenv.mkDerivation rec {
  pname = "libatsha204";
  version = "29.2";
  meta = with lib; {
    homepage = "https://gitlab.nic.cz/turris/libatsha204";
    description = "Turris Atsha204 library and tools";
    platforms = platforms.linux;
    license = licenses.gpl3;
  };

  src = fetchgit {
    url = "https://gitlab.nic.cz/turris/libatsha204.git";
    rev = "v" + version;
    fetchSubmodules = true;
    sha256 = "1lhvqdy2sfbvz9y9lwqhxggpr8rwfd66v73gv9s7b7811r6way20";
  };

  buildInputs = [openssl unbound];
  nativeBuildInputs = [pkg-config perl patchelf];

  makeFlags = [ "RELEASE=1" "NO_DOC=1" ];
  configurePhase = ''
    sed -i 's|/usr/bin/perl|${perl}/bin/perl|' build/embed_gen.pl build/normalize_dep_file.pl
    '';
  installPhase = ''
    mkdir -p $out/usr/include $out/lib $out/bin
    cp src/libatsha204/atsha204.h $out/usr/include/
    cp lib/libatsha204.so* $out/lib
    cp bin/atsha204cmd $out/bin
    patchelf --set-rpath $out/lib:${openssl.out}/lib:${unbound.lib}/lib:${glibc}/lib $out/bin/atsha204cmd
    '';
}