summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2008-05-27 07:49:55 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2008-05-27 07:49:55 +0000
commite21b6b6ee58077b235b998f85c6c9122c52dd465 (patch)
tree017bab49bb3fc85e1583564984cd064bbb209eae
parent2ead4b20b52445ec3560c3d530e820ce5a05204a (diff)
downloadnixpkgs-e21b6b6ee58077b235b998f85c6c9122c52dd465.tar
nixpkgs-e21b6b6ee58077b235b998f85c6c9122c52dd465.tar.gz
nixpkgs-e21b6b6ee58077b235b998f85c6c9122c52dd465.tar.bz2
nixpkgs-e21b6b6ee58077b235b998f85c6c9122c52dd465.tar.lz
nixpkgs-e21b6b6ee58077b235b998f85c6c9122c52dd465.tar.xz
nixpkgs-e21b6b6ee58077b235b998f85c6c9122c52dd465.tar.zst
nixpkgs-e21b6b6ee58077b235b998f85c6c9122c52dd465.zip
* curl: build with OpenSSL (https) support by default.
* Some fetchurl-related refactoring.  The `realCurl' attribute is
  gone, `curl' is the real thing.  To prevent an infinite recursion in
  `fetchurl' (because it depends on curl and building curl needs
  fetchurl), curl and its dependencies (openssl, zlib, perl) use
  `fetchurlBoot', which is the fetchurl used by the previous bootstrap
  phase (e.g. the statically linked version of curl for
  stdenv-linux).  So as a result you can use https:// urls almost
  everywhere.

  There's also some hackery to prevent a different curl from being
  built in every stdenv-linux bootstrap phase (namely the
  stdenv.fetchurl attribute which allows fetchurl to be overriden
  everywhere).

svn path=/nixpkgs/trunk/; revision=11905
-rw-r--r--pkgs/stdenv/cygwin/default.nix3
-rw-r--r--pkgs/stdenv/freebsd/default.nix3
-rw-r--r--pkgs/stdenv/generic/default.nix3
-rw-r--r--pkgs/stdenv/linux/default.nix20
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix4
-rw-r--r--pkgs/stdenv/nix/default.nix5
-rw-r--r--pkgs/stdenv/powerpc-darwin/default.nix3
-rw-r--r--pkgs/tools/networking/curl/default.nix9
-rw-r--r--pkgs/top-level/all-packages.nix35
-rw-r--r--pkgs/top-level/build-for-release.nix2
10 files changed, 58 insertions, 29 deletions
diff --git a/pkgs/stdenv/cygwin/default.nix b/pkgs/stdenv/cygwin/default.nix
index 22e223ca6cc..b1ca853c612 100644
--- a/pkgs/stdenv/cygwin/default.nix
+++ b/pkgs/stdenv/cygwin/default.nix
@@ -17,7 +17,8 @@ genericStdenv {
 
   shell = "/bin/bash";
 
-  extraAttrs = {
+  fetchurlBoot = import ../../build-support/fetchurl {
+    inherit stdenv;
     # Curl should be in /usr/bin or so.
     curl = null;
   };
diff --git a/pkgs/stdenv/freebsd/default.nix b/pkgs/stdenv/freebsd/default.nix
index 22e223ca6cc..b1ca853c612 100644
--- a/pkgs/stdenv/freebsd/default.nix
+++ b/pkgs/stdenv/freebsd/default.nix
@@ -17,7 +17,8 @@ genericStdenv {
 
   shell = "/bin/bash";
 
-  extraAttrs = {
+  fetchurlBoot = import ../../build-support/fetchurl {
+    inherit stdenv;
     # Curl should be in /usr/bin or so.
     curl = null;
   };
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 48cff5825cb..048bc179e2d 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -1,6 +1,7 @@
 { stdenv, name, preHook ? null, postHook ? null, initialPath, gcc, shell
 , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
 , extraAttrs ? {}
+, fetchurlBoot
 }:
 
 let {
@@ -71,6 +72,8 @@ let {
         # packages don't have to do that themselves.
         lib = import ../../lib;
 
+        inherit fetchurlBoot;
+
       }
 
       # Propagate any extra attributes.  For instance, we use this to
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 6a183457f08..8f237ec6062 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -99,8 +99,13 @@ rec {
   # the bootstrap.
   stdenvBootFun =
     {gcc, staticGlibc, extraAttrs ? {}}:
-    
-    import ../generic {
+
+    let
+      fetchurlBoot = import ../../build-support/fetchurl {
+        stdenv = stdenvInitial;
+        inherit curl;
+      };
+    in import ../generic {
       name = "stdenv-linux-boot";
       param1 = if staticGlibc then "static" else "dynamic";
       preHook = ./scripts/prehook.sh;
@@ -109,7 +114,9 @@ rec {
       initialPath = [
         staticTools
       ];
-      inherit gcc extraAttrs;
+      inherit fetchurlBoot;
+      extraAttrs = extraAttrs // {fetchurl = fetchurlBoot;};
+      inherit gcc;
     };
 
 
@@ -120,7 +127,6 @@ rec {
     # Use the statically linked, downloaded glibc/gcc/binutils.
     gcc = wrapGCC {libc = staticGlibc; binutils = staticBinutils;};
     staticGlibc = true;
-    extraAttrs = {inherit curl;};
   };
   
 
@@ -143,7 +149,7 @@ rec {
   stdenvLinuxBoot2 = removeAttrs (stdenvBootFun {
     staticGlibc = false;
     gcc = wrapGCC {binutils = staticBinutils; libc = stdenvLinuxGlibc;};
-    extraAttrs = {inherit curl; glibc = stdenvLinuxGlibc;};
+    extraAttrs = {glibc = stdenvLinuxGlibc;};
   }) ["gcc" "binutils"];
 
   
@@ -164,7 +170,6 @@ rec {
       libc = stdenvLinuxGlibc;
       gcc = stdenvLinuxBoot2Pkgs.gcc.gcc;
     };
-    extraAttrs = {inherit curl;};
   };
 
   
@@ -197,8 +202,9 @@ rec {
 
     shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
     
+    fetchurlBoot = stdenvLinuxBoot3.fetchurlBoot;
+    
     extraAttrs = {
-      curl = stdenvLinuxBoot3Pkgs.realCurl;
       inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc;
       inherit (stdenvLinuxBoot3Pkgs)
         gzip bzip2 bash coreutils diffutils findutils gawk
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index 6358855464b..71aa638378c 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -28,7 +28,7 @@ let
 
     inherit (pkgsDiet)
       coreutils diffutils gnugrep
-      gzip bzip2 gnumake bash patch binutils;
+      gzip bzip2 gnumake bash patch binutils curl;
 
     findutils = pkgsDiet.findutils4227; # 4.2.28 is broken
       
@@ -58,8 +58,6 @@ let
       profiledCompiler = true;
     };
   
-    curl = pkgsDiet.realCurl;
-
     glibc = pkgs.glibc;
 
     # The result should not contain any references (store paths) so
diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix
index 227cb876a97..fb7d29323ee 100644
--- a/pkgs/stdenv/nix/default.nix
+++ b/pkgs/stdenv/nix/default.nix
@@ -22,7 +22,8 @@ import ../generic {
 
   shell = pkgs.bash + "/bin/sh";
 
-  extraAttrs = {
-    curl = pkgs.realCurl;
+  fetchurlBoot = import ../../build-support/fetchurl {
+    inherit stdenv;
+    curl = pkgs.curl;
   };
 }
diff --git a/pkgs/stdenv/powerpc-darwin/default.nix b/pkgs/stdenv/powerpc-darwin/default.nix
index 1fd45bddfc3..2c94234c0c2 100644
--- a/pkgs/stdenv/powerpc-darwin/default.nix
+++ b/pkgs/stdenv/powerpc-darwin/default.nix
@@ -17,7 +17,8 @@ genericStdenv {
 
   shell = "/bin/sh";
 
-  extraAttrs = {
+  fetchurlBoot = import ../../build-support/fetchurl {
+    inherit stdenv;
     # Curl should be in /usr/bin or so.
     curl = null;
   };
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index 7f3488b2f35..85a9ab957d6 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -18,7 +18,14 @@ stdenv.mkDerivation {
   CFLAGS = if stdenv ? isDietLibC then "-DHAVE_INET_NTOA_R_2_ARGS=1" else "";
   CXX = "g++";
   CXXCPP = "g++ -E";
-  inherit sslSupport openssl;
+
+  passthru = {
+    inherit sslSupport openssl;
+  };
+
+  preConfigure = ''
+    substituteInPlace configure --replace /usr/bin /no-such-path
+  '';
 
   patches = [
     /* Fixes broken retry support when a timeout is used.  The
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c3a504a575e..9c1dfcf877c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -357,13 +357,22 @@ let pkgs = rec {
     inherit stdenv mercurial nix;
   };
 
-  # Allow the stdenv to determine fetchurl, to cater for strange
-  # requirements.
+  # `fetchurl' downloads a file from the network.  The `useFromStdenv'
+  # is there to allow stdenv to determine fetchurl.  Used during the
+  # stdenv-linux bootstrap phases to prevent lots of different curls
+  # from being built.
   fetchurl = useFromStdenv "fetchurl"
     (import ../build-support/fetchurl {
       inherit stdenv curl;
     });
 
+  # fetchurlBoot is used for curl and its dependencies in order to
+  # prevent a cyclic dependency (curl depends on curl.tar.bz2,
+  # curl.tar.bz2 depends on fetchurl, fetchurl depends on curl).  It
+  # uses the curl from the previous bootstrap phase (e.g. a statically
+  # linked curl in the case of stdenv-linux).
+  fetchurlBoot = stdenv.fetchurlBoot;
+
   makeInitrd = {contents}: import ../build-support/kernel/make-initrd.nix {
     inherit stdenv perl cpio contents;
   };
@@ -516,7 +525,12 @@ let pkgs = rec {
     inherit fetchurl stdenv;
   };
 
-  curl = if stdenv ? curl then (stdenv.curl) else (assert false; null);
+  curl = import ../tools/networking/curl {
+    fetchurl = fetchurlBoot;
+    inherit stdenv zlib openssl;
+    zlibSupport = !stdenv ? isDietLibC;
+    sslSupport = !stdenv ? isDietLibC;
+  };
 
   curlftpfs = import ../tools/networking/curlftpfs {
     inherit fetchurl stdenv fuse curl pkgconfig zlib;
@@ -927,12 +941,6 @@ let pkgs = rec {
     inherit (xlibs) libX11 libXext;
   };
 
-  realCurlFun = lib.sumArgs (import ../tools/networking/curl) {
-    inherit fetchurl stdenv zlib;
-    zlibSupport = !stdenv ? isDietLibC;
-  };
-  realCurl = realCurlFun null;
-
   relfsFun = lib.sumArgs (selectVersion ../tools/misc/relfs "cvs.2008.03.05") {
     inherit fetchcvs stdenv ocaml postgresql fuse pcre
       builderDefs e2fsprogs pkgconfig;
@@ -1856,7 +1864,8 @@ let pkgs = rec {
   Qi = QiFun null;
 
   realPerl = import ../development/interpreters/perl-5.10 {
-    inherit fetchurl stdenv;
+    fetchurl = fetchurlBoot;
+    inherit stdenv;
   };
 
   ruby = import ../development/interpreters/ruby {
@@ -3129,7 +3138,8 @@ let pkgs = rec {
   };
 
   openssl = import ../development/libraries/openssl {
-    inherit fetchurl stdenv perl;
+    fetchurl = fetchurlBoot;
+    inherit stdenv perl;
   };
 
   ortp = selectVersion ../development/libraries/ortp "0.13.1" {
@@ -3328,7 +3338,8 @@ let pkgs = rec {
   };
 
   zlib = import ../development/libraries/zlib {
-    inherit fetchurl stdenv;
+    fetchurl = fetchurlBoot;
+    inherit stdenv;
   };
 
   zlibStatic = lowPrio (appendToName "static" (import ../development/libraries/zlib {
diff --git a/pkgs/top-level/build-for-release.nix b/pkgs/top-level/build-for-release.nix
index 6db95982502..cdf9ac39890 100644
--- a/pkgs/top-level/build-for-release.nix
+++ b/pkgs/top-level/build-for-release.nix
@@ -247,6 +247,7 @@ let
     aterm
     autoconf
     #automake19x
+    curl
     docbook5
     docbook_xml_dtd_42
     docbook_xml_dtd_43
@@ -256,7 +257,6 @@ let
     libxml2
     libxslt
     nxml
-    realCurl
     subversion
     unzip
   ;};