From be4406edeecf6e2225b6c6d96a24f89ed4b314e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=B6ller?= Date: Mon, 2 Sep 2019 14:19:15 +0200 Subject: [PATCH 1/2] xmlsec: add library path to lt_dladdsearchdir This makes it easier to use libxmlsec in other libraries like python-xmlsec. --- pkgs/development/libraries/xmlsec/default.nix | 15 +++++++++------ .../libraries/xmlsec/lt_dladdsearchdir.patch | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/libraries/xmlsec/lt_dladdsearchdir.patch diff --git a/pkgs/development/libraries/xmlsec/default.nix b/pkgs/development/libraries/xmlsec/default.nix index 25c5bf458887..86cc6638fa61 100644 --- a/pkgs/development/libraries/xmlsec/default.nix +++ b/pkgs/development/libraries/xmlsec/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, libxml2, gnutls, libxslt, pkgconfig, libgcrypt, libtool -, openssl, nss, makeWrapper }: +, openssl, nss }: let version = "1.2.28"; @@ -13,9 +13,16 @@ stdenv.mkDerivation { sha256 = "1m12caglhyx08g8lh2sl3nkldlpryzdx2d572q73y3m33s0w9vhk"; }; + patches = [ + ./lt_dladdsearchdir.patch + ]; + postPatch = '' + substituteAllInPlace src/dl.c + ''; + outputs = [ "out" "dev" ]; - nativeBuildInputs = [ makeWrapper pkgconfig ]; + nativeBuildInputs = [ pkgconfig ]; buildInputs = [ libxml2 gnutls libxslt libgcrypt libtool openssl nss ]; @@ -34,10 +41,6 @@ stdenv.mkDerivation { moveToOutput "lib/xmlsec1Conf.sh" "$dev" ''; - postFixup = '' - wrapProgram "$out/bin/xmlsec1" --prefix LD_LIBRARY_PATH ":" "$out/lib" - ''; - meta = { homepage = http://www.aleksey.com/xmlsec; downloadPage = https://www.aleksey.com/xmlsec/download.html; diff --git a/pkgs/development/libraries/xmlsec/lt_dladdsearchdir.patch b/pkgs/development/libraries/xmlsec/lt_dladdsearchdir.patch new file mode 100644 index 000000000000..17dedb0d6c81 --- /dev/null +++ b/pkgs/development/libraries/xmlsec/lt_dladdsearchdir.patch @@ -0,0 +1,16 @@ +diff --git a/src/dl.c b/src/dl.c +index b13f9d46..d761855b 100644 +--- a/src/dl.c ++++ b/src/dl.c +@@ -346,6 +346,11 @@ xmlSecCryptoDLInit(void) { + xmlSecIOError("lt_dlinit", NULL, NULL); + return(-1); + } ++ ret = lt_dladdsearchdir("@out@/lib"); ++ if(ret != 0) { ++ xmlSecIOError("lt_dladdsearchdir", NULL, NULL); ++ return(-1); ++ } + #endif /* XMLSEC_DL_LIBLTDL */ + + return(0); From de3781374143fe28a5cbdf7e3d15b6b07a645363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=B6ller?= Date: Wed, 15 Jul 2020 10:56:59 +0200 Subject: [PATCH 2/2] xmlsec: add simple libxmlsec1 crypto loading test --- pkgs/development/libraries/xmlsec/default.nix | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/xmlsec/default.nix b/pkgs/development/libraries/xmlsec/default.nix index 86cc6638fa61..a0b5da31aab0 100644 --- a/pkgs/development/libraries/xmlsec/default.nix +++ b/pkgs/development/libraries/xmlsec/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchurl, libxml2, gnutls, libxslt, pkgconfig, libgcrypt, libtool -, openssl, nss }: +, openssl, nss, lib, runCommandCC, writeText }: +lib.fix (self: let version = "1.2.28"; in @@ -41,6 +42,28 @@ stdenv.mkDerivation { moveToOutput "lib/xmlsec1Conf.sh" "$dev" ''; + passthru.tests.libxmlsec1-crypto = runCommandCC "libxmlsec1-crypto-test" + { + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ self libxml2 libxslt libtool ]; + } '' + $CC $(pkg-config --cflags --libs xmlsec1) -o crypto-test ${writeText "crypto-test.c" '' + #include + #include + + int main(int argc, char **argv) { + return xmlSecInit() || + xmlSecCryptoDLLoadLibrary(argc > 1 ? argv[1] : 0) || + xmlSecCryptoInit(); + } + ''} + + for crypto in "" gcrypt gnutls nss openssl; do + ./crypto-test $crypto + done + touch $out + ''; + meta = { homepage = http://www.aleksey.com/xmlsec; downloadPage = https://www.aleksey.com/xmlsec/download.html; @@ -50,3 +73,4 @@ stdenv.mkDerivation { updateWalker = true; }; } +)