git: 35c73981e5fd - main - sysutils/ttyd: Only link with shared library

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Wed, 22 Feb 2023 01:52:38 UTC
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=35c73981e5fdb1f9aee2cfbc75e9cc23857459e6

commit 35c73981e5fdb1f9aee2cfbc75e9cc23857459e6
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-02-22 01:45:23 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-02-22 01:45:27 +0000

    sysutils/ttyd: Only link with shared library
    
    Due to how upstream handles libraries ttyd picks up both static and
    shared library of libwebsockets which is not intended. The least
    intrusive way I found is to simply detect it using pkgconfig instead.
    While at it, disable check for git to determine version.
    
    Reported by:    Jeff Schmidt <jeff.jschmidt@gmail.com>
    Approved by:    portmgr (blanket, build fix)
---
 sysutils/ttyd/Makefile                   |  2 ++
 sysutils/ttyd/files/patch-CMakeLists.txt | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/sysutils/ttyd/Makefile b/sysutils/ttyd/Makefile
index cb2fcce0f954..fdb1ab2c5aaf 100644
--- a/sysutils/ttyd/Makefile
+++ b/sysutils/ttyd/Makefile
@@ -18,6 +18,8 @@ USES=		cmake pkgconfig ssl
 USE_GITHUB=	yes
 GH_ACCOUNT=	tsl0922
 
+CMAKE_ARGS=	-DCMAKE_DISABLE_FIND_PACKAGE_Git:BOOL=True
+
 PLIST_FILES=	bin/${PORTNAME} \
 		share/man/man1/ttyd.1.gz
 
diff --git a/sysutils/ttyd/files/patch-CMakeLists.txt b/sysutils/ttyd/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..72c238549302
--- /dev/null
+++ b/sysutils/ttyd/files/patch-CMakeLists.txt
@@ -0,0 +1,20 @@
+--- CMakeLists.txt.orig	2023-01-18 03:42:54 UTC
++++ CMakeLists.txt
+@@ -58,11 +58,15 @@ if(JSON-C_FOUND)
+     SET(JSON-C_LIBRARIES "${JSON-C_LIBRARY}")
+ endif()
+ 
++find_package(PkgConfig REQUIRED)
+ find_package(ZLIB REQUIRED)
+-find_package(Libwebsockets 3.2.0 REQUIRED)
++pkg_search_module(LIBWEBSOCKETS REQUIRED libwebsockets>=3.2.0)
++if(LIBWEBSOCKETS_FOUND)
++  message(STATUS "Found LIBWEBSOCKETS: ${LIBWEBSOCKETS_LINK_LIBRARIES} - Version: ${LIBWEBSOCKETS_VERSION}")
++endif()
+ 
+ set(INCLUDE_DIRS ${ZLIB_INCLUDE_DIR} ${LIBWEBSOCKETS_INCLUDE_DIRS} ${JSON-C_INCLUDE_DIRS} ${LIBUV_INCLUDE_DIRS})
+-set(LINK_LIBS ${ZLIB_LIBRARIES} ${LIBWEBSOCKETS_LIBRARIES} ${JSON-C_LIBRARIES} ${LIBUV_LIBRARIES})
++set(LINK_LIBS ${ZLIB_LIBRARIES} ${LIBWEBSOCKETS_LINK_LIBRARIES} ${JSON-C_LIBRARIES} ${LIBUV_LIBRARIES})
+ 
+ set (CMAKE_REQUIRED_INCLUDES ${INCLUDE_DIRS})
+ include(CheckSymbolExists)