diff --git a/pkgs/development/libraries/xmlsec/default.nix b/pkgs/development/libraries/xmlsec/default.nix index 1a18dfce85d5..a1e6afd48b93 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, makeWrapper }: +, openssl, nss, lib, runCommandCC, writeText }: +lib.fix (self: let version = "1.2.28"; in @@ -13,9 +14,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,8 +42,26 @@ stdenv.mkDerivation { moveToOutput "lib/xmlsec1Conf.sh" "$dev" ''; - postFixup = '' - wrapProgram "$out/bin/xmlsec1" --prefix LD_LIBRARY_PATH ":" "$out/lib" + 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 = { @@ -47,3 +73,4 @@ stdenv.mkDerivation { updateWalker = true; }; } +) 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);