Merge pull request #176693 from klemensn/digidoc-rpath-opensc

digidoc: Replace wrap with rpath addition
This commit is contained in:
Florian Klink 2022-06-12 10:06:28 +02:00 committed by GitHub
commit 2de7c6f1e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, fetchpatch, cmake, makeWrapper, minizip, pcsclite, opensc, openssl
{ lib, stdenv, fetchurl, fetchpatch, cmake, minizip, pcsclite, opensc, openssl
, xercesc, xml-security-c, pkg-config, xsd, zlib, xalanc, xxd }:
stdenv.mkDerivation rec {
@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
})
];
nativeBuildInputs = [ cmake makeWrapper pkg-config xxd ];
nativeBuildInputs = [ cmake pkg-config xxd ];
buildInputs = [
minizip pcsclite opensc openssl xercesc
@ -31,11 +31,11 @@ stdenv.mkDerivation rec {
outputs = [ "out" "lib" "dev" "bin" ];
# replace this hack with a proper cmake variable or environment variable
# once https://github.com/open-eid/cmake/pull/34 (or #35) gets merged.
postInstall = ''
wrapProgram $bin/bin/digidoc-tool \
--prefix LD_LIBRARY_PATH : ${opensc}/lib/pkcs11/
# 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; {

View file

@ -35,10 +35,14 @@ mkDerivation rec {
qttranslations
];
# replace this hack with a proper cmake variable or environment variable
# once https://github.com/open-eid/cmake/pull/34 (or #35) gets merged.
# qdigidoc4's `QPKCS11::reload()` dlopen()s "opensc-pkcs11.so" in QLibrary,
# i.e. OpenSC's module is searched for in libQt5Core's DT_RUNPATH and fixing
# qdigidoc4's DT_RUNPATH has no effect on Linux (at least OpenBSD's ld.so(1)
# searches the program's runtime path as well).
# LD_LIBRARY_PATH takes precedence for all calling objects, see dlopen(3).
# https://github.com/open-eid/cmake/pull/35 might be an alternative.
qtWrapperArgs = [
"--prefix LD_LIBRARY_PATH : ${opensc}/lib/pkcs11/"
"--prefix LD_LIBRARY_PATH : ${opensc}/lib/pkcs11/"
];
meta = with lib; {