2015-05-01 22:38:31 +01:00
|
|
|
{ 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 ? ""
|
2010-07-18 22:01:17 +01:00
|
|
|
}:
|
2005-06-17 11:30:13 +01:00
|
|
|
|
2015-05-01 22:38:31 +01:00
|
|
|
let
|
2015-06-01 19:52:03 +01:00
|
|
|
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;
|
|
|
|
|
2015-05-01 22:38:31 +01:00
|
|
|
isLight = suffix == "light";
|
|
|
|
isFull = suffix == "full";
|
2015-06-01 19:52:03 +01:00
|
|
|
nameSuffix = stdenv.lib.optionalString (suffix != "") "-${suffix}";
|
2015-05-01 22:38:31 +01:00
|
|
|
|
|
|
|
# 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
|
2015-06-01 19:52:03 +01:00
|
|
|
with stdenv.lib;
|
2009-03-11 15:16:17 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2015-05-01 22:38:31 +01:00
|
|
|
name = "curl${nameSuffix}-${version}";
|
|
|
|
version = "7.42.1";
|
2010-08-06 13:45:39 +01:00
|
|
|
|
* The stdenv setup script now defines a generic builder that allows
builders for typical Autoconf-style to be much shorten, e.g.,
. $stdenv/setup
genericBuild
The generic builder does lots of stuff automatically:
- Unpacks source archives specified by $src or $srcs (it knows about
gzip, bzip2, tar, zip, and unpacked source trees).
- Determines the source tree.
- Applies patches specified by $patches.
- Fixes libtool not to search for libraries in /lib etc.
- Runs `configure'.
- Runs `make'.
- Runs `make install'.
- Strips debug information from static libraries.
- Writes nested log information (in the format accepted by
`log2xml').
There are also lots of hooks and variables to customise the generic
builder. See `stdenv/generic/docs.txt'.
* Adapted the base packages (i.e., the ones used by stdenv) to use the
generic builder.
* We now use `curl' instead of `wget' to download files in `fetchurl'.
* Neither `curl' nor `wget' are part of stdenv. We shouldn't
encourage people to download stuff in builders (impure!).
* Updated some packages.
* `buildinputs' is now `buildInputs' (but the old name also works).
* `findInputs' in the setup script now prevents inputs from being
processed multiple times (which could happen, e.g., if an input was
a propagated input of several other inputs; this caused the size
variables like $PATH to blow up exponentially in the worst case).
* Patched GNU Make to write nested log information in the format
accepted by `log2xml'. Also, prior to writing the build command,
Make now writes a line `building X' to indicate what is being
built. This is unfortunately often obscured by the gigantic tool
invocations in many Makefiles. The actual build commands are marked
`unimportant' so that they don't clutter pages generated by
`log2html'.
svn path=/nixpkgs/trunk/; revision=845
2004-03-19 16:53:04 +00:00
|
|
|
src = fetchurl {
|
2015-05-01 22:38:31 +01:00
|
|
|
url = "http://curl.haxx.se/download/curl-${version}.tar.bz2";
|
2015-05-01 19:24:07 +01:00
|
|
|
sha256 = "11y8racpj6m4j9w7wa9sifmqvdgf22nk901sfkbxzhhy75rmk472";
|
* The stdenv setup script now defines a generic builder that allows
builders for typical Autoconf-style to be much shorten, e.g.,
. $stdenv/setup
genericBuild
The generic builder does lots of stuff automatically:
- Unpacks source archives specified by $src or $srcs (it knows about
gzip, bzip2, tar, zip, and unpacked source trees).
- Determines the source tree.
- Applies patches specified by $patches.
- Fixes libtool not to search for libraries in /lib etc.
- Runs `configure'.
- Runs `make'.
- Runs `make install'.
- Strips debug information from static libraries.
- Writes nested log information (in the format accepted by
`log2xml').
There are also lots of hooks and variables to customise the generic
builder. See `stdenv/generic/docs.txt'.
* Adapted the base packages (i.e., the ones used by stdenv) to use the
generic builder.
* We now use `curl' instead of `wget' to download files in `fetchurl'.
* Neither `curl' nor `wget' are part of stdenv. We shouldn't
encourage people to download stuff in builders (impure!).
* Updated some packages.
* `buildinputs' is now `buildInputs' (but the old name also works).
* `findInputs' in the setup script now prevents inputs from being
processed multiple times (which could happen, e.g., if an input was
a propagated input of several other inputs; this caused the size
variables like $PATH to blow up exponentially in the worst case).
* Patched GNU Make to write nested log information in the format
accepted by `log2xml'. Also, prior to writing the build command,
Make now writes a line `building X' to indicate what is being
built. This is unfortunately often obscured by the gigantic tool
invocations in many Makefiles. The actual build commands are marked
`unimportant' so that they don't clutter pages generated by
`log2html'.
svn path=/nixpkgs/trunk/; revision=845
2004-03-19 16:53:04 +00:00
|
|
|
};
|
2010-08-06 13:45:39 +01:00
|
|
|
|
2015-05-01 22:38:31 +01:00
|
|
|
# Use pkgconfig only when necessary
|
|
|
|
nativeBuildInputs = optional (!isLight) pkgconfig;
|
2015-06-02 10:32:16 +01:00
|
|
|
buildInputs = [
|
2015-05-01 22:38:31 +01:00
|
|
|
optZlib optOpenssl optLibssh2 optLibnghttp2 optC-ares
|
|
|
|
optGss optRtmpdump optOpenldap optLibidn
|
|
|
|
];
|
2013-09-07 01:38:36 +01:00
|
|
|
|
2015-05-01 22:38:31 +01:00
|
|
|
# Make curl honor CURL_CA_BUNDLE & SSL_CERT_FILE
|
2014-11-19 13:45:02 +00:00
|
|
|
postConfigure = ''
|
2015-05-01 22:38:31 +01:00
|
|
|
echo '#define CURL_CA_BUNDLE (getenv("CURL_CA_BUNDLE") ? getenv("CURL_CA_BUNDLE") : getenv("SSL_CERT_FILE"))' >> lib/curl_config.h
|
2014-11-19 13:45:02 +00:00
|
|
|
'';
|
|
|
|
|
2012-10-27 18:28:08 +01:00
|
|
|
configureFlags = [
|
2015-05-01 22:38:31 +01:00
|
|
|
(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)
|
|
|
|
];
|
2010-03-06 15:17:43 +00:00
|
|
|
|
2015-06-02 10:32:16 +01:00
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2015-05-01 22:38:31 +01:00
|
|
|
meta = {
|
2008-04-23 10:30:09 +01:00
|
|
|
description = "A command line tool for transferring files with URL syntax";
|
2013-09-07 01:38:36 +01:00
|
|
|
homepage = http://curl.haxx.se/;
|
2015-05-01 22:38:31 +01:00
|
|
|
license = licenses.mit;
|
2013-09-07 01:38:36 +01:00
|
|
|
platforms = platforms.all;
|
2015-05-01 22:38:31 +01:00
|
|
|
maintainers = with maintainers; [ lovek323 wkennington ];
|
2008-04-23 10:30:09 +01:00
|
|
|
};
|
2007-05-24 14:34:34 +01:00
|
|
|
}
|