1{ lib, stdenv, fetchurl, cmake, minizip, pcsclite, opensc, openssl
2, xercesc, xml-security-c, pkg-config, xsd, zlib, xalanc, xxd }:
3
4stdenv.mkDerivation rec {
5 version = "3.17.1";
6 pname = "libdigidocpp";
7
8 src = fetchurl {
9 url = "https://github.com/open-eid/libdigidocpp/releases/download/v${version}/libdigidocpp-${version}.tar.gz";
10 hash = "sha256-3qDsIAOiWMZDj2zLE+Os7BoeCPeC4JQ6p8jSBd7PdV0=";
11 };
12
13 nativeBuildInputs = [ cmake pkg-config xxd ];
14
15 buildInputs = [
16 minizip pcsclite opensc openssl xercesc
17 xml-security-c xsd zlib xalanc
18 ];
19
20 outputs = [ "out" "lib" "dev" "bin" ];
21
22 # libdigidocpp.so's `PKCS11Signer::PKCS11Signer()` dlopen()s "opensc-pkcs11.so"
23 # itself, so add OpenSC to its DT_RUNPATH after the fixupPhase shrinked it.
24 # https://github.com/open-eid/cmake/pull/35 might be an alternative.
25 postFixup = ''
26 patchelf --add-rpath ${opensc}/lib/pkcs11 $lib/lib/libdigidocpp.so
27 '';
28
29 meta = with lib; {
30 description = "Library for creating DigiDoc signature files";
31 mainProgram = "digidoc-tool";
32 homepage = "https://www.id.ee/";
33 license = licenses.lgpl21Plus;
34 platforms = platforms.linux;
35 maintainers = [ maintainers.jagajaga ];
36 };
37}