Skip to content

Commit

Permalink
devel/libks: Add libks version 2.0.6
Browse files Browse the repository at this point in the history
Foundational support for signalwire C products

Packaged in wip by Rob Goodall
  • Loading branch information
Rob Goodall committed Feb 2, 2025
1 parent 199aac5 commit 9cb03ae
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,7 @@ SUBDIR+= libjdksmidi
SUBDIR+= libjingle
SUBDIR+= libjxl
SUBDIR+= libkml
SUBDIR+= libks
SUBDIR+= liblingoteach
SUBDIR+= libltc
SUBDIR+= libm4ri
Expand Down
1 change: 1 addition & 0 deletions libks/DESCR
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Foundational support for signalwire C products
27 changes: 27 additions & 0 deletions libks/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# $NetBSD$

GITHUB_TAG= v${PKGVERSION_NOREV}
DISTNAME= libks-2.0.6
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GITHUB:=signalwire/}

MAINTAINER= rob@buglawton.com
HOMEPAGE= https://github.com/signalwire/libks/
COMMENT= Foundational support for signalwire C products
LICENSE= mit AND public-domain AND modified-bsd

USE_TOOLS+= cmake pkg-config
USE_LANGUAGES= c c++
WRKSRC= ${WRKDIR}/${DISTNAME}
PKGCONFIG_OVERRIDE+= libks.pc.in
MAKE_ENV+= GCC=yes

CMAKE_ARGS+= -DCMAKE_BUILD_TYPE=Release
CMAKE_ARGS+= -DCMAKE_INSTALL_PREFIX:PATH=/usr/pkg


.include "../../devel/libuuid/buildlink3.mk"
.include "../../misc/rhash/buildlink3.mk"
.include "../../devel/cmake/build.mk"
.include "../../mk/pthread.builtin.mk"
.include "../../mk/bsd.pkg.mk"
40 changes: 40 additions & 0 deletions libks/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@comment $NetBSD$
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_json.h
include/libks2/libks/ks_json_check.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_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
lib/pkgconfig/libks2.pc
share/doc/libks2/copyright
13 changes: 13 additions & 0 deletions libks/buildlink3.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# $NetBSD: buildlink3.mk,v 1.6 2023/10/21 17:09:53 gdt Exp $

BUILDLINK_TREE+= libks

.if !defined(LIBKS_BUILDLINK3_MK)
LIBKS_BUILDLINK3_MK:=

BUILDLINK_API_DEPENDS.libks+= libks>=2.0.6
BUILDLINK_PKGSRCDIR.libks?= ../../wip/libks

.endif # LIBKS_BUILDLINK3_MK

BUILDLINK_TREE+= -libks
8 changes: 8 additions & 0 deletions libks/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$NetBSD$

SHA1 (libks-2.0.6.tar.gz) = cce1f2f22586443fc70fcb6e1f97ffc86d5a321b
RMD160 (libks-2.0.6.tar.gz) = 3c9bcf56c4c2c762d8d094d0a7a3726436523e2a
Size (libks-2.0.6.tar.gz) = 238880 bytes
SHA1 (patch-CMakeLists.txt) = d019b9c8f46a01a87394c5aa3f4eed071d14be25
SHA1 (patch-cmake_ksutil.cmake) = e4ab71a407582c954a9f929e4e6d6192831b0d4e
SHA1 (patch-src_ks__thread.c) = 6180a7e02f68377ba4fd3e287ffffe7a35063f9d
14 changes: 14 additions & 0 deletions libks/patches/patch-CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$NetBSD$

Work around. Skip tests.

--- CMakeLists.txt.orig 2024-07-23 20:48:07.000000000 +0000
+++ CMakeLists.txt 2024-09-19 17:08:21.421459585 +0000
@@ -610,7 +610,6 @@

# Add tests
enable_testing()
-add_subdirectory(tests)

if (WITH_KS_TEST)
enable_testing()
32 changes: 32 additions & 0 deletions libks/patches/patch-cmake_ksutil.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$NetBSD$

Added options for UNIX (not Mac, Windows or Linux).

--- cmake/ksutil.cmake.orig 2024-07-23 20:48:07.000000000 +0000
+++ cmake/ksutil.cmake
@@ -114,6 +114,25 @@ macro(ksutil_setup_platform)
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
add_definitions("-DKS_PLAT_MAC=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
+ elseif (UNIX)
+ message("Platform is UNIX")
+ set(KS_PLAT_UNIX 1 CACHE INTERNAL "Platform definition" FORCE)
+ add_compile_options("$<$<CONFIG:Release>:-O2>")
+ add_compile_options("$<$<CONFIG:Release>:-g>")
+ add_compile_options("$<$<CONFIG:Release>:-Wno-parentheses>")
+ add_compile_options("$<$<CONFIG:Release>:-Wno-pointer-sign>")
+ add_compile_options("$<$<CONFIG:Release>:-Wno-switch>")
+
+ add_compile_options("$<$<CONFIG:Debug>:-O0>")
+ add_compile_options("$<$<CONFIG:Debug>:-g>")
+ add_compile_options("$<$<CONFIG:Debug>:-DKS_BUILD_DEBUG=1>")
+ add_compile_options("$<$<CONFIG:Debug>:-Wno-parentheses>")
+ add_compile_options("$<$<CONFIG:Debug>:-Wno-pointer-sign>")
+ add_compile_options("$<$<CONFIG:Debug>:-Wno-switch>")
+
+ set(CMAKE_POSITION_INDEPENDENT_CODE YES)
+ add_definitions("-DKS_PLAT_UNIX=1")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
elseif (WIN32)
message("Platform is windows")
set(KS_PLAT_WIN 1 CACHE INTERNAL "Platform definition" FORCE)
15 changes: 15 additions & 0 deletions libks/patches/patch-src_ks__thread.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$NetBSD$

Add extra field required by pthread_setname_np.

--- src/ks_thread.c.orig 2024-07-23 20:48:07.000000000 +0000
+++ src/ks_thread.c
@@ -169,7 +169,7 @@ static void *KS_THREAD_CALLING_CONVENTIO
pthread_setname_np(thread->tag);
#else
if (thread->tag && pthread_setname_np)
- pthread_setname_np(pthread_self(), thread->tag);
+ pthread_setname_np(pthread_self(), thread->tag, NULL);
#endif

ks_log(KS_LOG_DEBUG, "START call user thread callback with address: %p, tid: %8.8x\n", (void *)thread, thread->id);

0 comments on commit 9cb03ae

Please # to comment.