1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools eutils prefix multilib-minimal
8 DESCRIPTION="A Client that groks URLs"
9 HOMEPAGE="https://curl.haxx.se/"
10 SRC_URI="https://curl.haxx.se/download/${P}.tar.xz"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
15 IUSE="adns alt-svc brotli http2 idn ipv6 kerberos ldap metalink +progress-meter rtmp samba ssh ssl static-libs test threads"
16 IUSE+=" curl_ssl_gnutls curl_ssl_libressl curl_ssl_mbedtls curl_ssl_nss +curl_ssl_openssl curl_ssl_winssl"
17 IUSE+=" nghttp3 quiche"
20 #lead to lots of false negatives, bug #285669
23 RDEPEND="ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] )
24 brotli? ( app-arch/brotli:=[${MULTILIB_USEDEP}] )
27 net-libs/gnutls:0=[static-libs?,${MULTILIB_USEDEP}]
28 dev-libs/nettle:0=[${MULTILIB_USEDEP}]
29 app-misc/ca-certificates
32 dev-libs/libressl:0=[static-libs?,${MULTILIB_USEDEP}]
35 net-libs/mbedtls:0=[${MULTILIB_USEDEP}]
36 app-misc/ca-certificates
39 dev-libs/openssl:0=[static-libs?,${MULTILIB_USEDEP}]
42 dev-libs/nss:0[${MULTILIB_USEDEP}]
43 app-misc/ca-certificates
46 http2? ( net-libs/nghttp2[${MULTILIB_USEDEP}] )
48 net-libs/nghttp3[${MULTILIB_USEDEP}]
49 net-libs/ngtcp2[ssl,${MULTILIB_USEDEP}]
51 quiche? ( >=net-libs/quiche-0.3.0[${MULTILIB_USEDEP}] )
52 idn? ( net-dns/libidn2:0=[static-libs?,${MULTILIB_USEDEP}] )
53 adns? ( net-dns/c-ares:0[${MULTILIB_USEDEP}] )
54 kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )
55 metalink? ( >=media-libs/libmetalink-0.1.1[${MULTILIB_USEDEP}] )
56 rtmp? ( media-video/rtmpdump[${MULTILIB_USEDEP}] )
57 ssh? ( net-libs/libssh2[${MULTILIB_USEDEP}] )
58 sys-libs/zlib[${MULTILIB_USEDEP}]"
60 # Do we need to enforce the same ssl backend for curl and rtmpdump? Bug #423303
62 # media-video/rtmpdump
63 # curl_ssl_gnutls? ( media-video/rtmpdump[gnutls] )
64 # curl_ssl_openssl? ( media-video/rtmpdump[-gnutls,ssl] )
67 # ssl providers to be added:
68 # fbopenssl $(use_with spnego)
71 BDEPEND=">=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
77 # c-ares must be disabled for threads
78 # only one ssl provider can be enabled
80 curl_ssl_winssl? ( elibc_Winnt )
93 DOCS=( CHANGES README docs/FEATURES docs/INTERNALS.md \
94 docs/FAQ docs/BUGS docs/CONTRIBUTE.md )
96 MULTILIB_WRAPPED_HEADERS=(
97 /usr/include/curl/curlbuild.h
100 MULTILIB_CHOST_TOOLS=(
105 eapply "${FILESDIR}"/${PN}-7.30.0-prefix.patch
106 eapply "${FILESDIR}"/${PN}-respect-cflags-3.patch
107 eapply "${FILESDIR}"/${PN}-fix-gnutls-nettle.patch
109 sed -i '/LD_LIBRARY_PATH=/d' configure.ac || die #382241
110 sed -i '/CURL_MAC_CFLAGS/d' configure.ac || die #637252
113 eprefixify curl-config.in
117 multilib_src_configure() {
118 # We make use of the fact that later flags override earlier ones
119 # So start with all ssl providers off until proven otherwise
120 # TODO: in the future, we may want to add wolfssl (https://www.wolfssl.com/)
122 myconf+=( --without-gnutls --without-mbedtls --without-nss --without-polarssl --without-ssl --without-winssl )
123 myconf+=( --without-ca-fallback --with-ca-bundle="${EPREFIX}"/etc/ssl/certs/ca-certificates.crt )
125 if use curl_ssl_gnutls; then
126 einfo "SSL provided by gnutls"
127 myconf+=( --with-gnutls --with-nettle )
128 elif use curl_ssl_libressl; then
129 einfo "SSL provided by LibreSSL"
130 myconf+=( --with-ssl --with-ca-path="${EPREFIX}"/etc/ssl/certs )
131 elif use curl_ssl_mbedtls; then
132 einfo "SSL provided by mbedtls"
133 myconf+=( --with-mbedtls )
134 elif use curl_ssl_nss; then
135 einfo "SSL provided by nss"
136 myconf+=( --with-nss )
137 elif use curl_ssl_openssl; then
138 einfo "SSL provided by openssl"
139 myconf+=( --with-ssl --with-ca-path="${EPREFIX}"/etc/ssl/certs )
140 elif use curl_ssl_winssl; then
141 einfo "SSL provided by Windows"
142 myconf+=( --with-winssl )
144 eerror "We can't be here because of REQUIRED_USE."
150 # These configuration options are organized alphabetically
151 # within each category. This should make it easier if we
152 # ever decide to make any of them contingent on USE flags:
153 # 1) protocols first. To see them all do
154 # 'grep SUPPORT_PROTOCOLS configure.ac'
155 # 2) --enable/disable options second.
156 # 'grep -- --enable configure | grep Check | awk '{ print $4 }' | sort
157 # 3) --with/without options third.
158 # grep -- --with configure | grep Check | awk '{ print $4 }' | sort
160 ECONF_SOURCE="${S}" \
162 $(use_enable alt-svc) \
163 --enable-crypto-auth \
172 $(use_enable ldap ldaps) \
177 $(use_enable samba smb) \
178 $(use_with ssh libssh2) \
183 $(use_enable adns ares) \
186 --enable-dnsshuffle \
188 --enable-hidden-symbols \
195 $(use_enable progress-meter) \
198 $(use_enable static-libs static) \
199 $(use_enable threads threaded-resolver) \
200 $(use_enable threads pthreads) \
201 --disable-versioned-symbols \
205 --without-darwinssl \
206 --without-fish-functions-dir \
207 $(use_with idn libidn2) \
208 $(use_with kerberos gssapi "${EPREFIX}"/usr) \
209 $(use_with metalink libmetalink) \
210 $(use_with http2 nghttp2) \
212 $(use_with nghttp3) \
213 $(use_with nghttp3 ngtcp2) \
215 $(use_with rtmp librtmp) \
218 --without-secure-transport \
225 if ! multilib_is_native_abi; then
226 # avoid building the client
227 sed -i -e '/SUBDIRS/s:src::' Makefile || die
228 sed -i -e '/SUBDIRS/s:scripts::' Makefile || die
231 # Fix up the pkg-config file to be more robust.
232 # https://github.com/curl/curl/issues/864
233 local priv=() libs=()
234 # We always enable zlib.
238 libs+=( "-lnghttp2" )
239 priv+=( "libnghttp2" )
246 libs+=( "-lnghttp3" "-lngtcp2" )
247 priv+=( "libnghttp3" "-libtcp2" )
249 if use ssl && use curl_ssl_openssl; then
250 libs+=( "-lssl" "-lcrypto" )
253 grep -q Requires.private libcurl.pc && die "need to update ebuild"
254 libs=$(printf '|%s' "${libs[@]}")
256 -e "/^Libs.private/s:(${libs#|})( |$)::g" \
258 echo "Requires.private: ${priv[*]}" >> libcurl.pc
261 multilib_src_install_all() {
263 find "${ED}" -type f -name '*.la' -delete