[OpenWrt-Devel] [PATCH packages 10/11] libs/libselinux: add support for building the Python bindings

Thomas Petazzoni thomas.petazzoni at bootlin.com
Fri Nov 22 04:55:55 EST 2019


Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 libs/libselinux/Makefile | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/libs/libselinux/Makefile b/libs/libselinux/Makefile
index 30e50a9ba..08b43f0f7 100644
--- a/libs/libselinux/Makefile
+++ b/libs/libselinux/Makefile
@@ -12,11 +12,13 @@ PKG_RELEASE:=1
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20190315
 PKG_HASH:=1bccc8873e449587d9a2b2cf253de9b89a8291b9fbc7c59393ca9e5f5f4d2693
+PKG_BUILD_DEPENDS:=PACKAGE_python-libselinux:python PACKAGE_python-libselinux:swig/host
 HOST_BUILD_DEPENDS:=libsepol/host pcre/host
 
 PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni at bootlin.com>
 
 include $(INCLUDE_DIR)/package.mk
+include ../../lang/python/python-package.mk
 
 define Package/libselinux
   SECTION:=libs
@@ -26,6 +28,14 @@ define Package/libselinux
   URL:=http://selinuxproject.org/page/Main_Page
 endef
 
+define Package/python-libselinux
+  TITLE:=Python bindings sur the runtime SELinux library
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  DEPENDS:=+python +libselinux
+endef
+
 define Package/libselinux/description
 	libselinux is the runtime SELinux library that provides
 	interfaces (e.g. library functions for the SELinux kernel
@@ -51,14 +61,28 @@ $(eval $(call HostBuild))
 
 MAKE_FLAGS += \
 	FTS_LDLIBS=-lfts \
-	SHLIBDIR=/usr/lib
+	SHLIBDIR=/usr/lib \
+	PYTHON=$(PYTHON) \
+	PYINC="-I $(PYTHON_INC_DIR)"
+
+ifdef CONFIG_PACKAGE_python-libselinux
+  define Build/Compile/python-libselinux
+	$(call Build/Compile/Default,swigify pywrap)
+  endef
+
+  define Build/Install/python-libselinux
+	$(call Build/Install/Default,install-pywrap)
+  endef
+endif
 
 define Build/Compile
 	$(call Build/Compile/Default,all)
+	$(Build/Compile/python-libselinux)
 endef
 
 define Build/Install
 	$(call Build/Install/Default,install)
+	$(Build/Install/python-libselinux)
 endef
 
 define Build/InstallDev
@@ -76,3 +100,5 @@ define Package/libselinux/install
 endef
 
 $(eval $(call BuildPackage,libselinux))
+$(eval $(call PyPackage,python-libselinux))
+$(eval $(call BuildPackage,python-libselinux))
-- 
2.23.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list