3
0
Fork 0
forked from mirrors/nixpkgs

curl: cleanup build configuration

This commit is contained in:
Izorkin 2021-11-13 23:51:30 +03:00
parent 1e4864e295
commit 851b12b691
No known key found for this signature in database
GPG key ID: 1436C1B3F3679F09

View file

@ -1,13 +1,7 @@
{ stdenv, lib, fetchurl, pkg-config, perl
, http2Support ? true, nghttp2
, idnSupport ? false, libidn2 ? null
, ldapSupport ? false, openldap ? null
, zlibSupport ? true, zlib ? null
, zstdSupport ? false, zstd ? null
, opensslSupport ? zlibSupport, openssl ? null
{ lib, stdenv, fetchurl, pkg-config, perl
, brotliSupport ? false, brotli ? null
, c-aresSupport ? false, c-ares ? null
, gnutlsSupport ? false, gnutls ? null
, wolfsslSupport ? false, wolfssl ? null
, scpSupport ? zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin, libssh2 ? null
, gsaslSupport ? false, gsasl ? null
, gssSupport ? with stdenv.hostPlatform; (
!isWindows &&
@ -19,10 +13,16 @@
# not worth the effort.
!(isDarwin && (stdenv.buildPlatform != stdenv.hostPlatform))
), libkrb5 ? null
, c-aresSupport ? false, c-ares ? null
, brotliSupport ? false, brotli ? null
, rtmpSupport ? false, rtmpdump ? null
, http2Support ? true, nghttp2 ? null
, idnSupport ? false, libidn2 ? null
, ldapSupport ? false, openldap ? null
, opensslSupport ? zlibSupport, openssl ? null
, pslSupport ? false, libpsl ? null
, rtmpSupport ? false, rtmpdump ? null
, scpSupport ? zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin, libssh2 ? null
, wolfsslSupport ? false, wolfssl ? null
, zlibSupport ? true, zlib ? null
, zstdSupport ? false, zstd ? null
}:
# Note: this package is used for bootstrapping fetchurl, and thus
@ -30,24 +30,24 @@
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
assert http2Support -> nghttp2 != null;
assert idnSupport -> libidn2 != null;
assert ldapSupport -> openldap != null;
assert zlibSupport -> zlib != null;
assert zstdSupport -> zstd != null;
assert opensslSupport -> openssl != null;
assert !(gnutlsSupport && opensslSupport);
assert !(gnutlsSupport && wolfsslSupport);
assert !(opensslSupport && wolfsslSupport);
assert gnutlsSupport -> gnutls != null;
assert wolfsslSupport -> wolfssl != null;
assert scpSupport -> libssh2 != null;
assert c-aresSupport -> c-ares != null;
assert brotliSupport -> brotli != null;
assert c-aresSupport -> c-ares != null;
assert gnutlsSupport -> gnutls != null;
assert gsaslSupport -> gsasl != null;
assert gssSupport -> libkrb5 != null;
assert rtmpSupport -> rtmpdump !=null;
assert http2Support -> nghttp2 != null;
assert idnSupport -> libidn2 != null;
assert ldapSupport -> openldap != null;
assert opensslSupport -> openssl != null;
assert pslSupport -> libpsl !=null;
assert rtmpSupport -> rtmpdump !=null;
assert scpSupport -> libssh2 != null;
assert wolfsslSupport -> wolfssl != null;
assert zlibSupport -> zlib != null;
assert zstdSupport -> zstd != null;
stdenv.mkDerivation rec {
pname = "curl";
@ -78,21 +78,21 @@ stdenv.mkDerivation rec {
# "-lz -lssl", which aren't necessary direct build inputs of
# applications that use Curl.
propagatedBuildInputs = with lib;
optional brotliSupport brotli ++
optional c-aresSupport c-ares ++
optional gnutlsSupport gnutls ++
optional gsaslSupport gsasl ++
optional gssSupport libkrb5 ++
optional http2Support nghttp2 ++
optional idnSupport libidn2 ++
optional ldapSupport openldap ++
optional zlibSupport zlib ++
optional zstdSupport zstd ++
optional gsaslSupport gsasl ++
optional gssSupport libkrb5 ++
optional c-aresSupport c-ares ++
optional opensslSupport openssl ++
optional gnutlsSupport gnutls ++
optional wolfsslSupport wolfssl ++
optional scpSupport libssh2 ++
optional brotliSupport brotli ++
optional pslSupport libpsl ++
optional rtmpSupport rtmpdump ++
optional pslSupport libpsl;
optional scpSupport libssh2 ++
optional wolfsslSupport wolfssl ++
optional zlibSupport zlib ++
optional zstdSupport zstd;
# for the second line see https://curl.haxx.se/mail/tracker-2014-03/0087.html
preConfigure = ''
@ -101,25 +101,26 @@ stdenv.mkDerivation rec {
'';
configureFlags = [
# Build without manual
"--disable-manual"
# Disable default CA bundle, use NIX_SSL_CERT_FILE or fallback
# to nss-cacert from the default profile.
"--without-ca-bundle"
"--without-ca-path"
# The build fails when using wolfssl with --with-ca-fallback
(lib.withFeature (!wolfsslSupport) "ca-fallback")
"--disable-manual"
(lib.withFeatureAs opensslSupport "openssl" (lib.getDev openssl))
(lib.withFeatureAs gnutlsSupport "gnutls" (lib.getDev gnutls))
(lib.withFeatureAs scpSupport "libssh2" (lib.getDev libssh2))
(lib.enableFeature c-aresSupport "ares")
(lib.enableFeature ldapSupport "ldap")
(lib.enableFeature ldapSupport "ldaps")
(lib.withFeatureAs idnSupport "libidn2" (lib.getDev libidn2))
(lib.withFeature zstdSupport "zstd")
(lib.withFeature brotliSupport "brotli")
# The build fails when using wolfssl with --with-ca-fallback
(lib.withFeature (!wolfsslSupport) "ca-fallback")
(lib.withFeature rtmpSupport "librtmp")
(lib.withFeature zstdSupport "zstd")
(lib.withFeatureAs brotliSupport "brotli" (lib.getDev brotli))
(lib.withFeatureAs gnutlsSupport "gnutls" (lib.getDev gnutls))
(lib.withFeatureAs idnSupport "libidn2" (lib.getDev libidn2))
(lib.withFeatureAs opensslSupport "openssl" (lib.getDev openssl))
(lib.withFeatureAs scpSupport "libssh2" (lib.getDev libssh2))
(lib.withFeatureAs wolfsslSupport "wolfssl" (lib.getDev wolfssl))
]
++ lib.optional wolfsslSupport "--with-wolfssl=${lib.getDev wolfssl}"
++ lib.optional c-aresSupport "--enable-ares=${c-ares}"
++ lib.optional gssSupport "--with-gssapi=${lib.getDev libkrb5}"
# For the 'urandom', maybe it should be a cross-system option
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)