sysrepo: Remove Lua bindings, build Python bindings in separate package 10554/head
authorJeffery To <jeffery.to@gmail.com>
Fri, 15 Nov 2019 19:47:00 +0000 (03:47 +0800)
committerJeffery To <jeffery.to@gmail.com>
Fri, 15 Nov 2019 19:47:00 +0000 (03:47 +0800)
This change:

* Removes building of Lua bindings. These bindings were already removed
  upstream[1].

* Fixes building of Python bindings:
  * Fix SWIG_DIR path (note that SWIG_VERSION will need to be updated
    whenever the swig package is upgraded)
  * Fix Python module paths and filenames

* Packages the Python bindings in a new package (python3-sysrepo) and
  builds it by default, instead of depending on a config option.

[1]: https://github.com/sysrepo/sysrepo/pull/1429

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
net/sysrepo/Config_libsysrepo.in [deleted file]
net/sysrepo/Makefile

diff --git a/net/sysrepo/Config_libsysrepo.in b/net/sysrepo/Config_libsysrepo.in
deleted file mode 100644 (file)
index 42de84a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-config SYSREPO_PYTHON
-       bool "Generate sysrepo Python2 bindings"
-       depends on PACKAGE_libsysrepo
-       select SYSREPO_BINDINGS
-       default n
-       help
-               This option generates the Python2 language bindings.
-               Disabled by default.
-
-config SYSREPO_LUA
-       bool "Generate sysrepo Lua5.1 bindings"
-       depends on PACKAGE_libsysrepo
-       select SYSREPO_BINDINGS
-       default n
-       help
-               This option generates the Lua5.1 language bindings.
-               Disabled by default.
-
-config SYSREPO_BINDINGS
-       bool
-       depends on PACKAGE_libsysrepo
-       default n
-
index c5ef604f39a142487031e673035464e065e3a50d..72396aa5d61b6b627a9f96b8e56c7aec251a30ee 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sysrepo
 PKG_VERSION:=0.7.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/sysrepo/sysrepo/tar.gz/v$(PKG_VERSION)?
@@ -21,25 +21,27 @@ PKG_LICENSE_FILES:=LICENSE
 
 CMAKE_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
-PKG_BUILD_DEPENDS:=SYSREPO_BINDINGS:swig/host
+PKG_BUILD_DEPENDS:=swig/host
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
-ifeq ($(CONFIG_SYSREPO_PYTHON),y)
-$(call include_mk, python3-package.mk)
-endif
-
-define Package/libsysrepo/config
-       source "$(SOURCE)/Config_libsysrepo.in"
-endef
+include ../../lang/python/python3-package.mk
 
 define Package/libsysrepo
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE:=YANG-based data store library
   URL:=https://www.sysrepo.org/
-  DEPENDS:=+libyang +libprotobuf-c +libev +libredblack +librt +libpthread +SYSREPO_BINDINGS:libstdcpp +SYSREPO_PYTHON:python3-base +SYSREPO_LUA:lua
-  MENU:=1
+  DEPENDS:=+libyang +libprotobuf-c +libev +libredblack +librt +libpthread
+endef
+
+define Package/python3-sysrepo
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  TITLE:=YANG-based data store library - Python 3 bindings
+  URL:=https://www.sysrepo.org/
+  DEPENDS:=+libsysrepo +libstdcpp +python3-base
 endef
 
 define Package/sysrepo
@@ -70,14 +72,12 @@ define Package/sysrepo/description
 Sysrepo is an YANG-based configuration and operational state data store for Unix/Linux applications.
 endef
 
+SWIG_VERSION:=4.0.1
+
 CMAKE_OPTIONS += \
        -DUSE_AVL_LIB:BOOL=FALSE \
        -DENABLE_TESTS:BOOL=FALSE \
        -DBUILD_EXAMPLES:BOOL=FALSE \
-       -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=TRUE \
-       -DGEN_LANGUAGE_BINDINGS:BOOL=FALSE \
-       -DGEN_PYTHON_BINDINGS=0 \
-       -DGEN_LUA_BINDINGS=0 \
        -DREPOSITORY_LOC:PATH=/etc/sysrepo \
        -DENABLE_NACM:BOOL=FALSE \
        -DREQUEST_TIMEOUT=6 \
@@ -87,29 +87,15 @@ CMAKE_OPTIONS += \
        -DNOTIF_AGE_TIMEOUT=120 \
        -DNOTIF_TIME_WINDOW=20 \
        -DUSE_SR_MEM_MGMT=0 \
-       -DFILE_FORMAT_EXT:STRING=xml
-
-ifeq ($(CONFIG_SYSREPO_LUA),y)
-CMAKE_OPTIONS += \
-       -DGEN_LUA_BINDINGS:BOOL=TRUE \
-       -DGEN_LUA_VERSION=5.1
-endif
-
-ifeq ($(CONFIG_SYSREPO_PYTHON),y)
-CMAKE_OPTIONS += \
-       -DGEN_PYTHON_BINDINGS:BOOL=TRUE \
-       -DGEN_PYTHON_VERSION=3 \
-       -DGEN_PYTHON3_TESTS:BOOL=FALSE
-endif
-
-ifeq ($(CONFIG_SYSREPO_BINDINGS),y)
-CMAKE_OPTIONS += \
+       -DFILE_FORMAT_EXT:STRING=xml \
        -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=FALSE \
        -DGEN_LANGUAGE_BINDINGS:BOOL=TRUE \
-       -DSWIG_DIR=$(STAGING_DIR_HOSTPKG)/share/swig \
+       -DSWIG_DIR=$(STAGING_DIR_HOSTPKG)/share/swig/$(SWIG_VERSION) \
        -DSWIG_EXECUTABLE=$(STAGING_DIR_HOSTPKG)/bin/swig \
-       -DCALL_TARGET_BINS_DIRECTLY=OFF
-endif
+       -DCALL_TARGET_BINS_DIRECTLY=OFF \
+       -DGEN_PYTHON_BINDINGS:BOOL=TRUE \
+       -DGEN_PYTHON_VERSION=3 \
+       -DGEN_PYTHON3_TESTS:BOOL=FALSE
 
 define Package/libsysrepo/install
        $(INSTALL_DIR) $(1)/usr/lib
@@ -132,20 +118,14 @@ define Package/libsysrepo/install
 
        $(INSTALL_DIR) $(1)/etc/uci-defaults
        $(INSTALL_BIN) ./files/libsysrepo.default $(1)/etc/uci-defaults/95_libsysrepo
+endef
 
-ifeq ($(CONFIG_SYSREPO_PYTHON),y)
+define Package/python3-sysrepo/install
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_BUILD_DIR)/swig/libSysrepo-cpp.so* $(1)/usr/lib
-       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python3/libsysrepoPython3.py $(1)$(PYTHON_PKG_DIR)
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python3/_libsysrepoPython3.so $(1)$(PYTHON_PKG_DIR)
-endif
-
-ifeq ($(CONFIG_SYSREPO_LUA),y)
-       $(INSTALL_DIR) $(1)/usr/lib/lua/
-       $(CP) $(PKG_BUILD_DIR)/swig/lua/libSysrepo_Lua.so* $(1)/usr/lib
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/lua/libsysrepoLua.so $(1)/usr/lib/lua/libsysrepoLua.so
-endif
+       $(INSTALL_DIR) $(1)$(PYTHON3_PKG_DIR)
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python/sysrepo.py $(1)$(PYTHON3_PKG_DIR)
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python/_sysrepo.so $(1)$(PYTHON3_PKG_DIR)
 endef
 
 define Package/sysrepo/install
@@ -170,6 +150,7 @@ define Package/sysrepocfg/install
 endef
 
 $(eval $(call BuildPackage,libsysrepo))
+$(eval $(call BuildPackage,python3-sysrepo))
 $(eval $(call BuildPackage,sysrepo))
 $(eval $(call BuildPackage,sysrepoctl))
 $(eval $(call BuildPackage,sysrepocfg))