Ludovic Courtès wrote:

> Hi Peter,
> 
> Peter Simons <[email protected]> skribis:
> 
>> it appears that this update broke gnutls, which is in turn required by
>> many other packages.
> 
> The problem is actually unrelated to Guile:
Anyway, I'd like to have guile bindings separate from the main expression to 
avoid unneeded dependencies. Review the attached patch, please.
-- 
Yury G. Kudryashov,
mailto: [email protected]
diff --git a/pkgs/development/libraries/gnutls/2.12.nix b/pkgs/development/libraries/gnutls/2.12.nix
index cbb7275..611c76a 100644
--- a/pkgs/development/libraries/gnutls/2.12.nix
+++ b/pkgs/development/libraries/gnutls/2.12.nix
@@ -1,5 +1,5 @@
 { fetchurl, stdenv, zlib, lzo, libtasn1, nettle
-, guileBindings, guile, pkgconfig }:
+, guileBindings ? false, guile, pkgconfig }:
 
 assert guileBindings -> guile != null;
 
diff --git a/pkgs/development/libraries/gnutls/default.nix b/pkgs/development/libraries/gnutls/default.nix
index 4c0dbb0..5b28db3 100644
--- a/pkgs/development/libraries/gnutls/default.nix
+++ b/pkgs/development/libraries/gnutls/default.nix
@@ -1,29 +1,21 @@
-{ fetchurl, stdenv, xz, zlib, lzo, libtasn1, nettle
-, guileBindings, guile, perl }:
+{ fetchurl, stdenv, xz, zlib, lzo, libtasn1, nettle, guile, perl }:
 
-assert guileBindings -> guile != null;
+let
+version = "3.0.11";
 
-stdenv.mkDerivation rec {
-
-  name = "gnutls-3.0.11";
+gnutls = stdenv.mkDerivation rec {
+  name = "gnutls-${version}";
 
   src = fetchurl {
     url = "mirror://gnu/gnutls/${name}.tar.xz";
     sha256 = "1l8k96hms7891zl43qjd7lngjh23kxdq22l6ahm1ham7fyhhrh9r";
   };
 
-  configurePhase = ''
-    ./configure --prefix="$out"                                 \
-      --disable-dependency-tracking --enable-fast-install       \
-      --without-p11-kit                                         \
-      --with-lzo --with-libtasn1-prefix="${libtasn1}"		\
-      ${if guileBindings
-        then "--enable-guile --with-guile-site-dir=\"$out/share/guile/site\""
-        else ""}
+  configureFlags = ''
+    --without-p11-kit --with-lzo --with-libtasn1-prefix="${libtasn1}"
   '';
 
-  buildInputs = [ zlib lzo ]
-    ++ stdenv.lib.optional guileBindings guile;
+  buildInputs = [ zlib lzo ];
 
   buildNativeInputs = [ xz perl ];
 
@@ -53,4 +45,29 @@ stdenv.mkDerivation rec {
 
     maintainers = [ stdenv.lib.maintainers.ludo ];
   };
+};
+
+guileBindings = stdenv.mkDerivation rec {
+  name = "gnutls-guile-${version}";
+
+  inherit (gnutls) src;
+  inherit gnutls;
+
+  buildInputs = gnutls.buildInputs ++ [ guile ];
+  buildNativeInputs = gnutls.buildNativeInputs ++ [ gnutls ];
+
+  propagatedBuildInputs = [ gnutls ];
+
+  configureFlags = gnutls.configureFlags + " --enable-guile";
+
+  patchPhase =
+    ''
+      sed -e 's/^SUBDIRS *=.*/SUBDIRS = gl guile/' -i Makefile.in
+      sed -e 's,^GNUTLS_CORE_LIBS *=.*,GNUTLS_CORE_LIBS = ${gnutls}/lib/libgnutls.la,' -i guile/src/Makefile.in
+    '';
+};
+in
+
+gnutls // {
+  inherit guileBindings;
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1b44d04..97d0a44 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3671,13 +3671,9 @@ let
 
   gnet = callPackage ../development/libraries/gnet { };
 
-  gnutls = callPackage ../development/libraries/gnutls {
-    guileBindings = getConfig ["gnutls" "guile"] true;
-  };
+  gnutls = callPackage ../development/libraries/gnutls { };
 
-  gnutls2 = callPackage ../development/libraries/gnutls/2.12.nix {
-    guileBindings = getConfig ["gnutls" "guile"] true;
-  };
+  gnutls2 = callPackage ../development/libraries/gnutls/2.12.nix { };
 
   gpgme = callPackage ../development/libraries/gpgme { };
 

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to