You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.8 KiB

  1. #
  2. # Copyright (C) 2018 Jianhui Zhao
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=libuwsc
  9. PKG_VERSION:=3.3.2
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL=https://github.com/zhaojh329/libuwsc/releases/download/v$(PKG_VERSION)
  13. PKG_HASH:=bae2cd13eda86876ebcf99a38a069f5e8c01717713d2fec25031051b9c47624b
  14. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  15. PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=LICENSE
  18. PKG_BUILD_PARALLEL:=1
  19. CMAKE_INSTALL:=1
  20. PKG_CONFIG_DEPENDS:= \
  21. CONFIG_LIBUWSC_openssl_LUA_BINDING \
  22. CONFIG_LIBUWSC_wolfssl_LUA_BINDING \
  23. CONFIG_LIBUWSC_mbedtls_LUA_BINDING \
  24. CONFIG_LIBUWSC_nossl_LUA_BINDING
  25. include $(INCLUDE_DIR)/package.mk
  26. include $(INCLUDE_DIR)/cmake.mk
  27. define Package/libuwsc/Default
  28. SECTION:=libs
  29. CATEGORY:=Libraries
  30. SUBMENU:=Networking
  31. TITLE:=A lightweight WebSocket client library based on libev
  32. URL:=https://github.com/zhaojh329/libuwsc
  33. DEPENDS:=+libev $(2)
  34. VARIANT:=$(1)
  35. PROVIDES:=libuwsc
  36. endef
  37. Package/libuwsc-openssl=$(call Package/libuwsc/Default,openssl,+PACKAGE_libuwsc-openssl:libopenssl)
  38. Package/libuwsc-wolfssl=$(call Package/libuwsc/Default,wolfssl,+PACKAGE_libuwsc-wolfssl:libwolfssl)
  39. Package/libuwsc-mbedtls=$(call Package/libuwsc/Default,mbedtls,+PACKAGE_libuwsc-mbedtls:libmbedtls)
  40. Package/libuwsc-nossl=$(call Package/libuwsc/Default,nossl)
  41. define Package/libuwsc/config
  42. menu "Configuration"
  43. depends on PACKAGE_libuwsc-$(1)
  44. config LIBUWSC_$(1)_LUA_BINDING
  45. bool
  46. default n
  47. prompt "Lua binding for libuwsc"
  48. endmenu
  49. endef
  50. Package/libuwsc-openssl/config=$(call Package/libuwsc/config,openssl)
  51. Package/libuwsc-wolfssl/config=$(call Package/libuwsc/config,wolfssl)
  52. Package/libuwsc-mbedtls/config=$(call Package/libuwsc/config,mbedtls)
  53. Package/libuwsc-nossl/config=$(call Package/libuwsc/config,nossl)
  54. ifeq ($(BUILD_VARIANT),openssl)
  55. CMAKE_OPTIONS += -DUWSC_USE_OPENSSL=ON
  56. else ifeq ($(BUILD_VARIANT),wolfssl)
  57. CMAKE_OPTIONS += -DUWSC_USE_WOLFSSL=ON
  58. else ifeq ($(BUILD_VARIANT),mbedtls)
  59. CMAKE_OPTIONS += -DUWSC_USE_MBEDTLS=ON
  60. else
  61. CMAKE_OPTIONS += -DUWSC_SSL_SUPPORT=OFF
  62. endif
  63. ifneq ($(CONFIG_LIBUWSC_$(BUILD_VARIANT)_LUA_BINDING),)
  64. CMAKE_OPTIONS += -DUWSC_LUA_SUPPORT=ON
  65. endif
  66. define Package/libuwsc-$(BUILD_VARIANT)/install
  67. $(INSTALL_DIR) $(1)/usr/lib
  68. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuwsc.so* $(1)/usr/lib/
  69. ifneq ($(CONFIG_LIBUWSC_$(BUILD_VARIANT)_LUA_BINDING),)
  70. $(INSTALL_DIR) $(1)/usr/lib/lua
  71. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lua/uwsc.so $(1)/usr/lib/lua
  72. endif
  73. endef
  74. $(eval $(call BuildPackage,libuwsc-openssl))
  75. $(eval $(call BuildPackage,libuwsc-wolfssl))
  76. $(eval $(call BuildPackage,libuwsc-mbedtls))
  77. $(eval $(call BuildPackage,libuwsc-nossl))