at v192 81 lines 2.7 kB view raw
1{ stdenv, fetchurl 2, idnSupport ? false, libidn ? null 3, ldapSupport ? false, openldap ? null 4, zlibSupport ? false, zlib ? null 5, sslSupport ? false, openssl ? null 6, scpSupport ? false, libssh2 ? null 7, gssSupport ? false, gss ? null 8, c-aresSupport ? false, c-ares ? null 9}: 10 11assert idnSupport -> libidn != null; 12assert ldapSupport -> openldap != null; 13assert zlibSupport -> zlib != null; 14assert sslSupport -> openssl != null; 15assert scpSupport -> libssh2 != null; 16assert c-aresSupport -> c-ares != null; 17 18stdenv.mkDerivation rec { 19 name = "curl-7.44.0"; 20 21 src = fetchurl { 22 url = "http://curl.haxx.se/download/${name}.tar.bz2"; 23 sha256 = "050q6i20lbh7dyyhva2sbp8dbyp6sghlkbpvq2bvcasqwsx4298y"; 24 }; 25 26 # Zlib and OpenSSL must be propagated because `libcurl.la' contains 27 # "-lz -lssl", which aren't necessary direct build inputs of 28 # applications that use Curl. 29 propagatedBuildInputs = with stdenv.lib; 30 optional idnSupport libidn ++ 31 optional ldapSupport openldap ++ 32 optional zlibSupport zlib ++ 33 optional gssSupport gss ++ 34 optional c-aresSupport c-ares ++ 35 optional sslSupport openssl ++ 36 optional scpSupport libssh2; 37 38 # for the second line see http://curl.haxx.se/mail/tracker-2014-03/0087.html 39 preConfigure = '' 40 sed -e 's|/usr/bin|/no-such-path|g' -i.bak configure 41 rm src/tool_hugehelp.c 42 ''; 43 44 # make curl honor CURL_CA_BUNDLE & SSL_CERT_FILE 45 postConfigure = '' 46 echo '#define CURL_CA_BUNDLE (getenv("CURL_CA_BUNDLE") ? getenv("CURL_CA_BUNDLE") : getenv("SSL_CERT_FILE"))' >> lib/curl_config.h 47 ''; 48 49 configureFlags = [ 50 ( if sslSupport then "--with-ssl=${openssl}" else "--without-ssl" ) 51 ( if scpSupport then "--with-libssh2=${libssh2}" else "--without-libssh2" ) 52 ( if ldapSupport then "--enable-ldap" else "--disable-ldap" ) 53 ( if ldapSupport then "--enable-ldaps" else "--disable-ldaps" ) 54 ( if idnSupport then "--with-libidn=${libidn}" else "--without-libidn" ) 55 ] 56 ++ stdenv.lib.optional c-aresSupport "--enable-ares=${c-ares}" 57 ++ stdenv.lib.optional gssSupport "--with-gssapi=${gss}"; 58 59 CXX = "g++"; 60 CXXCPP = "g++ -E"; 61 62 crossAttrs = { 63 # We should refer to the cross built openssl 64 # For the 'urandom', maybe it should be a cross-system option 65 configureFlags = [ 66 ( if sslSupport then "--with-ssl=${openssl.crossDrv}" else "--without-ssl" ) 67 "--with-random /dev/urandom" 68 ]; 69 }; 70 71 passthru = { 72 inherit sslSupport openssl; 73 }; 74 75 meta = with stdenv.lib; { 76 description = "A command line tool for transferring files with URL syntax"; 77 homepage = http://curl.haxx.se/; 78 maintainers = with maintainers; [ lovek323 ]; 79 platforms = platforms.all; 80 }; 81}