about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gnutls
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gnutls')
-rw-r--r--nixpkgs/pkgs/development/libraries/gnutls/3.5.10.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/gnutls/3.6.nix22
-rw-r--r--nixpkgs/pkgs/development/libraries/gnutls/generic.nix91
3 files changed, 123 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gnutls/3.5.10.nix b/nixpkgs/pkgs/development/libraries/gnutls/3.5.10.nix
new file mode 100644
index 000000000000..a44e2b04ed71
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnutls/3.5.10.nix
@@ -0,0 +1,10 @@
+{ callPackage, fetchurl, libunistring, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "3.5.10";
+
+  src = fetchurl {
+    url = "mirror://gnupg/gnutls/v3.5/gnutls-${version}.tar.xz";
+    sha256 = "17apwvdkkazh5w8z8mbanpj2yj8s2002qwy46wz4v3akpa33wi5g";
+  };
+})
diff --git a/nixpkgs/pkgs/development/libraries/gnutls/3.6.nix b/nixpkgs/pkgs/development/libraries/gnutls/3.6.nix
new file mode 100644
index 000000000000..513f20fd835a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnutls/3.6.nix
@@ -0,0 +1,22 @@
+{ callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "3.6.6";
+
+  src = fetchurl {
+    url = "mirror://gnupg/gnutls/v3.6/gnutls-${version}.tar.xz";
+    sha256 = "19rcfgsfxb01cyz8jxmmgkjqc7y5s97amajzyknk1i1amywcm6mv";
+  };
+
+  # 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
+  postPatch = ''
+    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
+  '';
+})
diff --git a/nixpkgs/pkgs/development/libraries/gnutls/generic.nix b/nixpkgs/pkgs/development/libraries/gnutls/generic.nix
new file mode 100644
index 000000000000..086c0560cc44
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gnutls/generic.nix
@@ -0,0 +1,91 @@
+{ config, lib, stdenv, zlib, lzo, libtasn1, nettle, pkgconfig, lzip
+, perl, gmp, autogen, libidn, p11-kit, libiconv
+, guileBindings ? config.gnutls.guile or false, guile
+, tpmSupport ? false, trousers, which, nettools, libunistring
+, unbound, dns-root-data, gettext
+
+# Version dependent args
+, version, src, patches ? [], postPatch ? "", nativeBuildInputs ? []
+, buildInputs ? []
+, ...}:
+
+assert guileBindings -> guile != null;
+let
+  # XXX: Gnulib's `test-select' fails on FreeBSD:
+  # http://hydra.nixos.org/build/2962084/nixlog/1/raw .
+  doCheck = !stdenv.isFreeBSD && !stdenv.isDarwin && lib.versionAtLeast version "3.4"
+      && stdenv.buildPlatform == stdenv.hostPlatform;
+in
+stdenv.mkDerivation {
+  name = "gnutls-${version}";
+
+  inherit src patches;
+
+  outputs = [ "bin" "dev" "out" "man" "devdoc" ];
+  outputInfo = "devdoc";
+
+  postPatch = lib.optionalString (lib.versionAtLeast version "3.4") ''
+    sed '2iecho "name constraints tests skipped due to datefudge problems"\nexit 0' \
+      -i tests/cert-tests/name-constraints
+  '' + postPatch;
+
+  preConfigure = "patchShebangs .";
+  configureFlags =
+    lib.optional stdenv.isLinux "--with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt"
+  ++ [
+    "--disable-dependency-tracking"
+    "--enable-fast-install"
+    "--with-unbound-root-key-file=${dns-root-data}/root.key"
+  ] ++ lib.optional guileBindings
+    [ "--enable-guile" "--with-guile-site-dir=\${out}/share/guile/site" ];
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ lzo lzip libtasn1 libidn p11-kit zlib gmp autogen libunistring unbound gettext libiconv ]
+    ++ lib.optional (tpmSupport && stdenv.isLinux) trousers
+    ++ lib.optional guileBindings guile
+    ++ buildInputs;
+
+  nativeBuildInputs = [ perl pkgconfig ] ++ nativeBuildInputs
+    ++ lib.optionals doCheck [ which nettools ];
+
+  propagatedBuildInputs = [ nettle ];
+
+  inherit doCheck;
+
+  # Fixup broken libtool and pkgconfig files
+  preFixup = lib.optionalString (!stdenv.isDarwin) ''
+    sed ${lib.optionalString tpmSupport "-e 's,-ltspi,-L${trousers}/lib -ltspi,'"} \
+        -e 's,-lz,-L${zlib.out}/lib -lz,' \
+        -e 's,-L${gmp.dev}/lib,-L${gmp.out}/lib,' \
+        -e 's,-lgmp,-L${gmp.out}/lib -lgmp,' \
+        -i $out/lib/*.la "$dev/lib/pkgconfig/gnutls.pc"
+  '' + ''
+    # It seems only useful for static linking but basically noone does that.
+    substituteInPlace "$out/lib/libgnutls.la" \
+      --replace "-lunistring" ""
+  '';
+
+  meta = with lib; {
+    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."
+    '';
+
+    homepage = https://www.gnu.org/software/gnutls/;
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ eelco fpletz ];
+    platforms = platforms.all;
+  };
+}