Skip to content

Commit

Permalink
net/libwebsockets: Fix build with LibreSSL
Browse files Browse the repository at this point in the history
The build system uses both cmake and pkg-config to find OpenSSL and just
combines the results. Our base OpenSSL didn't provide a pkg-config file
until recently, but the LibreSSL port does. From the cmake detection, we
get absolute library paths, from pkg-config just library names (-lssl).
The latter are found in base during linking. The result is linking both
OpenSSL and LibreSSL.

Therefore add a patch that just skips pkg-config for OpenSSL and remove
the broken workaround from the port Makefile.

PR:		271495
Approved by:	tcberner (mentor, implicit)
  • Loading branch information
Zirias committed May 19, 2023
1 parent 93ebb11 commit 986cbcf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
8 changes: 1 addition & 7 deletions net/libwebsockets/Makefile
@@ -1,6 +1,7 @@
PORTNAME= libwebsockets
DISTVERSIONPREFIX= v
DISTVERSION= 4.3.2
PORTREVISION= 1
CATEGORIES= net devel
MASTER_SITES= https://libwebsockets.org/git/libwebsockets/snapshot/

Expand Down Expand Up @@ -80,11 +81,4 @@ LIBEVENT_CMAKE_BOOL= LWS_WITH_LIBEVENT
LIBUV_LIB_DEPENDS= libuv.so:devel/libuv
LIBUV_CMAKE_BOOL= LWS_WITH_LIBUV

.include <bsd.port.options.mk>

# Allow usage of LibreSSL via OPENSSL option
.if ${PORT_OPTIONS:MOPENSSL} && ${SSL_DEFAULT} == libressl
CMAKE_ARGS+= -DLWS_OPENSSL_LIBRARIES='${OPENSSLLIB}/libtls.so;${OPENSSLLIB}/libssl.so;${OPENSSLLIB}/libcrypto.so' -DLWS_OPENSSL_INCLUDE_DIRS=${OPENSSLINC}/ssl
.endif

.include <bsd.port.mk>
19 changes: 19 additions & 0 deletions net/libwebsockets/files/patch-lib_tls_CMakeLists.txt
@@ -0,0 +1,19 @@
Disable usage of pkg-config for OpenSSL to avoid linking two different versions.
See PRs: 258345, 271495

--- lib/tls/CMakeLists.txt.orig 2023-05-19 06:48:43 UTC
+++ lib/tls/CMakeLists.txt
@@ -264,10 +264,10 @@ if (LWS_WITH_SSL)
if (NOT OPENSSL_FOUND AND NOT LWS_WITH_BORINGSSL)
# TODO: Add support for STATIC also.
if (NOT LWS_PLAT_FREERTOS)
- find_package(PkgConfig QUIET)
- pkg_check_modules(PC_OPENSSL openssl QUIET)
+ #find_package(PkgConfig QUIET)
+ #pkg_check_modules(PC_OPENSSL openssl QUIET)
find_package(OpenSSL REQUIRED)
- list(APPEND OPENSSL_LIBRARIES ${PC_OPENSSL_LIBRARIES})
+ #list(APPEND OPENSSL_LIBRARIES ${PC_OPENSSL_LIBRARIES})
set(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} PARENT_SCOPE)
endif()
set(OPENSSL_INCLUDE_DIRS "${OPENSSL_INCLUDE_DIR}")

0 comments on commit 986cbcf

Please sign in to comment.