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.

188 lines
5.6 KiB

  1. #
  2. # Copyright (C) 2017 OpenWrt.org
  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_LICENSE:=ASL-2.0
  9. PKG_MAINTAINER:=Mislav Novakovic <mislav.novakovic@sartura.hr>
  10. PKG_NAME:=sysrepo
  11. PKG_VERSION:=0.7.7
  12. PKG_RELEASE:=3
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  14. PKG_SOURCE_URL:=https://codeload.github.com/sysrepo/sysrepo/tar.gz/v$(PKG_VERSION)?
  15. PKG_HASH:=2bf8cb4d810d19231eba1e549f58f3a0ce068d170a5e7b212b927396098560e4
  16. CMAKE_INSTALL:=1
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_INSTALL:=1
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/cmake.mk
  21. ifeq ($(CONFIG_SYSREPO_PYTHON),y)
  22. $(call include_mk, python-package.mk)
  23. endif
  24. define Package/libsysrepo/config
  25. source "$(SOURCE)/Config_libsysrepo.in"
  26. endef
  27. PKG_BUILD_DEPENDS:=+SYSREPO_BINDINGS:swig/host
  28. define Package/libsysrepo
  29. SECTION:=utils
  30. CATEGORY:=Utilities
  31. URL:=$(PKG_SOURCE_URL)
  32. TITLE:=YANG-based data store library
  33. DEPENDS:=+libyang +libprotobuf-c +libev +libredblack +librt +libpthread +SYSREPO_BINDINGS:libstdcpp +SYSREPO_PYTHON:python-base +SYSREPO_LUA:lua
  34. MENU:=1
  35. endef
  36. define Package/sysrepo
  37. SECTION:=utils
  38. CATEGORY:=Utilities
  39. URL:=$(PKG_SOURCE_URL)
  40. TITLE:=YANG-based data store daemon and plugin
  41. DEPENDS:=+libsysrepo
  42. endef
  43. define Package/sysrepoctl
  44. SECTION:=utils
  45. CATEGORY:=Utilities
  46. URL:=$(PKG_SOURCE_URL)
  47. TITLE:=sysrepo cli tool
  48. DEPENDS:=+libsysrepo
  49. endef
  50. define Package/sysrepocfg
  51. SECTION:=utils
  52. CATEGORY:=Utilities
  53. URL:=$(PKG_SOURCE_URL)
  54. TITLE:=sysrepo configuration tool
  55. DEPENDS:=+libsysrepo
  56. endef
  57. define Package/sysrepo/description
  58. Sysrepo is an YANG-based configuration and operational state data store for Unix/Linux applications.
  59. endef
  60. CMAKE_OPTIONS += \
  61. -DCMAKE_BUILD_TYPE:STRING=Release \
  62. -DUSE_AVL_LIB:BOOL=FALSE \
  63. -DENABLE_TESTS:BOOL=FALSE \
  64. -DBUILD_EXAMPLES:BOOL=FALSE \
  65. -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=TRUE \
  66. -DGEN_LANGUAGE_BINDINGS:BOOL=FALSE \
  67. -DGEN_PYTHON_BINDINGS=0 \
  68. -DGEN_LUA_BINDINGS=0 \
  69. -DREPOSITORY_LOC:PATH=/etc/sysrepo \
  70. -DCMAKE_INSTALL_PREFIX:PATH=/usr \
  71. -DENABLE_NACM:BOOL=FALSE \
  72. -DREQUEST_TIMEOUT=6 \
  73. -DLONG_REQUEST_TIMEOUT=30 \
  74. -DCOMMIT_VERIFY_TIMEOUT=20 \
  75. -DOPER_DATA_PROVIDE_TIMEOUT=4 \
  76. -DNOTIF_AGE_TIMEOUT=120 \
  77. -DNOTIF_TIME_WINDOW=20 \
  78. -DUSE_SR_MEM_MGMT=0 \
  79. -DFILE_FORMAT_EXT:STRING=xml
  80. ifeq ($(CONFIG_SYSREPO_LUA),y)
  81. CMAKE_OPTIONS += \
  82. -DGEN_LUA_BINDINGS:BOOL=TRUE \
  83. -DGEN_LUA_VERSION=5.1
  84. endif
  85. ifeq ($(CONFIG_SYSREPO_PYTHON),y)
  86. CMAKE_OPTIONS += \
  87. -DGEN_PYTHON_BINDINGS:BOOL=TRUE \
  88. -DGEN_PYTHON_VERSION=2
  89. endif
  90. ifeq ($(CONFIG_SYSREPO_BINDINGS),y)
  91. CMAKE_OPTIONS += \
  92. -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=FALSE \
  93. -DGEN_LANGUAGE_BINDINGS:BOOL=TRUE \
  94. -DSWIG_DIR=$(STAGING_DIR)/host/share/swig \
  95. -DCALL_TARGET_BINS_DIRECTLY=OFF
  96. endif
  97. define Package/libsysrepo/install
  98. $(INSTALL_DIR) $(1)/usr/lib
  99. $(CP) $(PKG_BUILD_DIR)/src/libsysrepo.so* $(1)/usr/lib/
  100. $(INSTALL_DIR) $(1)/etc/sysrepo/yang/internal
  101. $(INSTALL_CONF) $(PKG_BUILD_DIR)/yang/sysrepo-module-dependencies.yang $(1)/etc/sysrepo/yang/internal
  102. $(INSTALL_CONF) $(PKG_BUILD_DIR)/yang/sysrepo-notification-store.yang $(1)/etc/sysrepo/yang/internal
  103. $(INSTALL_CONF) $(PKG_BUILD_DIR)/yang/sysrepo-persistent-data.yang $(1)/etc/sysrepo/yang/internal
  104. $(INSTALL_DIR) $(1)/etc/sysrepo/yang
  105. $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/ietf-netconf-acm@2018-02-14.yang $(1)/etc/sysrepo/yang/ietf-netconf-acm@2018-02-14.yang
  106. $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/ietf-netconf-notifications.yang $(1)/etc/sysrepo/yang/ietf-netconf-notifications@2012-02-06.yang
  107. $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/nc-notifications.yang $(1)/etc/sysrepo/yang/nc-notifications@2008-07-14.yang
  108. $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/notifications.yang $(1)/etc/sysrepo/yang/notifications@2008-07-14.yang
  109. $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/ietf-netconf@2011-06-01.yang $(1)/etc/sysrepo/yang/ietf-netconf@2011-06-01.yang
  110. $(INSTALL_DIR) $(1)/etc/sysrepo/data/internal
  111. $(INSTALL_DIR) $(1)/etc/sysrepo/data/notifications
  112. $(INSTALL_DIR) $(1)/etc/uci-defaults
  113. $(INSTALL_BIN) ./files/libsysrepo.default $(1)/etc/uci-defaults/95_libsysrepo
  114. ifeq ($(CONFIG_SYSREPO_PYTHON),y)
  115. $(INSTALL_DIR) $(1)/usr/lib
  116. $(CP) $(PKG_BUILD_DIR)/swig/libSysrepo-cpp.so* $(1)/usr/lib
  117. $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
  118. $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python2/libsysrepoPython2.py $(1)$(PYTHON_PKG_DIR)
  119. $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python2/_libsysrepoPython2.so $(1)$(PYTHON_PKG_DIR)
  120. endif
  121. ifeq ($(CONFIG_SYSREPO_LUA),y)
  122. $(INSTALL_DIR) $(1)/usr/lib/lua/
  123. $(CP) $(PKG_BUILD_DIR)/swig/lua/libSysrepo_Lua.so* $(1)/usr/lib
  124. $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/lua/libsysrepoLua.so $(1)/usr/lib/lua/libsysrepoLua.so
  125. endif
  126. endef
  127. define Package/sysrepo/install
  128. $(INSTALL_DIR) $(1)/bin
  129. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sysrepod $(1)/bin/
  130. $(INSTALL_DIR) $(1)/bin
  131. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sysrepo-plugind $(1)/bin/
  132. $(INSTALL_DIR) $(1)/etc/init.d/
  133. $(INSTALL_BIN) ./files/sysrepo.init $(1)/etc/init.d/sysrepo
  134. endef
  135. define Package/sysrepoctl/install
  136. $(INSTALL_DIR) $(1)/bin
  137. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sysrepoctl $(1)/bin/
  138. endef
  139. define Package/sysrepocfg/install
  140. $(INSTALL_DIR) $(1)/bin
  141. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sysrepocfg $(1)/bin/
  142. endef
  143. define Build/InstallDev
  144. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  145. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libsysrepo.pc $(1)/usr/lib/pkgconfig/
  146. $(INSTALL_DIR) $(1)/usr/lib
  147. $(CP) $(PKG_BUILD_DIR)/src/libsysrepo.so* $(1)/usr/lib/
  148. $(INSTALL_DIR) $(1)/usr/include
  149. $(CP) $(PKG_BUILD_DIR)/inc/* $(1)/usr/include/
  150. endef
  151. $(eval $(call BuildPackage,libsysrepo))
  152. $(eval $(call BuildPackage,sysrepo))
  153. $(eval $(call BuildPackage,sysrepoctl))
  154. $(eval $(call BuildPackage,sysrepocfg))