package/libwebsockets: fix static build with openssl
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Wed, 16 Oct 2019 20:41:28 +0000 (22:41 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Mon, 21 Oct 2019 20:00:34 +0000 (22:00 +0200)
Fixes:
 - http://autobuild.buildroot.org/results/65d0528b208c0a470264f7e2433be89425971dd7

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/libwebsockets/0002-CMakeLists.txt-fix-static-build-with-openssl.patch [new file with mode: 0644]

diff --git a/package/libwebsockets/0002-CMakeLists.txt-fix-static-build-with-openssl.patch b/package/libwebsockets/0002-CMakeLists.txt-fix-static-build-with-openssl.patch
new file mode 100644 (file)
index 0000000..c5aaafa
--- /dev/null
@@ -0,0 +1,36 @@
+From faf26eee75f5d58ff499cdc40ad1af58a33fb83f Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Wed, 16 Oct 2019 20:09:13 +0200
+Subject: [PATCH] CMakeLists.txt: fix static build with openssl
+
+openssl can depends on -latomic so use pkg-config (if available) to
+retrieve these static dependencies otherwise build will fail because
+HMAC_CTX_new test will return a wrong result
+
+Fixes:
+ - http://autobuild.buildroot.org/results/65d0528b208c0a470264f7e2433be89425971dd7
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status: https://github.com/warmcat/libwebsockets/pull/1717]
+---
+ CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2693ac56..888f65e8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1803,7 +1803,10 @@ if (LWS_WITH_SSL)
+               if (NOT OPENSSL_FOUND AND NOT LWS_WITH_BORINGSSL)
+                       # TODO: Add support for STATIC also.
+               if (NOT LWS_WITH_ESP32)
++                      find_package(PkgConfig QUIET)
++                      pkg_check_modules(PC_OPENSSL openssl QUIET)
+                       find_package(OpenSSL REQUIRED)
++                      list(APPEND OPENSSL_LIBRARIES ${PC_OPENSSL_LIBRARIES})
+               endif()
+                       set(OPENSSL_INCLUDE_DIRS "${OPENSSL_INCLUDE_DIR}")
+               endif()
+-- 
+2.23.0
+