libks: new package

libks is a dependency of signalwire-client-c.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
This commit is contained in:
Sebastian Kemper 2019-10-06 14:53:06 +02:00
parent 505fb3846d
commit 86e5f18408
5 changed files with 126 additions and 0 deletions

66
libs/libks/Makefile Normal file
View file

@ -0,0 +1,66 @@
#
# Copyright (C) 2019 Sebastian Kemper <sebastian_ml@gmx.net>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libks
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/signalwire/$(PKG_NAME).git
PKG_SOURCE_DATE=2019-09-18
PKG_SOURCE_VERSION:=df72c4c61a2deed414541735086d03259aec9679
PKG_RELEASE:=1
PKG_MIRROR_HASH:=3005101d3c80ec7d03d2097e538506a5090ded65b71169c279194ab950fd7cb5
PKG_BUILD_PARALLEL:=1
CMAKE_INSTALL:=1
PKG_LICENSE:= \
BSD-1-Clause \
BSD-3-Clause \
ISC \
MIT \
PUBLICDOMAIN \
twofish
PKG_LICENSE_FILES:=copyright
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/$(PKG_NAME)
SUBMENU:=Telephony
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Foundational support for SignalWire C products
URL:=https://github.com/signalwire/libks
ABI_VERSION:=1
DEPENDS:=+libatomic +libopenssl +libuuid
endef
# Otherwise OpenWrt's CPPFLAGS are ignored
TARGET_CFLAGS += $(TARGET_CPPFLAGS)
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/$(PKG_NAME)
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/$(PKG_NAME)/*.h \
$(1)/usr/include/$(PKG_NAME)
$(INSTALL_DIR) $(1)/usr/lib/{cmake/$(PKG_NAME),pkgconfig}
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/$(PKG_NAME)/cmake/* \
$(1)/usr/lib/cmake/$(PKG_NAME)
$(CP) $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME).so* $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/$(PKG_NAME).pc \
$(1)/usr/lib/pkgconfig
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME).so.$(ABI_VERSION)* $(1)/usr/lib
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View file

@ -0,0 +1,15 @@
--- a/cmake/FindLibM.cmake
+++ b/cmake/FindLibM.cmake
@@ -8,11 +8,7 @@
# A user may set ``LIBM_ROOT`` to a math library installation root to tell this
# module where to look.
-find_path(LIBM_INCLUDE_DIRS
- NAMES math.h
- PATHS /usr/include /usr/local/include /usr/local/bic/include
- NO_DEFAULT_PATH
-)
+find_path(LIBM_INCLUDE_DIRS math.h)
find_library(LIBM_LIBRARIES m)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibM DEFAULT_MSG LIBM_LIBRARIES LIBM_INCLUDE_DIRS)

View file

@ -0,0 +1,11 @@
--- a/src/include/libks/ks_platform.h
+++ b/src/include/libks/ks_platform.h
@@ -91,7 +91,7 @@ KS_BEGIN_EXTERN_C
#include <sys/time.h>
#include <sys/select.h>
#include <netinet/tcp.h>
-#include <sys/signal.h>
+#include <signal.h>
#include <unistd.h>
#include <strings.h>
#include <stdint.h>

View file

@ -0,0 +1,24 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,10 @@ option(WITH_LIBBACKTRACE "Enables linkin
# Must include cotire before anything else for auto pch setup
include(cmake/cotire.cmake)
+# Declare our project, libks
+project(LibKS VERSION 1.3.0 LANGUAGES C CXX)
+message("LibKS 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()
@@ -39,10 +43,6 @@ if (KS_PLAT_WIN OR WITH_KS_TEST)
endif()
endif()
-# Declare our project, libks
-project(LibKS VERSION 1.3.0 LANGUAGES C CXX)
-message("LibKS Version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
-
# Set package version
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})

View file

@ -0,0 +1,10 @@
--- a/cmake/ksutil.cmake
+++ b/cmake/ksutil.cmake
@@ -135,7 +135,6 @@ macro(ksutil_setup_platform)
set(KS_PLAT_LIN 1 CACHE INTERNAL "Platform definition" FORCE)
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
- add_compile_options("$<$<CONFIG:Release>:-O2>")
add_compile_options("$<$<CONFIG:Release>:-g>")
add_compile_options("$<$<CONFIG:Debug>:-O0>")