depot/third_party/nixpkgs/pkgs/development/libraries/libdigidocpp/default.nix
Default email 472aeafc57 Project import generated by Copybara.
GitOrigin-RevId: c31898adf5a8ed202ce5bea9f347b1c6871f32d1
2024-10-04 18:56:33 +02:00

45 lines
1.5 KiB
Nix

{ lib, stdenv, fetchurl, cmake, minizip, pcsclite, opensc, openssl
, xercesc, xml-security-c, pkg-config, xsd, zlib, xalanc, xxd }:
stdenv.mkDerivation rec {
version = "3.17.1";
pname = "libdigidocpp";
src = fetchurl {
url = "https://github.com/open-eid/libdigidocpp/releases/download/v${version}/libdigidocpp-${version}.tar.gz";
hash = "sha256-3qDsIAOiWMZDj2zLE+Os7BoeCPeC4JQ6p8jSBd7PdV0=";
};
nativeBuildInputs = [ cmake pkg-config xxd ];
buildInputs = [
minizip pcsclite opensc openssl xercesc
xml-security-c xsd zlib xalanc
];
outputs = [ "out" "lib" "dev" "bin" ];
# Cherry-pick of
# https://github.com/open-eid/libdigidocpp/commit/2b5db855ba3ceb9bae1f11589ea1aea22bb7595a
# Fixes https://github.com/NixOS/nixpkgs/issues/334397
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail 'TSA_URL "http://dd-at.ria.ee/tsa"' 'TSA_URL "https://eid-dd.ria.ee/ts"'
'';
# libdigidocpp.so's `PKCS11Signer::PKCS11Signer()` dlopen()s "opensc-pkcs11.so"
# itself, so add OpenSC to its DT_RUNPATH after the fixupPhase shrinked it.
# https://github.com/open-eid/cmake/pull/35 might be an alternative.
postFixup = ''
patchelf --add-rpath ${opensc}/lib/pkcs11 $lib/lib/libdigidocpp.so
'';
meta = with lib; {
description = "Library for creating DigiDoc signature files";
mainProgram = "digidoc-tool";
homepage = "https://www.id.ee/";
license = licenses.lgpl21Plus;
platforms = platforms.linux;
maintainers = [ maintainers.jagajaga ];
};
}