summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-02 11:32:28 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-04 14:54:52 +0200
commitcde5053d9a9affc2c60b7446f5d091296d8fa139 (patch)
tree2d53be2769610b7411f84ac816eeaec0b3ac3d7e /pkgs
parent68493cd8dc25a1e2e4d1007305a39cc710855d86 (diff)
downloadnixlib-cde5053d9a9affc2c60b7446f5d091296d8fa139.tar
nixlib-cde5053d9a9affc2c60b7446f5d091296d8fa139.tar.gz
nixlib-cde5053d9a9affc2c60b7446f5d091296d8fa139.tar.bz2
nixlib-cde5053d9a9affc2c60b7446f5d091296d8fa139.tar.lz
nixlib-cde5053d9a9affc2c60b7446f5d091296d8fa139.tar.xz
nixlib-cde5053d9a9affc2c60b7446f5d091296d8fa139.tar.zst
nixlib-cde5053d9a9affc2c60b7446f5d091296d8fa139.zip
Revert "curl: Modernize build"
This reverts commit 5e3fe3916a1aef6c2b441d9009f8a8d7f14030d6.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools-cross.nix10
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix10
-rw-r--r--pkgs/tools/networking/curl/default.nix172
-rw-r--r--pkgs/top-level/all-packages.nix14
4 files changed, 85 insertions, 121 deletions
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
index 520bdd208e36..bf060329be6d 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
@@ -92,7 +92,11 @@ rec {
     aclSupport = false;
   })).crossDrv;
   
-  curl-light = pkgs.curl-light.crossDrv;
+  curlMinimal = (pkgs.curl.override {
+    zlibSupport = false;
+    sslSupport = false;
+    scpSupport = false;
+  }).crossDrv;
   
   busyboxMinimal = (pkgs.busybox.override {
     # TBD: uClibc is broken.
@@ -166,8 +170,8 @@ rec {
         cp -d ${gnumake}/bin/* $out/bin
         cp -d ${patch}/bin/* $out/bin
         cp ${patchelf}/bin/* $out/bin
-        cp ${curl-light}/bin/curl $out/bin
-        cp -d ${curl-light}/lib/libcurl* $out/lib
+        cp ${curlMinimal}/bin/curl $out/bin
+        cp -d ${curlMinimal}/lib/libcurl* $out/lib
 
         cp -d ${gnugrep.pcre.crossDrv}/lib/libpcre*.so* $out/lib # needed by grep
         
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index 6bd67d8c7a01..a995606886f3 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -10,6 +10,12 @@ rec {
     aclSupport = false;
   });
 
+  curlMinimal = curl.override {
+    zlibSupport = false;
+    sslSupport = false;
+    scpSupport = false;
+  };
+
   busyboxMinimal = busybox.override {
     useMusl = true;
     enableStatic = true;
@@ -77,8 +83,8 @@ rec {
         cp -d ${gnumake}/bin/* $out/bin
         cp -d ${patch}/bin/* $out/bin
         cp ${patchelf}/bin/* $out/bin
-        cp ${curl-light}/bin/curl $out/bin
-        cp -d ${curl-light}/lib/libcurl* $out/lib
+        cp ${curlMinimal}/bin/curl $out/bin
+        cp -d ${curlMinimal}/lib/libcurl* $out/lib
 
         cp -d ${gnugrep.pcre}/lib/libpcre*.so* $out/lib # needed by grep
 
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index f8b3ad9355ad..28f28c9a4f93 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -1,133 +1,81 @@
-{ stdenv, fetchurl, pkgconfig
-
-# Optional Dependencies
-, zlib ? null, openssl ? null, libssh2 ? null, libnghttp2 ? null, c-ares ? null
-, gss ? null, rtmpdump ? null, openldap ? null, libidn ? null
-
-# Extra arguments
-, suffix ? ""
+{ stdenv, fetchurl
+, idnSupport ? false, libidn ? null
+, ldapSupport ? false, openldap ? null
+, zlibSupport ? false, zlib ? null
+, sslSupport ? false, openssl ? null
+, scpSupport ? false, libssh2 ? null
+, gssSupport ? false, gss ? null
+, c-aresSupport ? false, c-ares ? null
 }:
 
-let
-  mkFlag = trueStr: falseStr: cond: name: val:
-    if cond == null then null else
-      "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
-  mkEnable = mkFlag "enable-" "disable-";
-  mkWith = mkFlag "with-" "without-";
-  mkOther = mkFlag "" "" true;
-
-  shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
+assert idnSupport -> libidn != null;
+assert ldapSupport -> openldap != null;
+assert zlibSupport -> zlib != null;
+assert sslSupport -> openssl != null;
+assert scpSupport -> libssh2 != null;
+assert c-aresSupport -> c-ares != null;
 
-  isLight = suffix == "light";
-  isFull = suffix == "full";
-  nameSuffix = stdenv.lib.optionalString (suffix != "") "-${suffix}";
-
-  # Normal Depedencies
-  optZlib = if isLight then null else shouldUsePkg zlib;
-  optOpenssl = if isLight then null else shouldUsePkg openssl;
-  optLibssh2 = if isLight then null else shouldUsePkg libssh2;
-  optLibnghttp2 = if isLight then null else shouldUsePkg libnghttp2;
-  optC-ares = if isLight then null else shouldUsePkg c-ares;
-
-  # Full dependencies
-  optGss = if !isFull then null else shouldUsePkg gss;
-  optRtmpdump = if !isFull then null else shouldUsePkg rtmpdump;
-  optOpenldap = if !isFull then null else shouldUsePkg openldap;
-  optLibidn = if !isFull then null else shouldUsePkg libidn;
-in
-with stdenv.lib;
 stdenv.mkDerivation rec {
-  name = "curl${nameSuffix}-${version}";
-  version = "7.42.1";
+  name = "curl-7.42.1";
 
   src = fetchurl {
-    url = "http://curl.haxx.se/download/curl-${version}.tar.bz2";
+    url = "http://curl.haxx.se/download/${name}.tar.bz2";
     sha256 = "11y8racpj6m4j9w7wa9sifmqvdgf22nk901sfkbxzhhy75rmk472";
   };
 
-  # Use pkgconfig only when necessary
-  nativeBuildInputs = optional (!isLight) pkgconfig;
-  buildInputs = [
-    optZlib optOpenssl optLibssh2 optLibnghttp2 optC-ares
-    optGss optRtmpdump optOpenldap optLibidn
-  ];
+  # Zlib and OpenSSL must be propagated because `libcurl.la' contains
+  # "-lz -lssl", which aren't necessary direct build inputs of
+  # applications that use Curl.
+  propagatedBuildInputs = with stdenv.lib;
+    optional idnSupport libidn ++
+    optional ldapSupport openldap ++
+    optional zlibSupport zlib ++
+    optional gssSupport gss ++
+    optional c-aresSupport c-ares ++
+    optional sslSupport openssl ++
+    optional scpSupport libssh2;
+
+  # for the second line see http://curl.haxx.se/mail/tracker-2014-03/0087.html
+  preConfigure = ''
+    sed -e 's|/usr/bin|/no-such-path|g' -i.bak configure
+    rm src/tool_hugehelp.c
+  '';
 
-  # Make curl honor CURL_CA_BUNDLE & SSL_CERT_FILE
+  # make curl honor CURL_CA_BUNDLE & SSL_CERT_FILE
   postConfigure = ''
-    echo '#define CURL_CA_BUNDLE (getenv("CURL_CA_BUNDLE") ? getenv("CURL_CA_BUNDLE") : getenv("SSL_CERT_FILE"))' >> lib/curl_config.h
+    echo  '#define CURL_CA_BUNDLE (getenv("CURL_CA_BUNDLE") ? getenv("CURL_CA_BUNDLE") : getenv("SSL_CERT_FILE"))' >> lib/curl_config.h
   '';
 
   configureFlags = [
-    (mkEnable true                    "http"              null)
-    (mkEnable true                    "ftp"               null)
-    (mkEnable true                    "file"              null)
-    (mkEnable (optOpenldap != null)   "ldap"              null)
-    (mkEnable (optOpenldap != null)   "ldaps"             null)
-    (mkEnable true                    "rtsp"              null)
-    (mkEnable true                    "proxy"             null)
-    (mkEnable true                    "dict"              null)
-    (mkEnable true                    "telnet"            null)
-    (mkEnable true                    "tftp"              null)
-    (mkEnable true                    "pop3"              null)
-    (mkEnable true                    "imap"              null)
-    (mkEnable true                    "smb"               null)
-    (mkEnable true                    "smtp"              null)
-    (mkEnable true                    "gopher"            null)
-    (mkEnable (!isLight)              "manual"            null)
-    (mkEnable true                    "libcurl_option"    null)
-    (mkEnable false                   "libgcc"            null) # TODO: Enable on gcc
-    (mkWith   (optZlib != null)       "zlib"              null)
-    (mkEnable true                    "ipv4"              null)
-    (mkWith   (optGss != null)        "gssapi"            null)
-    (mkWith   false                   "winssl"            null)
-    (mkWith   false                   "darwinssl"         null)
-    (mkWith   (optOpenssl != null)    "ssl"               null)
-    (mkWith   false                   "gnutls"            null)
-    (mkWith   false                   "polarssl"          null)
-    (mkWith   false                   "cyassl"            null)
-    (mkWith   false                   "nss"               null)
-    (mkWith   false                   "axtls"             null)
-    (mkWith   false                   "libmetalink"       null)
-    (mkWith   (optLibssh2 != null)    "libssh2"           null)
-    (mkWith   (optRtmpdump!= null)    "librtmp"           null)
-    (mkEnable false                   "versioned-symbols" null)
-    (mkWith   false                   "winidn"            null)
-    (mkWith   (optLibidn != null)     "libidn"            null)
-    (mkWith   (optLibnghttp2 != null) "nghttp2"           null)
-    (mkEnable false                   "sspi"              null)
-    (mkEnable true                    "crypto-auth"       null)
-    (mkEnable (optOpenssl != null)    "tls-srp"           null)
-    (mkEnable true                    "unix-sockets"      null)
-    (mkEnable true                    "cookies"           null)
-    (mkEnable (optC-ares != null)     "ares"              null)
-  ];
+      ( if sslSupport then "--with-ssl=${openssl}" else "--without-ssl" )
+      ( if scpSupport then "--with-libssh2=${libssh2}" else "--without-libssh2" )
+      ( if ldapSupport then "--enable-ldap" else "--disable-ldap" )
+      ( if ldapSupport then "--enable-ldaps" else "--disable-ldaps" )
+      ( if idnSupport then "--with-libidn=${libidn}" else "--without-libidn" )
+    ]
+    ++ stdenv.lib.optional c-aresSupport "--enable-ares=${c-ares}"
+    ++ stdenv.lib.optional gssSupport "--with-gssapi=${gss}";
 
-  # Fix all broken refernces to dependencies in .la and .pc files
-  postInstall = optionalString (optZlib != null) ''
-    sed -i 's,\(-lz\),-L${optZlib}/lib \1,' $out/lib/{libcurl.la,pkgconfig/libcurl.pc}
-  '' + optionalString (optOpenssl != null) ''
-    sed -i 's,\(-lssl\|-lcrypto\),-L${optOpenssl}/lib \1,' $out/lib/pkgconfig/libcurl.pc
-  '' + optionalString (optLibssh2 != null) ''
-    sed -i 's,\(-lssh2\),-L${optLibssh2}/lib \1,' $out/lib/pkgconfig/libcurl.pc
-  '' + optionalString (optLibnghttp2 != null) ''
-    sed -i 's,\(-lnghttp2\),-L${optLibnghttp2}/lib \1,' $out/lib/pkgconfig/libcurl.pc
-  '' + optionalString (optC-ares != null) ''
-    sed -i 's,\(-lcares\),-L${optC-ares}/lib \1,' $out/lib/{libcurl.la,pkgconfig/libcurl.pc}
-  '' + optionalString (optGss != null) ''
-    sed -i 's,\(-lgss\),-L${optGss}/lib \1,' $out/lib/{libcurl.la,pkgconfig/libcurl.pc}
-  '' + optionalString (optRtmpdump != null) ''
-    sed -i 's,\(-lrtmp\),-L${optRtmpdump}/lib \1,' $out/lib/pkgconfig/libcurl.pc
-  '' + optionalString (optOpenldap != null) ''
-    sed -i 's,\(-lgss\),-L${optOpenldap}/lib \1,' $out/lib/{libcurl.la,pkgconfig/libcurl.pc}
-  '' + optionalString (optLibidn != null) ''
-    sed -i 's,\(-lidn\),-L${optLibidn}/lib \1,' $out/lib/pkgconfig/libcurl.pc
-  '';
+  CXX = "g++";
+  CXXCPP = "g++ -E";
+
+  crossAttrs = {
+    # We should refer to the cross built openssl
+    # For the 'urandom', maybe it should be a cross-system option
+    configureFlags = [
+        ( if sslSupport then "--with-ssl=${openssl.crossDrv}" else "--without-ssl" )
+        "--with-random /dev/urandom"
+      ];
+  };
+
+  passthru = {
+    inherit sslSupport openssl;
+  };
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "A command line tool for transferring files with URL syntax";
     homepage    = http://curl.haxx.se/;
-    license     = licenses.mit;
+    maintainers = with maintainers; [ lovek323 ];
     platforms   = platforms.all;
-    maintainers = with maintainers; [ lovek323 wkennington ];
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 853965959fc7..465717c6e40b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1145,12 +1145,18 @@ let
 
   cudatoolkit = cudatoolkit5;
 
-  curl-light = curl.override { suffix = "light"; };
-  curl = curl-full.override {
+  curlFull = curl.override {
+    idnSupport = true;
+    ldapSupport = true;
+    gssSupport = true;
+  };
+
+  curl = callPackage ../tools/networking/curl rec {
     fetchurl = fetchurlBoot;
-    suffix = "";
+    zlibSupport = true;
+    sslSupport = zlibSupport;
+    scpSupport = zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin;
   };
-  curl-full = callPackage ../tools/networking/curl { suffix = "full"; };
 
   curl3 = callPackage ../tools/networking/curl/7.15.nix rec {
     zlibSupport = true;