1 # Copyright 1999-2018 Gentoo Foundation
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.bz2"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
15 IUSE="adns brotli http2 idn ipv6 kerberos ldap metalink rtmp samba ssh ssl static-libs test threads"
16 IUSE+=" curl_ssl_axtls curl_ssl_gnutls curl_ssl_libressl curl_ssl_mbedtls curl_ssl_nss +curl_ssl_openssl curl_ssl_winssl"
19 #lead to lots of false negatives, bug #285669
22 RDEPEND="ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] )
23 brotli? ( app-arch/brotli:= )
26 net-libs/axtls:0=[${MULTILIB_USEDEP}]
27 app-misc/ca-certificates
30 net-libs/gnutls:0=[static-libs?,${MULTILIB_USEDEP}]
31 dev-libs/nettle:0=[${MULTILIB_USEDEP}]
32 app-misc/ca-certificates
35 dev-libs/libressl:0=[static-libs?,${MULTILIB_USEDEP}]
38 net-libs/mbedtls:0=[${MULTILIB_USEDEP}]
39 app-misc/ca-certificates
42 dev-libs/openssl:0=[static-libs?,${MULTILIB_USEDEP}]
45 dev-libs/nss:0[${MULTILIB_USEDEP}]
46 app-misc/ca-certificates
49 http2? ( net-libs/nghttp2[${MULTILIB_USEDEP}] )
50 idn? ( net-dns/libidn2:0[static-libs?,${MULTILIB_USEDEP}] )
51 adns? ( net-dns/c-ares:0[${MULTILIB_USEDEP}] )
52 kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )
53 metalink? ( >=media-libs/libmetalink-0.1.1[${MULTILIB_USEDEP}] )
54 rtmp? ( media-video/rtmpdump[${MULTILIB_USEDEP}] )
55 ssh? ( net-libs/libssh2[static-libs?,${MULTILIB_USEDEP}] )
56 sys-libs/zlib[${MULTILIB_USEDEP}]"
58 # Do we need to enforce the same ssl backend for curl and rtmpdump? Bug #423303
60 # media-video/rtmpdump
61 # curl_ssl_gnutls? ( media-video/rtmpdump[gnutls] )
62 # curl_ssl_openssl? ( media-video/rtmpdump[-gnutls,ssl] )
65 # ssl providers to be added:
66 # fbopenssl $(use_with spnego)
69 >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
75 # c-ares must be disabled for threads
76 # only one ssl provider can be enabled
78 curl_ssl_winssl? ( elibc_Winnt )
92 DOCS=( CHANGES README docs/FEATURES docs/INTERNALS.md \
93 docs/MANUAL docs/FAQ docs/BUGS docs/CONTRIBUTE.md )
95 MULTILIB_WRAPPED_HEADERS=(
96 /usr/include/curl/curlbuild.h
99 MULTILIB_CHOST_TOOLS=(
104 eapply "${FILESDIR}"/${PN}-7.30.0-prefix.patch
105 eapply "${FILESDIR}"/${PN}-respect-cflags-3.patch
106 eapply "${FILESDIR}"/${PN}-fix-gnutls-nettle.patch
108 sed -i '/LD_LIBRARY_PATH=/d' configure.ac || die #382241
111 eprefixify curl-config.in
114 if [[ ${CHOST} == *-darwin17 ]] ; then
115 # https://bugs.gentoo.org/show_bug.cgi?id=637252
116 sed -i -e '/-Werror=partial-availability/s/Werror/Wno-error/g' \
121 multilib_src_configure() {
122 # We make use of the fact that later flags override earlier ones
123 # So start with all ssl providers off until proven otherwise
124 # TODO: in the future, we may want to add wolfssl (https://www.wolfssl.com/)
126 myconf+=( --without-axtls --without-gnutls --without-mbedtls --without-nss --without-polarssl --without-ssl --without-winssl )
127 myconf+=( --without-ca-fallback --with-ca-bundle="${EPREFIX}"/etc/ssl/certs/ca-certificates.crt )
129 if use curl_ssl_axtls; then
130 einfo "SSL provided by axtls"
131 myconf+=( --with-axtls )
132 elif use curl_ssl_gnutls; then
133 einfo "SSL provided by gnutls"
134 myconf+=( --with-gnutls --with-nettle )
135 elif use curl_ssl_libressl; then
136 einfo "SSL provided by LibreSSL"
137 myconf+=( --with-ssl --with-ca-path="${EPREFIX}"/etc/ssl/certs )
138 elif use curl_ssl_mbedtls; then
139 einfo "SSL provided by mbedtls"
140 myconf+=( --with-mbedtls )
141 elif use curl_ssl_nss; then
142 einfo "SSL provided by nss"
143 myconf+=( --with-nss )
144 elif use curl_ssl_openssl; then
145 einfo "SSL provided by openssl"
146 myconf+=( --with-ssl --with-ca-path="${EPREFIX}"/etc/ssl/certs )
147 elif use curl_ssl_winssl; then
148 einfo "SSL provided by Windows"
149 myconf+=( --with-winssl )
151 eerror "We can't be here because of REQUIRED_USE."
157 # These configuration options are organized alphabetically
158 # within each category. This should make it easier if we
159 # ever decide to make any of them contingent on USE flags:
160 # 1) protocols first. To see them all do
161 # 'grep SUPPORT_PROTOCOLS configure.ac'
162 # 2) --enable/disable options second.
163 # 'grep -- --enable configure | grep Check | awk '{ print $4 }' | sort
164 # 3) --with/without options third.
165 # grep -- --with configure | grep Check | awk '{ print $4 }' | sort
166 ECONF_SOURCE="${S}" \
168 --enable-crypto-auth \
176 $(use_enable ldap ldaps) \
181 $(use_enable samba smb) \
182 $(use_with ssh libssh2) \
187 $(use_enable adns ares) \
189 --enable-hidden-symbols \
196 $(use_enable static-libs static) \
197 $(use_enable threads threaded-resolver) \
198 $(use_enable threads pthreads) \
199 --disable-versioned-symbols \
201 --without-darwinssl \
202 $(use_with idn libidn2) \
203 $(use_with kerberos gssapi "${EPREFIX}"/usr) \
204 $(use_with metalink libmetalink) \
205 $(use_with http2 nghttp2) \
206 $(use_with rtmp librtmp) \
214 if ! multilib_is_native_abi; then
215 # avoid building the client
216 sed -i -e '/SUBDIRS/s:src::' Makefile || die
217 sed -i -e '/SUBDIRS/s:scripts::' Makefile || die
220 # Fix up the pkg-config file to be more robust.
221 # https://github.com/curl/curl/issues/864
222 local priv=() libs=()
223 # We always enable zlib.
227 libs+=( "-lnghttp2" )
228 priv+=( "libnghttp2" )
230 if use ssl && use curl_ssl_openssl; then
231 libs+=( "-lssl" "-lcrypto" )
234 grep -q Requires.private libcurl.pc && die "need to update ebuild"
235 libs=$(printf '|%s' "${libs[@]}")
237 -e "/^Libs.private/s:(${libs#|})( |$)::g" \
239 echo "Requires.private: ${priv[*]}" >> libcurl.pc
242 multilib_src_install_all() {
244 prune_libtool_files --all