nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 21.11 79 lines 2.3 kB view raw
1{ stdenv, fetchurl, libxml2, gnutls, libxslt, pkg-config, libgcrypt, libtool 2, openssl, nss, lib, runCommandCC, writeText }: 3 4lib.fix (self: 5stdenv.mkDerivation rec { 6 pname = "xmlsec"; 7 version = "1.2.33"; 8 9 src = fetchurl { 10 url = "https://www.aleksey.com/xmlsec/download/xmlsec1-${version}.tar.gz"; 11 sha256 = "sha256-JgQdNaIKJF7Vovue4HXxCCVmTSdCIMtRkDQPqHpNCTE="; 12 }; 13 14 patches = [ 15 ./lt_dladdsearchdir.patch 16 ] ++ lib.optionals stdenv.isDarwin [ ./remove_bsd_base64_decode_flag.patch ]; 17 postPatch = '' 18 substituteAllInPlace src/dl.c 19 ''; 20 21 outputs = [ "out" "dev" ]; 22 23 nativeBuildInputs = [ pkg-config ]; 24 25 buildInputs = [ libxml2 gnutls libxslt libgcrypt libtool openssl nss ]; 26 27 enableParallelBuilding = true; 28 doCheck = true; 29 checkInputs = [ nss.tools ]; 30 preCheck = '' 31 substituteInPlace tests/testrun.sh \ 32 --replace 'timestamp=`date +%Y%m%d_%H%M%S`' 'timestamp=19700101_000000' \ 33 --replace 'TMPFOLDER=/tmp' '$(mktemp -d)' 34 ''; 35 36 # enable deprecated soap headers required by lasso 37 # https://dev.entrouvert.org/issues/18771 38 configureFlags = [ "--enable-soap" ]; 39 40 # otherwise libxmlsec1-gnutls.so won't find libgcrypt.so, after #909 41 NIX_LDFLAGS = "-lgcrypt"; 42 43 postInstall = '' 44 moveToOutput "bin/xmlsec1-config" "$dev" 45 moveToOutput "lib/xmlsec1Conf.sh" "$dev" 46 ''; 47 48 passthru.tests.libxmlsec1-crypto = runCommandCC "libxmlsec1-crypto-test" 49 { 50 nativeBuildInputs = [ pkg-config ]; 51 buildInputs = [ self libxml2 libxslt libtool ]; 52 } '' 53 $CC $(pkg-config --cflags --libs xmlsec1) -o crypto-test ${writeText "crypto-test.c" '' 54 #include <xmlsec/xmlsec.h> 55 #include <xmlsec/crypto.h> 56 57 int main(int argc, char **argv) { 58 return xmlSecInit() || 59 xmlSecCryptoDLLoadLibrary(argc > 1 ? argv[1] : 0) || 60 xmlSecCryptoInit(); 61 } 62 ''} 63 64 for crypto in "" gcrypt gnutls nss openssl; do 65 ./crypto-test $crypto 66 done 67 touch $out 68 ''; 69 70 meta = { 71 homepage = "http://www.aleksey.com/xmlsec"; 72 downloadPage = "https://www.aleksey.com/xmlsec/download.html"; 73 description = "XML Security Library in C based on libxml2"; 74 license = lib.licenses.mit; 75 platforms = with lib.platforms; linux ++ darwin; 76 updateWalker = true; 77 }; 78} 79)