2023-10-13 12:46:26 +00:00
|
|
|
|
{ lib, stdenv, fetchurl, darwin, pkg-config, perl, nixosTests
|
2022-05-09 14:27:20 +00:00
|
|
|
|
, brotliSupport ? false, brotli
|
2022-09-14 00:51:32 +00:00
|
|
|
|
, c-aresSupport ? false, c-aresMinimal
|
2022-05-09 14:27:20 +00:00
|
|
|
|
, gnutlsSupport ? false, gnutls
|
|
|
|
|
, gsaslSupport ? false, gsasl
|
2021-08-07 12:00:00 +00:00
|
|
|
|
, gssSupport ? with stdenv.hostPlatform; (
|
2020-11-19 07:41:58 +00:00
|
|
|
|
!isWindows &&
|
2023-05-08 16:00:35 +00:00
|
|
|
|
# disable gss because of: undefined reference to `k5_bcmp'
|
2020-11-19 07:41:58 +00:00
|
|
|
|
# a very sad story re static: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439039
|
|
|
|
|
!isStatic &&
|
|
|
|
|
# the "mig" tool does not configure its compiler correctly. This could be
|
|
|
|
|
# fixed in mig, but losing gss support on cross compilation to darwin is
|
|
|
|
|
# not worth the effort.
|
|
|
|
|
!(isDarwin && (stdenv.buildPlatform != stdenv.hostPlatform))
|
2022-05-09 14:27:20 +00:00
|
|
|
|
), libkrb5
|
|
|
|
|
, http2Support ? true, nghttp2
|
|
|
|
|
, http3Support ? false, nghttp3, ngtcp2
|
2023-12-28 22:17:22 +00:00
|
|
|
|
, websocketSupport ? false
|
2022-05-09 14:27:20 +00:00
|
|
|
|
, idnSupport ? false, libidn2
|
|
|
|
|
, ldapSupport ? false, openldap
|
|
|
|
|
, opensslSupport ? zlibSupport, openssl
|
|
|
|
|
, pslSupport ? false, libpsl
|
|
|
|
|
, rtmpSupport ? false, rtmpdump
|
|
|
|
|
, scpSupport ? zlibSupport && !stdenv.hostPlatform.isSunOS && !stdenv.hostPlatform.isCygwin, libssh2
|
|
|
|
|
, wolfsslSupport ? false, wolfssl
|
2023-04-01 16:35:18 +00:00
|
|
|
|
, rustlsSupport ? false, rustls-ffi
|
2022-05-09 14:27:20 +00:00
|
|
|
|
, zlibSupport ? true, zlib
|
|
|
|
|
, zstdSupport ? false, zstd
|
2022-05-07 14:51:02 +00:00
|
|
|
|
|
|
|
|
|
# for passthru.tests
|
|
|
|
|
, coeurl
|
|
|
|
|
, curlpp
|
|
|
|
|
, haskellPackages
|
|
|
|
|
, ocamlPackages
|
|
|
|
|
, phpExtensions
|
2024-02-09 16:12:58 +00:00
|
|
|
|
, pkgsStatic
|
2022-05-07 14:51:02 +00:00
|
|
|
|
, python3
|
2022-06-24 16:25:32 +00:00
|
|
|
|
, tests
|
2023-02-15 12:51:06 +00:00
|
|
|
|
, testers
|
2022-06-24 16:25:32 +00:00
|
|
|
|
, fetchpatch
|
2010-07-18 21:01:17 +00:00
|
|
|
|
}:
|
2005-06-17 10:30:13 +00:00
|
|
|
|
|
2020-06-26 20:44:45 +00:00
|
|
|
|
# Note: this package is used for bootstrapping fetchurl, and thus
|
|
|
|
|
# cannot use fetchpatch! All mutable patches (generated by GitHub or
|
|
|
|
|
# cgit) that are needed here should be included directly in Nixpkgs as
|
|
|
|
|
# files.
|
|
|
|
|
|
2023-04-01 16:35:18 +00:00
|
|
|
|
assert !((lib.count (x: x) [ gnutlsSupport opensslSupport wolfsslSupport rustlsSupport ]) > 1);
|
2015-06-01 18:52:03 +00:00
|
|
|
|
|
2022-06-24 13:58:17 +00:00
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-05-04 16:47:47 +00:00
|
|
|
|
pname = "curl";
|
2024-11-06 08:10:17 +00:00
|
|
|
|
version = "8.11.0";
|
2010-08-06 12:45:39 +00: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 {
|
2018-03-15 23:08:12 +00:00
|
|
|
|
urls = [
|
2023-07-26 16:57:34 +00:00
|
|
|
|
"https://curl.haxx.se/download/curl-${finalAttrs.version}.tar.xz"
|
2023-09-13 13:45:20 +00:00
|
|
|
|
"https://github.com/curl/curl/releases/download/curl-${builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version}/curl-${finalAttrs.version}.tar.xz"
|
2018-03-15 23:08:12 +00:00
|
|
|
|
];
|
2024-11-06 08:10:17 +00:00
|
|
|
|
hash = "sha256-21nPDWccpuf1wsXsF3CEozp54EyX5xzxg6XN6iNQVOs=";
|
* 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 12:45:39 +00:00
|
|
|
|
|
2024-05-21 21:50:29 +00:00
|
|
|
|
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
|
|
|
|
|
# necessary for FreeBSD code path in configure
|
2024-01-31 15:14:02 +00:00
|
|
|
|
postPatch = ''
|
2024-05-21 21:50:29 +00:00
|
|
|
|
substituteInPlace ./config.guess --replace-fail /usr/bin/uname uname
|
2024-01-31 15:14:02 +00:00
|
|
|
|
patchShebangs scripts
|
|
|
|
|
'';
|
2023-12-29 06:37:00 +00:00
|
|
|
|
|
2016-09-01 09:07:23 +00:00
|
|
|
|
outputs = [ "bin" "dev" "out" "man" "devdoc" ];
|
2017-07-05 14:04:54 +00:00
|
|
|
|
separateDebugInfo = stdenv.hostPlatform.isLinux;
|
2015-10-06 13:32:17 +00:00
|
|
|
|
|
2017-01-24 12:51:30 +00:00
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
2021-08-11 12:00:00 +00:00
|
|
|
|
strictDeps = true;
|
|
|
|
|
|
2024-09-17 04:27:22 +00:00
|
|
|
|
env = lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic) {
|
|
|
|
|
# Not having this causes curl’s `configure` script to fail with static builds on Darwin because
|
|
|
|
|
# some of curl’s propagated inputs need libiconv.
|
|
|
|
|
NIX_LDFLAGS = "-liconv";
|
|
|
|
|
};
|
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
|
nativeBuildInputs = [ pkg-config perl ];
|
2016-01-31 14:30:40 +00:00
|
|
|
|
|
2015-06-02 09:32:28 +00:00
|
|
|
|
# Zlib and OpenSSL must be propagated because `libcurl.la' contains
|
|
|
|
|
# "-lz -lssl", which aren't necessary direct build inputs of
|
|
|
|
|
# applications that use Curl.
|
2024-08-16 21:18:03 +00:00
|
|
|
|
propagatedBuildInputs =
|
|
|
|
|
lib.optional brotliSupport brotli ++
|
|
|
|
|
lib.optional c-aresSupport c-aresMinimal ++
|
|
|
|
|
lib.optional gnutlsSupport gnutls ++
|
|
|
|
|
lib.optional gsaslSupport gsasl ++
|
|
|
|
|
lib.optional gssSupport libkrb5 ++
|
|
|
|
|
lib.optional http2Support nghttp2 ++
|
|
|
|
|
lib.optionals http3Support [ nghttp3 ngtcp2 ] ++
|
|
|
|
|
lib.optional idnSupport libidn2 ++
|
|
|
|
|
lib.optional ldapSupport openldap ++
|
|
|
|
|
lib.optional opensslSupport openssl ++
|
|
|
|
|
lib.optional pslSupport libpsl ++
|
|
|
|
|
lib.optional rtmpSupport rtmpdump ++
|
|
|
|
|
lib.optional scpSupport libssh2 ++
|
|
|
|
|
lib.optional wolfsslSupport wolfssl ++
|
|
|
|
|
lib.optional rustlsSupport rustls-ffi ++
|
|
|
|
|
lib.optional zlibSupport zlib ++
|
|
|
|
|
lib.optional zstdSupport zstd ++
|
|
|
|
|
lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
|
2023-10-25 15:49:52 +00:00
|
|
|
|
CoreFoundation
|
|
|
|
|
CoreServices
|
|
|
|
|
SystemConfiguration
|
|
|
|
|
]);
|
2015-06-02 09:32:28 +00:00
|
|
|
|
|
2017-08-02 21:50:51 +00:00
|
|
|
|
# for the second line see https://curl.haxx.se/mail/tracker-2014-03/0087.html
|
2015-06-02 09:32:28 +00:00
|
|
|
|
preConfigure = ''
|
|
|
|
|
sed -e 's|/usr/bin|/no-such-path|g' -i.bak configure
|
|
|
|
|
rm src/tool_hugehelp.c
|
2024-02-09 16:05:19 +00:00
|
|
|
|
'' + lib.optionalString (pslSupport && stdenv.hostPlatform.isStatic) ''
|
|
|
|
|
# curl doesn't understand that libpsl2 has deps because it doesn't use
|
|
|
|
|
# pkg-config.
|
|
|
|
|
# https://github.com/curl/curl/pull/12919
|
|
|
|
|
configureFlagsArray+=("LIBS=-lidn2 -lunistring")
|
2015-06-02 09:32:28 +00:00
|
|
|
|
'';
|
2013-09-07 00:38:36 +00:00
|
|
|
|
|
2012-10-27 17:28:08 +00:00
|
|
|
|
configureFlags = [
|
2024-08-23 07:04:05 +00:00
|
|
|
|
"--enable-versioned-symbols"
|
2021-11-13 20:51:30 +00:00
|
|
|
|
# Build without manual
|
|
|
|
|
"--disable-manual"
|
|
|
|
|
(lib.enableFeature c-aresSupport "ares")
|
|
|
|
|
(lib.enableFeature ldapSupport "ldap")
|
|
|
|
|
(lib.enableFeature ldapSupport "ldaps")
|
2023-12-28 22:17:22 +00:00
|
|
|
|
(lib.enableFeature websocketSupport "websockets")
|
2023-04-01 16:35:18 +00:00
|
|
|
|
# --with-ca-fallback is only supported for openssl and gnutls https://github.com/curl/curl/blame/curl-8_0_1/acinclude.m4#L1640
|
|
|
|
|
(lib.withFeature (opensslSupport || gnutlsSupport) "ca-fallback")
|
2021-11-14 15:19:55 +00:00
|
|
|
|
(lib.withFeature http3Support "nghttp3")
|
|
|
|
|
(lib.withFeature http3Support "ngtcp2")
|
2021-11-13 20:51:30 +00:00
|
|
|
|
(lib.withFeature rtmpSupport "librtmp")
|
2023-04-01 16:35:18 +00:00
|
|
|
|
(lib.withFeature rustlsSupport "rustls")
|
2021-11-13 20:51:30 +00:00
|
|
|
|
(lib.withFeature zstdSupport "zstd")
|
2024-01-29 17:12:56 +00:00
|
|
|
|
(lib.withFeature pslSupport "libpsl")
|
2021-11-13 20:51:30 +00:00
|
|
|
|
(lib.withFeatureAs brotliSupport "brotli" (lib.getDev brotli))
|
2021-11-19 17:26:48 +00:00
|
|
|
|
(lib.withFeatureAs gnutlsSupport "gnutls" (lib.getDev gnutls))
|
2021-11-12 10:22:24 +00:00
|
|
|
|
(lib.withFeatureAs idnSupport "libidn2" (lib.getDev libidn2))
|
2021-11-13 20:51:30 +00:00
|
|
|
|
(lib.withFeatureAs opensslSupport "openssl" (lib.getDev openssl))
|
2021-11-19 17:26:48 +00:00
|
|
|
|
(lib.withFeatureAs scpSupport "libssh2" (lib.getDev libssh2))
|
2021-11-13 20:51:30 +00:00
|
|
|
|
(lib.withFeatureAs wolfsslSupport "wolfssl" (lib.getDev wolfssl))
|
2015-06-02 09:32:28 +00:00
|
|
|
|
]
|
2021-11-19 17:26:48 +00:00
|
|
|
|
++ lib.optional gssSupport "--with-gssapi=${lib.getDev libkrb5}"
|
2018-07-23 19:51:18 +00:00
|
|
|
|
# For the 'urandom', maybe it should be a cross-system option
|
2021-01-15 09:19:50 +00:00
|
|
|
|
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
|
2018-10-17 19:44:35 +00:00
|
|
|
|
"--with-random=/dev/urandom"
|
2024-10-18 13:41:54 +00:00
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2022-04-19 13:20:41 +00:00
|
|
|
|
# Disable default CA bundle, use NIX_SSL_CERT_FILE or fallback to nss-cacert from the default profile.
|
|
|
|
|
# Without this curl might detect /etc/ssl/cert.pem at build time on macOS, causing curl to ignore NIX_SSL_CERT_FILE.
|
2022-05-11 14:49:38 +00:00
|
|
|
|
"--without-ca-bundle"
|
2022-04-19 13:20:41 +00:00
|
|
|
|
"--without-ca-path"
|
2023-04-01 16:35:18 +00:00
|
|
|
|
] ++ lib.optionals (!gnutlsSupport && !opensslSupport && !wolfsslSupport && !rustlsSupport) [
|
2023-03-23 21:26:44 +00:00
|
|
|
|
"--without-ssl"
|
2024-08-02 12:01:15 +00:00
|
|
|
|
] ++ lib.optionals (rustlsSupport && !stdenv.hostPlatform.isDarwin) [
|
|
|
|
|
"--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt"
|
2024-06-16 15:24:46 +00:00
|
|
|
|
] ++ lib.optionals (gnutlsSupport && !stdenv.hostPlatform.isDarwin) [
|
|
|
|
|
"--with-ca-path=/etc/ssl/certs"
|
2018-10-17 19:44:35 +00:00
|
|
|
|
];
|
2010-03-06 15:17:43 +00:00
|
|
|
|
|
2017-10-28 03:17:55 +00:00
|
|
|
|
CXX = "${stdenv.cc.targetPrefix}c++";
|
|
|
|
|
CXXCPP = "${stdenv.cc.targetPrefix}c++ -E";
|
2015-06-02 09:32:28 +00:00
|
|
|
|
|
2022-06-24 16:25:32 +00:00
|
|
|
|
# takes 14 minutes on a 24 core and because many other packages depend on curl
|
|
|
|
|
# they cannot be run concurrently and are a bottleneck
|
|
|
|
|
# tests are available in passthru.tests.withCheck
|
|
|
|
|
doCheck = false;
|
2022-04-28 18:31:28 +00:00
|
|
|
|
preCheck = ''
|
|
|
|
|
patchShebangs tests/
|
|
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
|
# bad interaction with sandbox if enabled?
|
|
|
|
|
rm tests/data/test1453
|
2022-05-12 21:04:21 +00:00
|
|
|
|
rm tests/data/test1086
|
2022-04-28 18:31:28 +00:00
|
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
|
|
|
|
# different resolving behaviour?
|
|
|
|
|
rm tests/data/test1592
|
|
|
|
|
'';
|
2018-04-25 03:20:18 +00:00
|
|
|
|
|
2015-10-06 13:32:17 +00:00
|
|
|
|
postInstall = ''
|
2015-12-02 09:03:23 +00:00
|
|
|
|
moveToOutput bin/curl-config "$dev"
|
2019-04-17 17:43:37 +00:00
|
|
|
|
|
|
|
|
|
# Install completions
|
|
|
|
|
make -C scripts install
|
2021-01-15 09:19:50 +00:00
|
|
|
|
'' + lib.optionalString scpSupport ''
|
2021-11-19 17:26:48 +00:00
|
|
|
|
sed '/^dependency_libs/s|${lib.getDev libssh2}|${lib.getLib libssh2}|' -i "$out"/lib/*.la
|
2021-01-15 09:19:50 +00:00
|
|
|
|
'' + lib.optionalString gnutlsSupport ''
|
2022-05-25 16:36:20 +00:00
|
|
|
|
ln $out/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libcurl-gnutls${stdenv.hostPlatform.extensions.sharedLibrary}
|
|
|
|
|
ln $out/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libcurl-gnutls${stdenv.hostPlatform.extensions.sharedLibrary}.4
|
|
|
|
|
ln $out/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libcurl-gnutls${stdenv.hostPlatform.extensions.sharedLibrary}.4.4.0
|
2015-10-06 13:32:17 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2022-06-24 13:58:17 +00:00
|
|
|
|
passthru = let
|
|
|
|
|
useThisCurl = attr: attr.override { curl = finalAttrs.finalPackage; };
|
|
|
|
|
in {
|
2021-05-29 13:25:19 +00:00
|
|
|
|
inherit opensslSupport openssl;
|
2022-05-07 14:51:02 +00:00
|
|
|
|
tests = {
|
2022-06-24 16:25:32 +00:00
|
|
|
|
withCheck = finalAttrs.finalPackage.overrideAttrs (_: { doCheck = true; });
|
2024-10-12 01:29:41 +00:00
|
|
|
|
fetchpatch = tests.fetchpatch.simple.override { fetchpatch = (fetchpatch.override { fetchurl = useThisCurl fetchurl; }) // { version = 1; }; };
|
2022-06-24 13:58:17 +00:00
|
|
|
|
curlpp = useThisCurl curlpp;
|
|
|
|
|
coeurl = useThisCurl coeurl;
|
|
|
|
|
haskell-curl = useThisCurl haskellPackages.curl;
|
|
|
|
|
ocaml-curly = useThisCurl ocamlPackages.curly;
|
|
|
|
|
pycurl = useThisCurl python3.pkgs.pycurl;
|
|
|
|
|
php-curl = useThisCurl phpExtensions.curl;
|
|
|
|
|
# error: attribute 'override' missing
|
2022-05-26 23:04:56 +00:00
|
|
|
|
# Additional checking with support http3 protocol.
|
2022-06-24 13:58:17 +00:00
|
|
|
|
# nginx-http3 = useThisCurl nixosTests.nginx-http3;
|
|
|
|
|
nginx-http3 = nixosTests.nginx-http3;
|
2023-02-15 12:51:06 +00:00
|
|
|
|
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
2024-02-09 16:12:58 +00:00
|
|
|
|
static = pkgsStatic.curl;
|
2022-05-07 14:51:02 +00:00
|
|
|
|
};
|
2015-06-02 09:32:28 +00:00
|
|
|
|
};
|
2015-06-02 09:32:16 +00:00
|
|
|
|
|
2024-08-16 21:18:03 +00:00
|
|
|
|
meta = {
|
2024-07-24 11:17:21 +00:00
|
|
|
|
changelog = "https://curl.se/ch/${finalAttrs.version}.html";
|
2008-04-23 09:30:09 +00:00
|
|
|
|
description = "Command line tool for transferring files with URL syntax";
|
2021-11-12 10:20:38 +00:00
|
|
|
|
homepage = "https://curl.se/";
|
2024-08-16 21:18:03 +00:00
|
|
|
|
license = lib.licenses.curl;
|
|
|
|
|
maintainers = with lib.maintainers; [ lovek323 ];
|
|
|
|
|
platforms = lib.platforms.all;
|
2021-09-06 20:40:46 +00:00
|
|
|
|
# Fails to link against static brotli or gss
|
2024-09-01 03:53:24 +00:00
|
|
|
|
broken = stdenv.hostPlatform.isStatic && (brotliSupport || gssSupport);
|
2023-02-15 12:51:06 +00:00
|
|
|
|
pkgConfigModules = [ "libcurl" ];
|
2023-08-04 22:11:04 +00:00
|
|
|
|
mainProgram = "curl";
|
2008-04-23 09:30:09 +00:00
|
|
|
|
};
|
2022-06-24 13:58:17 +00:00
|
|
|
|
})
|