diff mbox series

[v2] curl: fix mbedtls detection

Message ID 20260601140704.1194736-1-ross.burton@arm.com
State Under Review
Headers show
Series [v2] curl: fix mbedtls detection | expand

Commit Message

Ross Burton June 1, 2026, 2:07 p.m. UTC
The mbedtls detection logic in curl is broken and resulted in build
paths leaking into curl-config and libcurl.pc.  Backport a patch to fix
the detection by looking for a symbol that wasn't removed in mbedtls 3.0
five years ago, and remove the explicit sysroot reference as it is no
longer needed.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-support/curl/curl/mbedtls.patch | 41 ++++++++++++++++++++
 meta/recipes-support/curl/curl_8.19.0.bb     |  3 +-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/curl/curl/mbedtls.patch
diff mbox series

Patch

diff --git a/meta/recipes-support/curl/curl/mbedtls.patch b/meta/recipes-support/curl/curl/mbedtls.patch
new file mode 100644
index 0000000000..f2f2c457aa
--- /dev/null
+++ b/meta/recipes-support/curl/curl/mbedtls.patch
@@ -0,0 +1,41 @@ 
+From 50b1408f97d9e8fc585c5351cbf86bf60a30eb59 Mon Sep 17 00:00:00 2001
+From: Viktor Szakats <commit@vsz.me>
+Date: Sat, 23 May 2026 01:05:10 +0200
+Subject: [PATCH] autotools: mbedtls detection fixes
+
+- fix symbol used for first-round detection.
+- skip detecting mbedtls on custom path if custom path was not supplied.
+
+Reported-by: Ross Burton
+Fixes #21727
+
+Closes #21729
+
+Upstream-Status: Backport [https://github.com/curl/curl/commit/50b1408f97d9e8fc585c5351cbf86bf60a30eb59]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ m4/curl-mbedtls.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/m4/curl-mbedtls.m4 b/m4/curl-mbedtls.m4
+index 7c5bccd22983..6887302592d6 100644
+--- a/m4/curl-mbedtls.m4
++++ b/m4/curl-mbedtls.m4
+@@ -42,7 +42,7 @@ if test "x$OPT_MBEDTLS" != "xno"; then
+     if test -z "$OPT_MBEDTLS"; then
+       dnl check for lib first without setting any new path
+ 
+-      AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
++      AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
+       dnl libmbedtls found, set the variable
+       [
+         AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
+@@ -58,7 +58,7 @@ if test "x$OPT_MBEDTLS" != "xno"; then
+     addcflags=""
+     mbedtlslib=""
+ 
+-    if test "$USE_MBEDTLS" != "yes"; then
++    if test "$USE_MBEDTLS" != "yes" && test -n "$OPT_MBEDTLS"; then
+       dnl add the path and test again
+       addld=-L$OPT_MBEDTLS/lib$libsuff
+       addcflags=-I$OPT_MBEDTLS/include
diff --git a/meta/recipes-support/curl/curl_8.19.0.bb b/meta/recipes-support/curl/curl_8.19.0.bb
index b9251336b8..4287b7b7da 100644
--- a/meta/recipes-support/curl/curl_8.19.0.bb
+++ b/meta/recipes-support/curl/curl_8.19.0.bb
@@ -14,6 +14,7 @@  SRC_URI = " \
     file://run-ptest \
     file://disable-tests \
     file://no-test-timeout.patch \
+    file://mbedtls.patch \
 "
 
 SRC_URI:append:class-nativesdk = " \
@@ -56,7 +57,7 @@  PACKAGECONFIG[ldaps] = "--enable-ldaps,--disable-ldaps,openldap"
 PACKAGECONFIG[libgsasl] = "--with-libgsasl,--without-libgsasl,libgsasl"
 PACKAGECONFIG[libidn] = "--with-libidn2,--without-libidn2,libidn2"
 PACKAGECONFIG[libssh2] = "--with-libssh2,--without-libssh2,libssh2"
-PACKAGECONFIG[mbedtls] = "--with-mbedtls=${STAGING_DIR_TARGET},--without-mbedtls,mbedtls"
+PACKAGECONFIG[mbedtls] = "--with-mbedtls,--without-mbedtls,mbedtls"
 PACKAGECONFIG[mqtt] = "--enable-mqtt,--disable-mqtt,"
 PACKAGECONFIG[negotiate-auth] = "--enable-negotiate-auth,--disable-negotiate-auth"
 PACKAGECONFIG[nghttp2] = "--with-nghttp2,--without-nghttp2,nghttp2"