2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, fetchurl, libxml2, gnutls, libxslt, pkgconfig, libgcrypt, libtool
|
2020-11-21 19:51:51 +00:00
|
|
|
# nss_3_53 is used instead of the latest due to a number of issues:
|
|
|
|
# https://github.com/lsh123/xmlsec/issues?q=is%3Aissue+is%3Aopen+nss
|
|
|
|
, openssl, nss_3_53, lib, runCommandCC, writeText }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
lib.fix (self:
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
2020-11-21 19:51:51 +00:00
|
|
|
version = "1.2.31";
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "xmlsec";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.aleksey.com/xmlsec/download/xmlsec1-${version}.tar.gz";
|
2020-11-21 19:51:51 +00:00
|
|
|
sha256 = "mxC8Uswx5PdhYuOXXlDbJrcatJxXHYELMRymJr5aCyY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
patches = [
|
|
|
|
./lt_dladdsearchdir.patch
|
2020-11-03 02:18:15 +00:00
|
|
|
] ++ stdenv.lib.optionals stdenv.isDarwin [ ./remove_bsd_base64_decode_flag.patch ];
|
2020-08-20 17:08:02 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteAllInPlace src/dl.c
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-21 19:51:51 +00:00
|
|
|
buildInputs = [ libxml2 gnutls libxslt libgcrypt libtool openssl nss_3_53 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
doCheck = true;
|
2020-11-21 19:51:51 +00:00
|
|
|
checkInputs = [ nss_3_53.tools ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# enable deprecated soap headers required by lasso
|
|
|
|
# https://dev.entrouvert.org/issues/18771
|
|
|
|
configureFlags = [ "--enable-soap" ];
|
|
|
|
|
|
|
|
# otherwise libxmlsec1-gnutls.so won't find libgcrypt.so, after #909
|
|
|
|
NIX_LDFLAGS = "-lgcrypt";
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
moveToOutput "bin/xmlsec1-config" "$dev"
|
|
|
|
moveToOutput "lib/xmlsec1Conf.sh" "$dev"
|
|
|
|
'';
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
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
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "http://www.aleksey.com/xmlsec";
|
|
|
|
downloadPage = "https://www.aleksey.com/xmlsec/download.html";
|
|
|
|
description = "XML Security Library in C based on libxml2";
|
|
|
|
license = stdenv.lib.licenses.mit;
|
|
|
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
|
|
|
updateWalker = true;
|
|
|
|
};
|
|
|
|
}
|
2020-08-20 17:08:02 +00:00
|
|
|
)
|