about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/xmlsec
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-10 07:13:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-12 14:07:16 +0000
commite2698550456abba83c6dcd5d5e5a9990a0b96f8a (patch)
tree79a56f0df3fa55e470d84b4dff6059fbf487ec18 /nixpkgs/pkgs/development/libraries/xmlsec
parent1cdc42df888dc98c347e03bd942ed9825a55bcb3 (diff)
parent84d74ae9c9cbed73274b8e4e00be14688ffc93fe (diff)
downloadnixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.gz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.bz2
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.lz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.xz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.zst
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.zip
Merge commit '84d74ae9c9cbed73274b8e4e00be14688ffc93fe'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/xmlsec')
-rw-r--r--nixpkgs/pkgs/development/libraries/xmlsec/default.nix35
-rw-r--r--nixpkgs/pkgs/development/libraries/xmlsec/lt_dladdsearchdir.patch16
2 files changed, 47 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/development/libraries/xmlsec/default.nix b/nixpkgs/pkgs/development/libraries/xmlsec/default.nix
index 1a18dfce85d5..a1e6afd48b93 100644
--- a/nixpkgs/pkgs/development/libraries/xmlsec/default.nix
+++ b/nixpkgs/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 <xmlsec/xmlsec.h>
+      #include <xmlsec/crypto.h>
+
+      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/nixpkgs/pkgs/development/libraries/xmlsec/lt_dladdsearchdir.patch b/nixpkgs/pkgs/development/libraries/xmlsec/lt_dladdsearchdir.patch
new file mode 100644
index 000000000000..17dedb0d6c81
--- /dev/null
+++ b/nixpkgs/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);