|
Line 0
Link Here
|
| 0 |
- |
1 |
# Copyright 1999-2018 Gentoo Foundation |
|
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
|
| 4 |
EAPI="6" |
| 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.bz2" |
| 11 |
|
| 12 |
LICENSE="MIT" |
| 13 |
SLOT="0" |
| 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" |
| 17 |
IUSE+=" elibc_Winnt" |
| 18 |
|
| 19 |
#lead to lots of false negatives, bug #285669 |
| 20 |
RESTRICT="test" |
| 21 |
|
| 22 |
RDEPEND="ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] ) |
| 23 |
brotli? ( app-arch/brotli:= ) |
| 24 |
ssl? ( |
| 25 |
curl_ssl_axtls? ( |
| 26 |
net-libs/axtls:0=[${MULTILIB_USEDEP}] |
| 27 |
app-misc/ca-certificates |
| 28 |
) |
| 29 |
curl_ssl_gnutls? ( |
| 30 |
net-libs/gnutls:0=[static-libs?,${MULTILIB_USEDEP}] |
| 31 |
dev-libs/nettle:0=[${MULTILIB_USEDEP}] |
| 32 |
app-misc/ca-certificates |
| 33 |
) |
| 34 |
curl_ssl_libressl? ( |
| 35 |
dev-libs/libressl:0=[static-libs?,${MULTILIB_USEDEP}] |
| 36 |
) |
| 37 |
curl_ssl_mbedtls? ( |
| 38 |
net-libs/mbedtls:0=[${MULTILIB_USEDEP}] |
| 39 |
app-misc/ca-certificates |
| 40 |
) |
| 41 |
curl_ssl_openssl? ( |
| 42 |
dev-libs/openssl:0=[static-libs?,${MULTILIB_USEDEP}] |
| 43 |
) |
| 44 |
curl_ssl_nss? ( |
| 45 |
dev-libs/nss:0[${MULTILIB_USEDEP}] |
| 46 |
app-misc/ca-certificates |
| 47 |
) |
| 48 |
) |
| 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}]" |
| 57 |
|
| 58 |
# Do we need to enforce the same ssl backend for curl and rtmpdump? Bug #423303 |
| 59 |
# rtmp? ( |
| 60 |
# media-video/rtmpdump |
| 61 |
# curl_ssl_gnutls? ( media-video/rtmpdump[gnutls] ) |
| 62 |
# curl_ssl_openssl? ( media-video/rtmpdump[-gnutls,ssl] ) |
| 63 |
# ) |
| 64 |
|
| 65 |
# ssl providers to be added: |
| 66 |
# fbopenssl $(use_with spnego) |
| 67 |
|
| 68 |
DEPEND="${RDEPEND} |
| 69 |
>=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}] |
| 70 |
test? ( |
| 71 |
sys-apps/diffutils |
| 72 |
dev-lang/perl |
| 73 |
)" |
| 74 |
|
| 75 |
# c-ares must be disabled for threads |
| 76 |
# only one ssl provider can be enabled |
| 77 |
REQUIRED_USE=" |
| 78 |
curl_ssl_winssl? ( elibc_Winnt ) |
| 79 |
threads? ( !adns ) |
| 80 |
ssl? ( |
| 81 |
^^ ( |
| 82 |
curl_ssl_axtls |
| 83 |
curl_ssl_gnutls |
| 84 |
curl_ssl_libressl |
| 85 |
curl_ssl_mbedtls |
| 86 |
curl_ssl_nss |
| 87 |
curl_ssl_openssl |
| 88 |
curl_ssl_winssl |
| 89 |
) |
| 90 |
)" |
| 91 |
|
| 92 |
DOCS=( CHANGES README docs/FEATURES docs/INTERNALS.md \ |
| 93 |
docs/MANUAL docs/FAQ docs/BUGS docs/CONTRIBUTE.md ) |
| 94 |
|
| 95 |
MULTILIB_WRAPPED_HEADERS=( |
| 96 |
/usr/include/curl/curlbuild.h |
| 97 |
) |
| 98 |
|
| 99 |
MULTILIB_CHOST_TOOLS=( |
| 100 |
/usr/bin/curl-config |
| 101 |
) |
| 102 |
|
| 103 |
src_prepare() { |
| 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 |
| 107 |
|
| 108 |
sed -i '/LD_LIBRARY_PATH=/d' configure.ac || die #382241 |
| 109 |
|
| 110 |
eapply_user |
| 111 |
eprefixify curl-config.in |
| 112 |
eautoreconf |
| 113 |
|
| 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' \ |
| 117 |
configure || die |
| 118 |
fi |
| 119 |
} |
| 120 |
|
| 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/) |
| 125 |
local myconf=() |
| 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 ) |
| 128 |
if use ssl ; then |
| 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 ) |
| 150 |
else |
| 151 |
eerror "We can't be here because of REQUIRED_USE." |
| 152 |
fi |
| 153 |
else |
| 154 |
einfo "SSL disabled" |
| 155 |
fi |
| 156 |
|
| 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}" \ |
| 167 |
econf \ |
| 168 |
--enable-crypto-auth \ |
| 169 |
--enable-dict \ |
| 170 |
--enable-file \ |
| 171 |
--enable-ftp \ |
| 172 |
--enable-gopher \ |
| 173 |
--enable-http \ |
| 174 |
--enable-imap \ |
| 175 |
$(use_enable ldap) \ |
| 176 |
$(use_enable ldap ldaps) \ |
| 177 |
--disable-ntlm-wb \ |
| 178 |
--enable-pop3 \ |
| 179 |
--enable-rt \ |
| 180 |
--enable-rtsp \ |
| 181 |
$(use_enable samba smb) \ |
| 182 |
$(use_with ssh libssh2) \ |
| 183 |
--enable-smtp \ |
| 184 |
--enable-telnet \ |
| 185 |
--enable-tftp \ |
| 186 |
--enable-tls-srp \ |
| 187 |
$(use_enable adns ares) \ |
| 188 |
--enable-cookies \ |
| 189 |
--enable-hidden-symbols \ |
| 190 |
$(use_enable ipv6) \ |
| 191 |
--enable-largefile \ |
| 192 |
--without-libpsl \ |
| 193 |
--enable-manual \ |
| 194 |
--enable-proxy \ |
| 195 |
--disable-sspi \ |
| 196 |
$(use_enable static-libs static) \ |
| 197 |
$(use_enable threads threaded-resolver) \ |
| 198 |
$(use_enable threads pthreads) \ |
| 199 |
--disable-versioned-symbols \ |
| 200 |
--without-cyassl \ |
| 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) \ |
| 207 |
$(use_with brotli) \ |
| 208 |
--without-spnego \ |
| 209 |
--without-winidn \ |
| 210 |
--without-wolfssl \ |
| 211 |
--with-zlib \ |
| 212 |
"${myconf[@]}" |
| 213 |
|
| 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 |
| 218 |
fi |
| 219 |
|
| 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. |
| 224 |
libs+=( "-lz" ) |
| 225 |
priv+=( "zlib" ) |
| 226 |
if use http2; then |
| 227 |
libs+=( "-lnghttp2" ) |
| 228 |
priv+=( "libnghttp2" ) |
| 229 |
fi |
| 230 |
if use ssl && use curl_ssl_openssl; then |
| 231 |
libs+=( "-lssl" "-lcrypto" ) |
| 232 |
priv+=( "openssl" ) |
| 233 |
fi |
| 234 |
grep -q Requires.private libcurl.pc && die "need to update ebuild" |
| 235 |
libs=$(printf '|%s' "${libs[@]}") |
| 236 |
sed -i -r \ |
| 237 |
-e "/^Libs.private/s:(${libs#|})( |$)::g" \ |
| 238 |
libcurl.pc || die |
| 239 |
echo "Requires.private: ${priv[*]}" >> libcurl.pc |
| 240 |
} |
| 241 |
|
| 242 |
multilib_src_install_all() { |
| 243 |
einstalldocs |
| 244 |
prune_libtool_files --all |
| 245 |
|
| 246 |
rm -rf "${ED}"/etc/ |
| 247 |
} |