diff mbox series

[1/1] package/libwebsockets: fix wolfssl build

Message ID 20231226221952.2006884-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [1/1] package/libwebsockets: fix wolfssl build | expand

Commit Message

Fabrice Fontaine Dec. 26, 2023, 10:19 p.m. UTC
Fix the following wolfssl build failure raised since commit
d6319d97a7864314088dcc6d1199f35029cfcecb:

-- Checking for one of the modules 'wolfssl'
CMake Error at lib/tls/CMakeLists.txt:79 (message):
  You must set LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS when
  LWS_WITH_WOLFSSL is turned on.

Fixes:
 - http://autobuild.buildroot.org/results/fe062b9f0b330e71309334d7605d64ea73761b59

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...eLists.txt-fix-build-with-pkg-config.patch | 46 +++++++++++++++++++
 package/libwebsockets/libwebsockets.mk        |  2 +-
 2 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 package/libwebsockets/0002-lib-tls-CMakeLists.txt-fix-build-with-pkg-config.patch

Comments

Thomas Petazzoni Jan. 5, 2024, 1:03 p.m. UTC | #1
Hello Fabrice,

On Tue, 26 Dec 2023 23:19:52 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fix the following wolfssl build failure raised since commit
> d6319d97a7864314088dcc6d1199f35029cfcecb:
> 
> -- Checking for one of the modules 'wolfssl'
> CMake Error at lib/tls/CMakeLists.txt:79 (message):
>   You must set LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS when
>   LWS_WITH_WOLFSSL is turned on.

Ideally, in such cases, it would be nice to extend a little bit the
commit log to explain how the issue is resolved: "adding a patch that
does XYZ, and making the wolfssl dependency only trigger when
BR2_PACKAGE_WOLFSSL_ALL=y because ...".

> +Fixes:
> + - http://autobuild.buildroot.org/results/fe062b9f0b330e71309334d7605d64ea73761b59
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

The Upstream: tag was missing here. So I dug in the upstream repo, and
found that your fix had been merged, so I added a reference to it here.

Applied, thanks a lot!

Thomas
Peter Korsgaard Jan. 12, 2024, 6:01 p.m. UTC | #2
>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > Fix the following wolfssl build failure raised since commit
 > d6319d97a7864314088dcc6d1199f35029cfcecb:

 > -- Checking for one of the modules 'wolfssl'
 > CMake Error at lib/tls/CMakeLists.txt:79 (message):
 >   You must set LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS when
 >   LWS_WITH_WOLFSSL is turned on.

 > Fixes:
 >  - http://autobuild.buildroot.org/results/fe062b9f0b330e71309334d7605d64ea73761b59

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Committed to 2023.02.x and 2023.11.x, thanks.
diff mbox series

Patch

diff --git a/package/libwebsockets/0002-lib-tls-CMakeLists.txt-fix-build-with-pkg-config.patch b/package/libwebsockets/0002-lib-tls-CMakeLists.txt-fix-build-with-pkg-config.patch
new file mode 100644
index 0000000000..06df61abf5
--- /dev/null
+++ b/package/libwebsockets/0002-lib-tls-CMakeLists.txt-fix-build-with-pkg-config.patch
@@ -0,0 +1,46 @@ 
+From 786ec9231e402cd4e7621483be6f1837de724e3c Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Tue, 26 Dec 2023 22:38:18 +0100
+Subject: [PATCH] lib/tls/CMakeLists.txt: fix build with pkg-config
+
+Fix the following wolfssl build failure raised since
+https://github.com/warmcat/libwebsockets/commit/079726c4b252e795b208209752077c1ae4504b5b:
+
+-- Checking for one of the modules 'wolfssl'
+CMake Error at lib/tls/CMakeLists.txt:79 (message):
+  You must set LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS when
+  LWS_WITH_WOLFSSL is turned on.
+
+Fixes:
+ - http://autobuild.buildroot.org/results/fe062b9f0b330e71309334d7605d64ea73761b59
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ lib/tls/CMakeLists.txt | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/lib/tls/CMakeLists.txt b/lib/tls/CMakeLists.txt
+index 80b46203..230b0d29 100644
+--- a/lib/tls/CMakeLists.txt
++++ b/lib/tls/CMakeLists.txt
+@@ -72,12 +72,16 @@ if (LWS_WITH_SSL AND LWS_WITH_WOLFSSL)
+ 		include (FindPkgConfig)
+ 		PKG_SEARCH_MODULE(LWS_WOLFSSL wolfssl)
+ 
+-		if (NOT WOLFSSL_FOUND)
++		if (NOT LWS_WOLFSSL_FOUND)
+ 			if (LWS_WITH_CYASSL)
+ 				message(FATAL_ERROR "You must set LWS_CYASSL_LIBRARIES and LWS_CYASSL_INCLUDE_DIRS when LWS_WITH_CYASSL is turned on.")
+ 			else()
+ 				message(FATAL_ERROR "You must set LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS when LWS_WITH_WOLFSSL is turned on.")
+ 			endif()
++		else()
++			set(WOLFSSL_LIBRARIES ${LWS_WOLFSSL_LIBRARIES})
++			set(WOLFSSL_INCLUDE_DIRS ${LWS_WOLFSSL_INCLUDE_DIRS})
++			set(WOLFSSL_FOUND 1)
+ 		endif()
+ 	else()
+ 		set(WOLFSSL_LIBRARIES ${LWS_WOLFSSL_LIBRARIES})
+-- 
+2.43.0
+
diff --git a/package/libwebsockets/libwebsockets.mk b/package/libwebsockets/libwebsockets.mk
index 86756ca612..daf481b3bc 100644
--- a/package/libwebsockets/libwebsockets.mk
+++ b/package/libwebsockets/libwebsockets.mk
@@ -42,7 +42,7 @@  LIBWEBSOCKETS_CONF_OPTS += \
 	-DLWS_WITH_SSL=ON \
 	-DLWS_WITH_MBEDTLS=ON \
 	-DLWS_WITH_WOLFSSL=OFF
-else ifeq ($(BR2_PACKAGE_WOLFSSL),y)
+else ifeq ($(BR2_PACKAGE_WOLFSSL_ALL),y)
 LIBWEBSOCKETS_DEPENDENCIES += host-pkgconf wolfssl
 LIBWEBSOCKETS_CONF_OPTS += \
 	-DLWS_WITH_SSL=ON \