2019-03-31 10:59:16 +01:00
|
|
|
{ config, lib, stdenv, fetchurl, zlib, lzo, libtasn1, nettle, pkgconfig, lzip
|
|
|
|
, perl, gmp, autoconf, autogen, automake, libidn, p11-kit, libiconv
|
2019-10-08 17:39:36 +01:00
|
|
|
, unbound, dns-root-data, gettext, cacert, utillinux
|
2019-02-03 15:33:26 +00:00
|
|
|
, guileBindings ? config.gnutls.guile or false, guile
|
2017-03-13 09:28:53 +00:00
|
|
|
, tpmSupport ? false, trousers, which, nettools, libunistring
|
2019-03-31 10:59:16 +01:00
|
|
|
, withSecurity ? false, Security # darwin Security.framework
|
|
|
|
}:
|
2015-04-04 03:16:33 +01:00
|
|
|
|
|
|
|
assert guileBindings -> guile != null;
|
2016-07-09 14:15:42 +01:00
|
|
|
let
|
2019-12-03 14:27:22 +00:00
|
|
|
version = "3.6.11.1";
|
2019-03-31 10:59:16 +01:00
|
|
|
|
2016-07-09 14:15:42 +01:00
|
|
|
# XXX: Gnulib's `test-select' fails on FreeBSD:
|
|
|
|
# http://hydra.nixos.org/build/2962084/nixlog/1/raw .
|
2017-10-27 02:53:57 +01:00
|
|
|
doCheck = !stdenv.isFreeBSD && !stdenv.isDarwin && lib.versionAtLeast version "3.4"
|
|
|
|
&& stdenv.buildPlatform == stdenv.hostPlatform;
|
2019-03-31 10:59:16 +01:00
|
|
|
|
|
|
|
inherit (stdenv.hostPlatform) isDarwin;
|
2016-07-09 14:15:42 +01:00
|
|
|
in
|
2019-03-31 10:59:16 +01:00
|
|
|
|
2016-07-09 14:15:42 +01:00
|
|
|
stdenv.mkDerivation {
|
2015-04-04 03:16:33 +01:00
|
|
|
name = "gnutls-${version}";
|
2019-03-31 10:59:16 +01:00
|
|
|
inherit version;
|
2015-04-04 03:16:33 +01:00
|
|
|
|
2019-03-31 10:59:16 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnupg/gnutls/v3.6/gnutls-${version}.tar.xz";
|
2019-12-03 14:27:22 +00:00
|
|
|
sha256 = "1y1wadpsrj5ai603xv5bgssl9v0pb1si2hg14zqdnmcsvgri5fpv";
|
2019-03-31 10:59:16 +01:00
|
|
|
};
|
2015-04-04 03:16:33 +01:00
|
|
|
|
2016-09-01 10:07:23 +01:00
|
|
|
outputs = [ "bin" "dev" "out" "man" "devdoc" ];
|
|
|
|
outputInfo = "devdoc";
|
2015-07-26 23:25:53 +01:00
|
|
|
|
2019-04-22 09:49:11 +01:00
|
|
|
patches = [ ./nix-ssl-cert-file.patch ]
|
|
|
|
# Disable native add_system_trust.
|
|
|
|
++ lib.optional (isDarwin && !withSecurity) ./no-security-framework.patch;
|
2019-03-31 10:59:16 +01:00
|
|
|
|
|
|
|
# Skip some tests:
|
|
|
|
# - pkgconfig: building against the result won't work before installing (3.5.11)
|
|
|
|
# - fastopen: no idea; it broke between 3.6.2 and 3.6.3 (3437fdde6 in particular)
|
|
|
|
# - trust-store: default trust store path (/etc/ssl/...) is missing in sandbox (3.5.11)
|
|
|
|
# - psk-file: no idea; it broke between 3.6.3 and 3.6.4
|
|
|
|
# Change p11-kit test to use pkg-config to find p11-kit
|
2016-07-30 11:29:18 +01:00
|
|
|
postPatch = lib.optionalString (lib.versionAtLeast version "3.4") ''
|
2019-03-31 10:59:16 +01:00
|
|
|
sed '2iecho "name constraints tests skipped due to datefudge problems"\nexit 0' -i tests/cert-tests/name-constraints
|
|
|
|
'' + lib.optionalString (lib.versionAtLeast version "3.6") ''
|
|
|
|
sed '2iexit 77' -i tests/{pkgconfig,fastopen}.sh
|
|
|
|
sed '/^void doit(void)/,/^{/ s/{/{ exit(77);/' -i tests/{trust-store,psk-file}.c
|
|
|
|
sed 's:/usr/lib64/pkcs11/ /usr/lib/pkcs11/ /usr/lib/x86_64-linux-gnu/pkcs11/:`pkg-config --variable=p11_module_path p11-kit-1`:' -i tests/p11-kit-trust.sh
|
|
|
|
'';
|
2016-06-30 10:06:34 +01:00
|
|
|
|
|
|
|
preConfigure = "patchShebangs .";
|
2015-06-11 08:02:56 +01:00
|
|
|
configureFlags =
|
2015-07-26 11:37:57 +01:00
|
|
|
lib.optional stdenv.isLinux "--with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt"
|
2015-06-11 08:02:56 +01:00
|
|
|
++ [
|
2015-04-19 08:49:15 +01:00
|
|
|
"--disable-dependency-tracking"
|
|
|
|
"--enable-fast-install"
|
2017-06-16 04:11:56 +01:00
|
|
|
"--with-unbound-root-key-file=${dns-root-data}/root.key"
|
2015-07-26 11:37:57 +01:00
|
|
|
] ++ lib.optional guileBindings
|
2015-04-19 08:49:15 +01:00
|
|
|
[ "--enable-guile" "--with-guile-site-dir=\${out}/share/guile/site" ];
|
2015-04-04 03:16:33 +01:00
|
|
|
|
2016-10-24 19:22:52 +01:00
|
|
|
enableParallelBuilding = true;
|
2015-04-04 03:16:33 +01:00
|
|
|
|
2018-03-14 22:58:20 +00:00
|
|
|
buildInputs = [ lzo lzip libtasn1 libidn p11-kit zlib gmp autogen libunistring unbound gettext libiconv ]
|
2019-03-31 10:59:16 +01:00
|
|
|
++ lib.optional (isDarwin && withSecurity) Security
|
2015-07-26 11:37:57 +01:00
|
|
|
++ lib.optional (tpmSupport && stdenv.isLinux) trousers
|
2019-03-31 10:59:16 +01:00
|
|
|
++ lib.optional guileBindings guile;
|
2015-04-04 03:16:33 +01:00
|
|
|
|
2019-03-31 10:59:16 +01:00
|
|
|
nativeBuildInputs = [ perl pkgconfig ]
|
|
|
|
++ lib.optionals (isDarwin && !withSecurity) [ autoconf automake ]
|
2019-10-08 17:39:36 +01:00
|
|
|
++ lib.optionals doCheck [ which nettools utillinux ];
|
2015-04-04 03:16:33 +01:00
|
|
|
|
2017-02-05 12:37:16 +00:00
|
|
|
propagatedBuildInputs = [ nettle ];
|
|
|
|
|
2016-07-09 14:15:42 +01:00
|
|
|
inherit doCheck;
|
2019-05-19 13:45:52 +01:00
|
|
|
# stdenv's `NIX_SSL_CERT_FILE=/no-cert-file.crt` broke tests with:
|
|
|
|
# Error setting the x509 trust file: Error while reading file.
|
|
|
|
checkInputs = [ cacert ];
|
2015-04-04 03:16:33 +01:00
|
|
|
|
2015-04-25 10:36:38 +01:00
|
|
|
# Fixup broken libtool and pkgconfig files
|
2019-03-31 10:59:16 +01:00
|
|
|
preFixup = lib.optionalString (!isDarwin) ''
|
2015-07-26 11:37:57 +01:00
|
|
|
sed ${lib.optionalString tpmSupport "-e 's,-ltspi,-L${trousers}/lib -ltspi,'"} \
|
2015-04-27 12:18:16 +01:00
|
|
|
-e 's,-lz,-L${zlib.out}/lib -lz,' \
|
2015-10-15 16:43:23 +01:00
|
|
|
-e 's,-L${gmp.dev}/lib,-L${gmp.out}/lib,' \
|
2015-10-17 21:53:54 +01:00
|
|
|
-e 's,-lgmp,-L${gmp.out}/lib -lgmp,' \
|
|
|
|
-i $out/lib/*.la "$dev/lib/pkgconfig/gnutls.pc"
|
2017-02-22 16:44:06 +00:00
|
|
|
'' + ''
|
2017-02-20 22:17:10 +00:00
|
|
|
# It seems only useful for static linking but basically noone does that.
|
|
|
|
substituteInPlace "$out/lib/libgnutls.la" \
|
|
|
|
--replace "-lunistring" ""
|
2015-04-25 10:36:38 +01:00
|
|
|
'';
|
|
|
|
|
2015-07-26 11:37:57 +01:00
|
|
|
meta = with lib; {
|
2015-04-04 03:16:33 +01:00
|
|
|
description = "The GNU Transport Layer Security Library";
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
GnuTLS is a project that aims to develop a library which
|
|
|
|
provides a secure layer, over a reliable transport
|
|
|
|
layer. Currently the GnuTLS library implements the proposed standards by
|
|
|
|
the IETF's TLS working group.
|
|
|
|
|
|
|
|
Quoting from the TLS protocol specification:
|
|
|
|
|
|
|
|
"The TLS protocol provides communications privacy over the
|
|
|
|
Internet. The protocol allows client/server applications to
|
|
|
|
communicate in a way that is designed to prevent eavesdropping,
|
|
|
|
tampering, or message forgery."
|
|
|
|
'';
|
|
|
|
|
2018-12-01 18:22:13 +00:00
|
|
|
homepage = https://www.gnu.org/software/gnutls/;
|
2015-04-04 03:16:33 +01:00
|
|
|
license = licenses.lgpl21Plus;
|
2019-01-26 10:01:09 +00:00
|
|
|
maintainers = with maintainers; [ eelco fpletz ];
|
2015-04-04 03:16:33 +01:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|