*/*: Discontinue Gentoo SuperH port
[gentoo.git] / net-misc / curl / curl-7.69.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 inherit autotools eutils prefix multilib-minimal
7
8 DESCRIPTION="A Client that groks URLs"
9 HOMEPAGE="https://curl.haxx.se/"
10 SRC_URI="https://curl.haxx.se/download/${P}.tar.xz"
11
12 LICENSE="MIT"
13 SLOT="0"
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"
18 IUSE+=" elibc_Winnt"
19
20 #lead to lots of false negatives, bug #285669
21 RESTRICT="test"
22
23 RDEPEND="ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] )
24         brotli? ( app-arch/brotli:=[${MULTILIB_USEDEP}] )
25         ssl? (
26                 curl_ssl_gnutls? (
27                         net-libs/gnutls:0=[static-libs?,${MULTILIB_USEDEP}]
28                         dev-libs/nettle:0=[${MULTILIB_USEDEP}]
29                         app-misc/ca-certificates
30                 )
31                 curl_ssl_libressl? (
32                         dev-libs/libressl:0=[static-libs?,${MULTILIB_USEDEP}]
33                 )
34                 curl_ssl_mbedtls? (
35                         net-libs/mbedtls:0=[${MULTILIB_USEDEP}]
36                         app-misc/ca-certificates
37                 )
38                 curl_ssl_openssl? (
39                         dev-libs/openssl:0=[static-libs?,${MULTILIB_USEDEP}]
40                 )
41                 curl_ssl_nss? (
42                         dev-libs/nss:0[${MULTILIB_USEDEP}]
43                         app-misc/ca-certificates
44                 )
45         )
46         http2? ( net-libs/nghttp2[${MULTILIB_USEDEP}] )
47         nghttp3? (
48                 net-libs/nghttp3[${MULTILIB_USEDEP}]
49                 net-libs/ngtcp2[ssl,${MULTILIB_USEDEP}]
50         )
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}]"
59
60 # Do we need to enforce the same ssl backend for curl and rtmpdump? Bug #423303
61 #       rtmp? (
62 #               media-video/rtmpdump
63 #               curl_ssl_gnutls? ( media-video/rtmpdump[gnutls] )
64 #               curl_ssl_openssl? ( media-video/rtmpdump[-gnutls,ssl] )
65 #       )
66
67 # ssl providers to be added:
68 # fbopenssl  $(use_with spnego)
69
70 DEPEND="${RDEPEND}"
71 BDEPEND=">=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
72         test? (
73                 sys-apps/diffutils
74                 dev-lang/perl
75         )"
76
77 # c-ares must be disabled for threads
78 # only one ssl provider can be enabled
79 REQUIRED_USE="
80         curl_ssl_winssl? ( elibc_Winnt )
81         threads? ( !adns )
82         ssl? (
83                 ^^ (
84                         curl_ssl_gnutls
85                         curl_ssl_libressl
86                         curl_ssl_mbedtls
87                         curl_ssl_nss
88                         curl_ssl_openssl
89                         curl_ssl_winssl
90                 )
91         )"
92
93 DOCS=( CHANGES README docs/FEATURES docs/INTERNALS.md \
94         docs/FAQ docs/BUGS docs/CONTRIBUTE.md )
95
96 MULTILIB_WRAPPED_HEADERS=(
97         /usr/include/curl/curlbuild.h
98 )
99
100 MULTILIB_CHOST_TOOLS=(
101         /usr/bin/curl-config
102 )
103
104 src_prepare() {
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
108
109         sed -i '/LD_LIBRARY_PATH=/d' configure.ac || die #382241
110         sed -i '/CURL_MAC_CFLAGS/d' configure.ac || die #637252
111
112         eapply_user
113         eprefixify curl-config.in
114         eautoreconf
115 }
116
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/)
121         local myconf=()
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  )
124         if use ssl ; then
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 )
143                 else
144                         eerror "We can't be here because of REQUIRED_USE."
145                 fi
146         else
147                 einfo "SSL disabled"
148         fi
149
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
159
160         ECONF_SOURCE="${S}" \
161         econf \
162                 $(use_enable alt-svc) \
163                 --enable-crypto-auth \
164                 --enable-dict \
165                 --disable-esni \
166                 --enable-file \
167                 --enable-ftp \
168                 --enable-gopher \
169                 --enable-http \
170                 --enable-imap \
171                 $(use_enable ldap) \
172                 $(use_enable ldap ldaps) \
173                 --disable-ntlm-wb \
174                 --enable-pop3 \
175                 --enable-rt  \
176                 --enable-rtsp \
177                 $(use_enable samba smb) \
178                 $(use_with ssh libssh2) \
179                 --enable-smtp \
180                 --enable-telnet \
181                 --enable-tftp \
182                 --enable-tls-srp \
183                 $(use_enable adns ares) \
184                 --enable-cookies \
185                 --enable-dateparse \
186                 --enable-dnsshuffle \
187                 --enable-doh \
188                 --enable-hidden-symbols \
189                 --enable-http-auth \
190                 $(use_enable ipv6) \
191                 --enable-largefile \
192                 --enable-manual \
193                 --enable-mime \
194                 --enable-netrc \
195                 $(use_enable progress-meter) \
196                 --enable-proxy \
197                 --disable-sspi \
198                 $(use_enable static-libs static) \
199                 $(use_enable threads threaded-resolver) \
200                 $(use_enable threads pthreads) \
201                 --disable-versioned-symbols \
202                 --without-amissl \
203                 --without-bearssl \
204                 --without-cyassl \
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) \
211                 --without-libpsl \
212                 $(use_with nghttp3) \
213                 $(use_with nghttp3 ngtcp2) \
214                 $(use_with quiche) \
215                 $(use_with rtmp librtmp) \
216                 $(use_with brotli) \
217                 --without-schannel \
218                 --without-secure-transport \
219                 --without-spnego \
220                 --without-winidn \
221                 --without-wolfssl \
222                 --with-zlib \
223                 "${myconf[@]}"
224
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
229         fi
230
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.
235         libs+=( "-lz" )
236         priv+=( "zlib" )
237         if use http2; then
238                 libs+=( "-lnghttp2" )
239                 priv+=( "libnghttp2" )
240         fi
241         if use quiche; then
242                 libs+=( "-lquiche" )
243                 priv+=( "quiche" )
244         fi
245         if use nghttp3; then
246                 libs+=( "-lnghttp3" "-lngtcp2" )
247                 priv+=( "libnghttp3" "-libtcp2" )
248         fi
249         if use ssl && use curl_ssl_openssl; then
250                 libs+=( "-lssl" "-lcrypto" )
251                 priv+=( "openssl" )
252         fi
253         grep -q Requires.private libcurl.pc && die "need to update ebuild"
254         libs=$(printf '|%s' "${libs[@]}")
255         sed -i -r \
256                 -e "/^Libs.private/s:(${libs#|})( |$)::g" \
257                 libcurl.pc || die
258         echo "Requires.private: ${priv[*]}" >> libcurl.pc
259 }
260
261 multilib_src_install_all() {
262         einstalldocs
263         find "${ED}" -type f -name '*.la' -delete
264         rm -rf "${ED}"/etc/
265 }