net-misc/curl: Sync with Gentoo

It's from Gentoo commit 04e6db47e478a8baba131167397e1040a6d52ddb.
This commit is contained in:
Flatcar Buildbot 2024-04-08 07:16:22 +00:00 committed by Krzesimir Nowak
parent da2bde1e9a
commit 36621c7a3c
6 changed files with 316 additions and 9 deletions

View File

@ -2,3 +2,5 @@ DIST curl-8.5.0.tar.xz 2658520 BLAKE2B cfd591f9703b9c63712dbe74494b05a80ce5a4fc4
DIST curl-8.5.0.tar.xz.asc 488 BLAKE2B d706c401aecf345398411b94c87b8f1ecc752d73d24e1a578c8c0e62732e8e476333a2a4772428c6425eb0d124b1ceee8e377cf41d60a54b6f2df5cccc0b9f23 SHA512 9c6a2e61860878cd731d951fac1bb52cd314db20439a5173a95b48da1742737e02bfb9978d65e25de6535f839e281235203599a29f252e78e0d7a83769727329
DIST curl-8.6.0.tar.xz 2630108 BLAKE2B 1b01de396008d57e154e2b5fc1acf1dd000703fa5d70b913dafea5487f0166bd8fdb63eee5c9b5af08a1ca40dd026144a791016f67c2395fcfc9c6b555929034 SHA512 359c08d88a5dec441255b36afe1a821730eca0ca8800ba52f57132b9e7d21f32457623907b4ae4876904b5e505eb1a59652372bb7de8dbd8db429dae9785e036
DIST curl-8.6.0.tar.xz.asc 488 BLAKE2B 18d7583a9aa6a278bea5a8a74461ff06f45ec418cd4542b015c74091c353b340afcc5dfe7e5e99f0b9fac7de9251164044a85e4f6665bf042636868a2c613d0a SHA512 2b835bb4b307e5e1c929b7136c5acfb9f6f06efa471ac27060336cabcfac40e02143f40434986c5e6817d4a9562b09efa8ff3168beed310a45453148cc1b5c8f
DIST curl-8.7.1.tar.xz 2707016 BLAKE2B a2a9f48d0b69c0d92fcbbda535ce55082a5243abe3ab2db80d6fa3f32fb2c98b65026d69fc45c94e966398cf9ba8d9c95b6b91f4768b54749ed3275dd21838ef SHA512 5bbde9d5648e9226f5490fa951690aaf159149345f3a315df2ba58b2468f3e59ca32e8a49734338afc861803a4f81caac6d642a4699b72c6310ebfb1f618aad2
DIST curl-8.7.1.tar.xz.asc 488 BLAKE2B 1c91d116aecc8e98d8ec3aad68b7c96f11151e6c2716f531e5d2989e9b6b1199e180603673891d7967cdcdaee1d6b5e15160ccabe9b51590e2887022db03c2ed SHA512 f98c393997c4a32f545a8982226e8cd612395210915a4576c2ce227d0f650cff341be7bf15e989d1789abf32ac4fd9c190b9250b81e650b569e8532048746b37

View File

@ -86,7 +86,7 @@ RDEPEND="
>=dev-libs/openssl-0.9.7:=[sslv3(-)=,static-libs?,${MULTILIB_USEDEP}]
)
rustls? (
net-libs/rustls-ffi:=[${MULTILIB_USEDEP}]
~net-libs/rustls-ffi-0.10.0:=[${MULTILIB_USEDEP}]
)
)
zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
@ -132,6 +132,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-respect-cflags-3.patch
"${FILESDIR}"/${P}-ipv6-configure-c99.patch
"${FILESDIR}"/${P}-mpd-stream-http-adjust_pollset.patch
"${FILESDIR}"/${PN}-8.6.0-rustls-fixes.patch
)
src_prepare() {

View File

@ -86,7 +86,7 @@ RDEPEND="
>=dev-libs/openssl-0.9.7:=[sslv3(-)=,static-libs?,${MULTILIB_USEDEP}]
)
rustls? (
net-libs/rustls-ffi:=[${MULTILIB_USEDEP}]
~net-libs/rustls-ffi-0.10.0:=[${MULTILIB_USEDEP}]
)
)
zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
@ -131,6 +131,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-prefix.patch
"${FILESDIR}"/${PN}-respect-cflags-3.patch
"${FILESDIR}"/${P}-vtls-revert-receive-max-buffer-add-test-case.patch
"${FILESDIR}"/${P}-rustls-fixes.patch
)
src_prepare() {

View File

@ -17,13 +17,13 @@ else
https://curl.se/download/${P}.tar.xz
verify-sig? ( https://curl.se/download/${P}.tar.xz.asc )
"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
fi
LICENSE="BSD curl ISC test? ( BSD-4 )"
SLOT="0"
IUSE="+adns +alt-svc brotli +ftp gnutls gopher +hsts +http2 idn +imap kerberos ldap mbedtls nghttp3 +openssl +pop3"
IUSE+=" +progress-meter rtmp rustls samba +smtp ssh ssl sslv3 static-libs test telnet +tftp websockets zstd"
IUSE+=" +psl +progress-meter rtmp rustls samba +smtp ssh ssl sslv3 static-libs test telnet +tftp websockets zstd"
# These select the default SSL implementation
IUSE+=" curl_ssl_gnutls curl_ssl_mbedtls +curl_ssl_openssl curl_ssl_rustls"
RESTRICT="!test? ( test )"
@ -69,6 +69,7 @@ RDEPEND="
>=net-libs/nghttp3-0.15.0[${MULTILIB_USEDEP}]
>=net-libs/ngtcp2-0.19.1[gnutls,ssl,-openssl,${MULTILIB_USEDEP}]
)
psl? ( net-libs/libpsl[${MULTILIB_USEDEP}] )
rtmp? ( media-video/rtmpdump[${MULTILIB_USEDEP}] )
ssh? ( >=net-libs/libssh2-1.0.0[${MULTILIB_USEDEP}] )
ssl? (
@ -84,8 +85,8 @@ RDEPEND="
openssl? (
>=dev-libs/openssl-0.9.7:=[sslv3(-)=,static-libs?,${MULTILIB_USEDEP}]
)
rustls? (
net-libs/rustls-ffi:=[${MULTILIB_USEDEP}]
rustls? ( >=net-libs/rustls-ffi-0.12.1:=[${MULTILIB_USEDEP}]
<net-libs/rustls-ffi-0.13.0:=[${MULTILIB_USEDEP}]
)
)
zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
@ -123,11 +124,13 @@ QA_CONFIG_IMPL_DECL_SKIP=(
IoctlSocket
mach_absolute_time
setmode
_fseeki64
)
PATCHES=(
"${FILESDIR}"/${PN}-prefix.patch
"${FILESDIR}"/${PN}-respect-cflags-3.patch
"${FILESDIR}"/${PN}-8.7.1-rustls-fixes.patch
)
src_prepare() {
@ -253,7 +256,7 @@ multilib_src_configure() {
$(use_with idn libidn2)
$(use_with kerberos gssapi "${EPREFIX}"/usr)
--without-libgsasl
--without-libpsl
$(use_with psl libpsl)
--without-msh3
$(use_with nghttp3)
$(use_with nghttp3 ngtcp2)
@ -344,8 +347,7 @@ multilib_src_test() {
# this ends up breaking when nproc is huge (like -j80).
# The network sandbox causes tests 241 and 1083 to fail; these are typically skipped
# as most gentoo users don't have an 'ip6-localhost'
# Required deps for 1477 are not included in the release tarball for 8.5.0
multilib_is_native_abi && emake test TFLAGS="-n -v -a -k -am -p -j$((2*$(makeopts_jobs))) !241 !1083 !1477"
multilib_is_native_abi && emake test TFLAGS="-n -v -a -k -am -p -j$((2*$(makeopts_jobs))) !241 !1083"
}
multilib_src_install() {

View File

@ -0,0 +1,252 @@
From a59683a3607bc0167ff702352d15eee1c0d658a6 Mon Sep 17 00:00:00 2001
From: Matt Jolly <Matt.Jolly@footclan.ninja>
Date: Mon, 1 Apr 2024 08:49:27 +1000
Subject: [PATCH] m4: fix rustls builds
This patch consolidates the following commits to do with rustls
detection using pkg-config:
- https://github.com/curl/curl/commit/9c4209837094781d5eef69ae6bcad0e86b64bf99
- https://github.com/curl/curl/commit/5a50cb5a18a141a463148562dab83fa3be1a3b90
---
m4/curl-rustls.m4 | 210 ++++++++++++++++++++++++++++++++--------------
1 file changed, 146 insertions(+), 64 deletions(-)
diff --git a/m4/curl-rustls.m4 b/m4/curl-rustls.m4
index 75542e4..8082cf9 100644
--- a/m4/curl-rustls.m4
+++ b/m4/curl-rustls.m4
@@ -28,84 +28,166 @@ dnl check for rustls
dnl ----------------------------------------------------
if test "x$OPT_RUSTLS" != xno; then
- _cppflags=$CPPFLAGS
- _ldflags=$LDFLAGS
ssl_msg=
- if test X"$OPT_RUSTLS" != Xno; then
+ dnl backup the pre-ssl variables
+ CLEANLDFLAGS="$LDFLAGS"
+ CLEANCPPFLAGS="$CPPFLAGS"
- if test "$OPT_RUSTLS" = "yes"; then
- OPT_RUSTLS=""
- fi
+ case $host_os in
+ darwin*)
+ LDFLAGS="$LDFLAGS -framework Security"
+ ;;
+ *)
+ ;;
+ esac
+ ## NEW CODE
- case $host_os in
- darwin*)
- LDFLAGS="$LDFLAGS -framework Security"
- ;;
- *)
- ;;
- esac
-
- if test -z "$OPT_RUSTLS" ; then
- dnl check for lib first without setting any new path
-
- AC_CHECK_LIB(rustls, rustls_client_session_read,
- dnl librustls found, set the variable
- [
- AC_DEFINE(USE_RUSTLS, 1, [if rustls is enabled])
- AC_SUBST(USE_RUSTLS, [1])
- RUSTLS_ENABLED=1
- USE_RUSTLS="yes"
- ssl_msg="rustls"
- test rustls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
- ], [], -lpthread -ldl -lm)
- fi
+ dnl use pkg-config unless we have been given a path
+ dnl even then, try pkg-config first
- if test "x$USE_RUSTLS" != "xyes"; then
- dnl add the path and test again
- addld=-L$OPT_RUSTLS/lib$libsuff
- addcflags=-I$OPT_RUSTLS/include
- rustlslib=$OPT_RUSTLS/lib$libsuff
+ case "$OPT_RUSTLS" in
+ yes)
+ dnl --with-rustls (without path) used
+ PKGTEST="yes"
+ PREFIX_RUSTLS=
+ ;;
+ *)
+ dnl check the provided --with-rustls path
+ PKGTEST="no"
+ PREFIX_RUSTLS=$OPT_RUSTLS
- LDFLAGS="$LDFLAGS $addld"
- if test "$addcflags" != "-I/usr/include"; then
- CPPFLAGS="$CPPFLAGS $addcflags"
+ dnl Try pkg-config even when cross-compiling. Since we
+ dnl specify PKG_CONFIG_LIBDIR we are only looking where
+ dnl the user told us to look
+
+ RUSTLS_PCDIR="$PREFIX_RUSTLS/lib/pkgconfig"
+ if test -f "$RUSTLS_PCDIR/rustls.pc"; then
+ AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$RUSTLS_PCDIR"])
+ PKGTEST="yes"
fi
- AC_CHECK_LIB(rustls, rustls_connection_read,
- [
- AC_DEFINE(USE_RUSTLS, 1, [if rustls is enabled])
- AC_SUBST(USE_RUSTLS, [1])
- RUSTLS_ENABLED=1
- USE_RUSTLS="yes"
- ssl_msg="rustls"
- test rustls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
- ],
- AC_MSG_ERROR([--with-rustls was specified but could not find rustls.]),
- -lpthread -ldl -lm)
- fi
+ if test "$PKGTEST" != "yes"; then
+ # try lib64 instead
+ RUSTLS_PCDIR="$PREFIX_RUSTLS/lib64/pkgconfig"
+ if test -f "$RUSTLS_PCDIR/rustls.pc"; then
+ AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$RUSTLS_PCDIR"])
+ PKGTEST="yes"
+ fi
+ fi
+
+ if test "$PKGTEST" != "yes"; then
+ dnl pkg-config came up empty, use what we got
+ dnl via --with-rustls
- if test "x$USE_RUSTLS" = "xyes"; then
- AC_MSG_NOTICE([detected rustls])
- check_for_ca_bundle=1
-
- LIBS="-lrustls -lpthread -ldl -lm $LIBS"
-
- if test -n "$rustlslib"; then
- dnl when shared libs were found in a path that the run-time
- dnl linker doesn't search through, we need to add it to
- dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
- dnl due to this
- if test "x$cross_compiling" != "xyes"; then
- CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$rustlslib"
- export CURL_LIBRARY_PATH
- AC_MSG_NOTICE([Added $rustlslib to CURL_LIBRARY_PATH])
+ addld=-L$PREFIX_RUSTLS/lib$libsuff
+ addcflags=-I$PREFIX_RUSTLS/include
+
+ LDFLAGS="$LDFLAGS $addld"
+ if test "$addcflags" != "-I/usr/include"; then
+ CPPFLAGS="$CPPFLAGS $addcflags"
+ fi
+
+ AC_CHECK_LIB(rustls, rustls_connection_read,
+ [
+ AC_DEFINE(USE_RUSTLS, 1, [if rustls is enabled])
+ AC_SUBST(USE_RUSTLS, [1])
+ RUSTLS_ENABLED=1
+ USE_RUSTLS="yes"
+ ssl_msg="rustls"
+ test rustls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
+ ],
+ AC_MSG_ERROR([--with-rustls was specified but could not find rustls.]),
+ -lpthread -ldl -lm)
+
+ USE_RUSTLS="yes"
+ ssl_msg="rustls"
+
+ LIB_RUSTLS="$PREFIX_RUSTLS/lib$libsuff"
+ if test "$PREFIX_RUSTLS" != "/usr" ; then
+ SSL_LDFLAGS="-L$LIB_RUSTLS"
+ SSL_CPPFLAGS="-I$PREFIX_RUSTLS/include"
fi
fi
+ ;;
+ esac
+
+ if test "$PKGTEST" = "yes"; then
+
+ CURL_CHECK_PKGCONFIG(rustls, [$RUSTLS_PCDIR])
+
+ if test "$PKGCONFIG" != "no" ; then
+ SSL_LIBS=`CURL_EXPORT_PCDIR([$RUSTLS_PCDIR]) dnl
+ $PKGCONFIG --libs-only-l --libs-only-other rustls 2>/dev/null`
+
+ SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$RUSTLS_PCDIR]) dnl
+ $PKGCONFIG --libs-only-L rustls 2>/dev/null`
+
+ SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$RUSTLS_PCDIR]) dnl
+ $PKGCONFIG --cflags-only-I rustls 2>/dev/null`
+
+ AC_SUBST(SSL_LIBS)
+ AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
+ AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
+ AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
+
+ LIB_RUSTLS=`echo $SSL_LDFLAGS | sed -e 's/^-L//'`
+
+ dnl use the values pkg-config reported. This is here
+ dnl instead of below with CPPFLAGS and LDFLAGS because we only
+ dnl learn about this via pkg-config. If we only have
+ dnl the argument to --with-rustls we don't know what
+ dnl additional libs may be necessary. Hope that we
+ dnl don't need any.
+ LIBS="$SSL_LIBS $LIBS"
+ USE_RUSTLS="yes"
+ ssl_msg="rustls"
+ AC_DEFINE(USE_RUSTLS, 1, [if rustls is enabled])
+ AC_SUBST(USE_RUSTLS, [1])
+ USE_RUSTLS="yes"
+ RUSTLS_ENABLED=1
+ test rustls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
+ else
+ AC_MSG_ERROR([pkg-config: Could not find rustls])
fi
- fi dnl rustls not disabled
+ else
+ dnl we did not use pkg-config, so we need to add the
+ dnl rustls lib to LIBS
+ LIBS="-lrustls -lpthread -ldl -lm $LIBS"
+ fi
+
+ dnl finally, set flags to use this TLS backend
+ CPPFLAGS="$CLEAN_CPPFLAGS $SSL_CPPFLAGS"
+ LDFLAGS="$CLAN_LDFLAGS $SSL_LDFLAGS"
+
+ if test "x$USE_RUSTLS" = "xyes"; then
+ AC_MSG_NOTICE([detected rustls])
+ check_for_ca_bundle=1
+
+ if test -n "$LIB_RUSTLS"; then
+ dnl when shared libs were found in a path that the run-time
+ dnl linker does not search through, we need to add it to
+ dnl CURL_LIBRARY_PATH so that further configure tests do not
+ dnl fail due to this
+ if test "x$cross_compiling" != "xyes"; then
+ CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$LIB_RUSTLS"
+ export CURL_LIBRARY_PATH
+ AC_MSG_NOTICE([Added $LIB_RUSTLS to CURL_LIBRARY_PATH])
+ fi
+ fi
+ fi
test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
+
+ if test X"$OPT_RUSTLS" != Xno &&
+ test "$RUSTLS_ENABLED" != "1"; then
+ AC_MSG_NOTICE([OPT_RUSTLS: $OPT_RUSTLS])
+ AC_MSG_NOTICE([RUSTLS_ENABLED: $RUSTLS_ENABLED])
+ AC_MSG_ERROR([--with-rustls was given but Rustls could not be detected])
+ fi
fi
])
+
+
+RUSTLS_ENABLED
--
2.44.0

View File

@ -0,0 +1,49 @@
From a866b062b17ab94b16b817ab9969c561364a4d72 Mon Sep 17 00:00:00 2001
From: Matt Jolly <Matt.Jolly@footclan.ninja>
Date: Mon, 1 Apr 2024 08:36:51 +1000
Subject: [PATCH] m4: fix rustls builds
This patch consolidates the following commits to do with rustls
detection using pkg-config:
- https://github.com/curl/curl/commit/9c4209837094781d5eef69ae6bcad0e86b64bf99
- https://github.com/curl/curl/commit/5a50cb5a18a141a463148562dab83fa3be1a3b90
---
m4/curl-rustls.m4 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/m4/curl-rustls.m4 b/m4/curl-rustls.m4
index 7c55230..8082cf9 100644
--- a/m4/curl-rustls.m4
+++ b/m4/curl-rustls.m4
@@ -142,6 +142,11 @@ if test "x$OPT_RUSTLS" != xno; then
LIBS="$SSL_LIBS $LIBS"
USE_RUSTLS="yes"
ssl_msg="rustls"
+ AC_DEFINE(USE_RUSTLS, 1, [if rustls is enabled])
+ AC_SUBST(USE_RUSTLS, [1])
+ USE_RUSTLS="yes"
+ RUSTLS_ENABLED=1
+ test rustls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
else
AC_MSG_ERROR([pkg-config: Could not find rustls])
fi
@@ -174,5 +179,15 @@ if test "x$OPT_RUSTLS" != xno; then
fi
test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
+
+ if test X"$OPT_RUSTLS" != Xno &&
+ test "$RUSTLS_ENABLED" != "1"; then
+ AC_MSG_NOTICE([OPT_RUSTLS: $OPT_RUSTLS])
+ AC_MSG_NOTICE([RUSTLS_ENABLED: $RUSTLS_ENABLED])
+ AC_MSG_ERROR([--with-rustls was given but Rustls could not be detected])
+ fi
fi
])
+
+
+RUSTLS_ENABLED
--
2.44.0