From 86e5f18408d7a569e88e715fe0ca739d7fd3f296 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sun, 6 Oct 2019 14:53:06 +0200 Subject: [PATCH] libks: new package libks is a dependency of signalwire-client-c. Signed-off-by: Sebastian Kemper --- libs/libks/Makefile | 66 +++++++++++++++++++ libs/libks/patches/01-find-libm.patch | 15 +++++ .../patches/02-correct-signal_h-include.patch | 11 ++++ libs/libks/patches/03-fix-flags.patch | 24 +++++++ .../04-don_t-override-optimization.patch | 10 +++ 5 files changed, 126 insertions(+) create mode 100644 libs/libks/Makefile create mode 100644 libs/libks/patches/01-find-libm.patch create mode 100644 libs/libks/patches/02-correct-signal_h-include.patch create mode 100644 libs/libks/patches/03-fix-flags.patch create mode 100644 libs/libks/patches/04-don_t-override-optimization.patch diff --git a/libs/libks/Makefile b/libs/libks/Makefile new file mode 100644 index 0000000..7dc82fc --- /dev/null +++ b/libs/libks/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2019 Sebastian Kemper +# +# 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 + +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))) diff --git a/libs/libks/patches/01-find-libm.patch b/libs/libks/patches/01-find-libm.patch new file mode 100644 index 0000000..f1a021a --- /dev/null +++ b/libs/libks/patches/01-find-libm.patch @@ -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) diff --git a/libs/libks/patches/02-correct-signal_h-include.patch b/libs/libks/patches/02-correct-signal_h-include.patch new file mode 100644 index 0000000..a128a8d --- /dev/null +++ b/libs/libks/patches/02-correct-signal_h-include.patch @@ -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 + #include + #include +-#include ++#include + #include + #include + #include diff --git a/libs/libks/patches/03-fix-flags.patch b/libs/libks/patches/03-fix-flags.patch new file mode 100644 index 0000000..937e382 --- /dev/null +++ b/libs/libks/patches/03-fix-flags.patch @@ -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}) diff --git a/libs/libks/patches/04-don_t-override-optimization.patch b/libs/libks/patches/04-don_t-override-optimization.patch new file mode 100644 index 0000000..32c5512 --- /dev/null +++ b/libs/libks/patches/04-don_t-override-optimization.patch @@ -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("$<$:-O2>") + add_compile_options("$<$:-g>") + + add_compile_options("$<$:-O0>") -- 2.30.2