aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhayzamjs <hayzam@gmail.com>2026-05-11 22:00:39 +0000
committerJoseph Mingrone <jrm@FreeBSD.org>2026-05-12 18:46:38 +0000
commitc1dedb9a26877ccda761811c21900f5084bcdcf7 (patch)
tree20240f684f23f9320f0421d8a3dd4d6f0ae317d1
parent64880edb1ae15b052b6bbf7e2cfaafde907557c2 (diff)
devel/libks: Add new port
Add a new devel/libks port for SignalWire's libks support library. libks provides common C utility code used by SignalWire and related projects, including platform abstraction, threading, networking, JSON, UUID, TLS, logging, buffers, and general helper routines. Reviewed by: jrm Differential Revision: https://reviews.freebsd.org/D56907
-rw-r--r--devel/Makefile1
-rw-r--r--devel/libks/Makefile28
-rw-r--r--devel/libks/distinfo3
-rw-r--r--devel/libks/files/patch-CMakeLists.txt24
-rw-r--r--devel/libks/files/patch-cmake_ksutil.cmake21
-rw-r--r--devel/libks/files/patch-src_include_libks_ks__platform.h22
-rw-r--r--devel/libks/files/patch-src_ks__thread.c11
-rw-r--r--devel/libks/pkg-descr4
-rw-r--r--devel/libks/pkg-plist42
9 files changed, 156 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index 47afdb9ff796..ec59a73ec83f 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -1367,6 +1367,7 @@
SUBDIR += libk8055
SUBDIR += libkiwix
SUBDIR += libkiwix13
+ SUBDIR += libks
SUBDIR += libklel
SUBDIR += liblangtag
SUBDIR += liblnk
diff --git a/devel/libks/Makefile b/devel/libks/Makefile
new file mode 100644
index 000000000000..026f9c538e5b
--- /dev/null
+++ b/devel/libks/Makefile
@@ -0,0 +1,28 @@
+PORTNAME= libks
+DISTVERSIONPREFIX= v
+DISTVERSION= 2.0.10
+CATEGORIES= devel
+
+MAINTAINER= hayzam@alchemilla.io
+COMMENT= Foundational support library for SignalWire C products
+WWW= https://github.com/signalwire/libks
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/copyright
+
+LIB_DEPENDS= libuuid.so:misc/libuuid
+
+USES= cmake compiler:c11 localbase pkgconfig ssl
+USE_GITHUB= yes
+GH_ACCOUNT= signalwire
+
+USE_LDCONFIG= yes
+
+CMAKE_OFF= WITH_PACKAGING
+
+DOCSDIR= ${PREFIX}/share/doc/libks2
+
+post-patch:
+ @${FIND} ${WRKSRC} -name '*.orig' -delete
+
+.include <bsd.port.mk>
diff --git a/devel/libks/distinfo b/devel/libks/distinfo
new file mode 100644
index 000000000000..91eb3b761fc2
--- /dev/null
+++ b/devel/libks/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1778345457
+SHA256 (signalwire-libks-v2.0.10_GH0.tar.gz) = cd0d8504870c2e0e1306e55fd27dede976ab9f3a919487bc10b526576d24d568
+SIZE (signalwire-libks-v2.0.10_GH0.tar.gz) = 258971
diff --git a/devel/libks/files/patch-CMakeLists.txt b/devel/libks/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..8fd033c50389
--- /dev/null
+++ b/devel/libks/files/patch-CMakeLists.txt
@@ -0,0 +1,24 @@
+--- CMakeLists.txt.orig 2026-05-09 17:08:09 UTC
++++ CMakeLists.txt
+@@ -14,10 +14,6 @@ option(WITH_PACKAGING "Enable packaging" ON)
+ # Must include cotire before anything else for auto pch setup
+ #include(cmake/cotire.cmake)
+
+-# Load our common utility api and setup the platfomrm and build
+-include(cmake/ksutil.cmake)
+-ksutil_setup_platform()
+-
+ # Find stuff we need for packaging on UNIX
+ if(KS_PLAT_LIN AND WITH_PACKAGING)
+ find_package(Git)
+@@ -45,6 +41,10 @@ message("LibKS2 Version ${PROJECT_VERSION_MAJOR}.${PRO
+ # Declare our project, libks2
+ project(LibKS2 VERSION 2.0.10 LANGUAGES C CXX)
+ message("LibKS2 Version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
++
++# Load our common utility api and setup the platfomrm and build
++include(cmake/ksutil.cmake)
++ksutil_setup_platform()
+
+ # Set package version
+ set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
diff --git a/devel/libks/files/patch-cmake_ksutil.cmake b/devel/libks/files/patch-cmake_ksutil.cmake
new file mode 100644
index 000000000000..50371b94c370
--- /dev/null
+++ b/devel/libks/files/patch-cmake_ksutil.cmake
@@ -0,0 +1,21 @@
+--- cmake/ksutil.cmake.orig 2026-05-09 17:13:27 UTC
++++ cmake/ksutil.cmake
+@@ -130,6 +130,18 @@ macro(ksutil_setup_platform)
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
++ elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
++ message("Platform is FreeBSD")
++ set(KS_PLAT_FBSD 1 CACHE INTERNAL "Platform definition" FORCE)
++ set(CMAKE_POSITION_INDEPENDENT_CODE YES)
++
++ add_definitions("-DKS_PLAT_FBSD=1")
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
++
++ if (NOT CMAKE_INSTALL_PREFIX)
++ set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
++ set(CMAKE_PREFIX_PATH "/usr/local" CACHE INTERNAL "Prefix search path" FORCE)
++ endif()
+ else()
+ message("Platform is linux")
+ set(KS_PLAT_LIN 1 CACHE INTERNAL "Platform definition" FORCE)
diff --git a/devel/libks/files/patch-src_include_libks_ks__platform.h b/devel/libks/files/patch-src_include_libks_ks__platform.h
new file mode 100644
index 000000000000..d6c6be9e5b31
--- /dev/null
+++ b/devel/libks/files/patch-src_include_libks_ks__platform.h
@@ -0,0 +1,22 @@
+--- src/include/libks/ks_platform.h.orig 2026-05-09 17:13:32 UTC
++++ src/include/libks/ks_platform.h
+@@ -25,7 +25,7 @@ KS_BEGIN_EXTERN_C
+
+ KS_BEGIN_EXTERN_C
+
+-#if !defined(KS_PLAT_LIN) && !defined(KS_PLAT_WIN) && !defined(KS_PLAT_MAC)
++#if !defined(KS_PLAT_LIN) && !defined(KS_PLAT_WIN) && !defined(KS_PLAT_MAC) && !defined(KS_PLAT_FBSD)
+ #ifdef __linux__
+ #define KS_PLAT_LIN
+ #else
+@@ -34,6 +34,10 @@ KS_BEGIN_EXTERN_C
+ #else
+ #ifdef __APPLE__
+ #define KS_PLAT_MAC
++#else
++#ifdef __FreeBSD__
++#define KS_PLAT_FBSD
++#endif
+ #endif
+ #endif
+ #endif
diff --git a/devel/libks/files/patch-src_ks__thread.c b/devel/libks/files/patch-src_ks__thread.c
new file mode 100644
index 000000000000..8f3984a2ca2c
--- /dev/null
+++ b/devel/libks/files/patch-src_ks__thread.c
@@ -0,0 +1,11 @@
+--- src/ks_thread.c.orig 2026-05-09 17:13:52 UTC
++++ src/ks_thread.c
+@@ -76,6 +76,8 @@ KS_DECLARE(ks_pid_t) ks_thread_self_id(void)
+ return GetCurrentThreadId();
+ #elif defined(KS_PLAT_LIN)
+ return syscall(SYS_gettid);
++#elif defined(KS_PLAT_FBSD)
++ return pthread_getthreadid_np();
+ #elif defined(KS_PLAT_MAC)
+ uint64_t tid;
+ int r = pthread_threadid_np(NULL, &tid);
diff --git a/devel/libks/pkg-descr b/devel/libks/pkg-descr
new file mode 100644
index 000000000000..76d10d6c52e0
--- /dev/null
+++ b/devel/libks/pkg-descr
@@ -0,0 +1,4 @@
+libks is a foundational C support library used by SignalWire projects.
+
+It provides common platform, threading, networking, JSON, UUID, and utility
+helpers used by software such as FreeSWITCH and related SignalWire components.
diff --git a/devel/libks/pkg-plist b/devel/libks/pkg-plist
new file mode 100644
index 000000000000..338f31d02898
--- /dev/null
+++ b/devel/libks/pkg-plist
@@ -0,0 +1,42 @@
+include/libks2/libks/cmake/AddLibBacktrace.cmake
+include/libks2/libks/cmake/FindPCRE.cmake
+include/libks2/libks/cmake/LibKS2Config-release.cmake
+include/libks2/libks/cmake/LibKS2Config.cmake
+include/libks2/libks/cmake/ksutil.cmake
+include/libks2/libks/ks.h
+include/libks2/libks/ks_acl.h
+include/libks2/libks/ks_atomic.h
+include/libks2/libks/ks_base64.h
+include/libks2/libks/ks_buffer.h
+include/libks2/libks/ks_config.h
+include/libks2/libks/ks_debug.h
+include/libks2/libks/ks_dso.h
+include/libks2/libks/ks_env.h
+include/libks2/libks/ks_hash.h
+include/libks2/libks/ks_hep.h
+include/libks2/libks/ks_json.h
+include/libks2/libks/ks_json_check.h
+include/libks2/libks/ks_json_schema.h
+include/libks2/libks/ks_log.h
+include/libks2/libks/ks_metrics.h
+include/libks2/libks/ks_platform.h
+include/libks2/libks/ks_pool.h
+include/libks2/libks/ks_printf.h
+include/libks2/libks/ks_q.h
+include/libks2/libks/ks_sb.h
+include/libks2/libks/ks_socket.h
+include/libks2/libks/ks_ssl.h
+include/libks2/libks/ks_string.h
+include/libks2/libks/ks_thread_pool.h
+include/libks2/libks/ks_threadmutex.h
+include/libks2/libks/ks_time.h
+include/libks2/libks/ks_tls.h
+include/libks2/libks/ks_types.h
+include/libks2/libks/ks_utf8.h
+include/libks2/libks/ks_uuid.h
+include/libks2/libks/kws.h
+include/libks2/libks/simclist.h
+lib/libks2.so
+lib/libks2.so.2
+libdata/pkgconfig/libks2.pc
+%%DOCSDIR%%/copyright