sepolgen: allow compiling for target
authorAdam Duskett <Aduskett@gmail.com>
Thu, 2 Feb 2017 22:45:02 +0000 (17:45 -0500)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 9 Apr 2017 12:54:30 +0000 (14:54 +0200)
Sepolgen is currently a host-only package, however it is a dependency
of audit2allow.  This patch allows for sepolgen to be compiled for the
target.

Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
Reviewed-by: Matt Weber <matthew.weber@rockwellcollins.com>
[Thomas:
 - fix formatting of Config.in file
 - add missing dependencies inherited from the fact that the package
   selects python3.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/Config.in
package/sepolgen/Config.in [new file with mode: 0644]
package/sepolgen/sepolgen.mk

index a4855a9e4276b482f8f46c276e312967017735bb..7c10bc4aeeb5e3247d376ce0a65d84f3fb50377b 100644 (file)
@@ -1739,6 +1739,7 @@ endmenu
 
 menu "Security"
        source "package/policycoreutils/Config.in"
+       source "package/sepolgen/Config.in"
        source "package/setools/Config.in"
 endmenu
 
diff --git a/package/sepolgen/Config.in b/package/sepolgen/Config.in
new file mode 100644 (file)
index 0000000..3671816
--- /dev/null
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_SEPOLGEN
+       bool "sepolgen"
+       select BR2_PACKAGE_PYTHON3 if !BR2_PACKAGE_PYTHON
+       depends on BR2_USE_WCHAR # python3
+       depends on BR2_USE_MMU # python3
+       depends on BR2_TOOLCHAIN_HAS_THREADS # python3
+       depends on !BR2_STATIC_LIBS # python3
+       help
+         This package contains a Python module that forms the core of
+         the modern audit2allow (which is a part of the package
+         policycoreutils).  It contains infrastructure for parsing
+         SELinux related messages as produced by the audit system.
+         It has facilities for generating policy based on required
+         access.
+
+comment "sepolgen needs a toolchain w/ wchar, threads, dynamic library"
+       depends on BR2_USE_MMU
+       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
+               BR2_STATIC_LIBS
index 94c0d5908668f6599ba4e1367cb8c9f05b3e1d6c..033b468f028647f121ff0f6c07a48a3ac550fb2f 100644 (file)
@@ -9,6 +9,24 @@ SEPOLGEN_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/fi
 SEPOLGEN_LICENSE = GPL-2.0
 SEPOLGEN_LICENSE_FILES = COPYING
 
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+SEPOLGEN_DEPENDENCIES = python3
+SEPOLGEN_MAKE_CMDS = $(TARGET_CONFIGURE_OPTS) \
+       PYTHONLIBDIR=/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
+else
+SEPOLGEN_DEPENDENCIES = python
+SEPOLGEN_MAKE_CMDS = $(TARGET_CONFIGURE_OPTS) \
+       PYTHONLIBDIR=/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endif
+
+define SEPOLGEN_BUILD_CMDS
+       $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_SEPOLGEN_MAKE_CMDS) DESTDIR=$(TARGET_DIR)
+endef
+
+define SEPOLGEN_INSTALL_TARGET_CMDS
+       $(MAKE_ENV) $(MAKE) -C $(@D) $(SEPOLGEN_MAKE_CMDS) DESTDIR=$(TARGET_DIR) install
+endef
+
 ifeq ($(BR2_PACKAGE_PYTHON3),y)
 HOST_SEPOLGEN_DEPENDENCIES = host-python3
 HOST_SEPOLGEN_MAKE_CMDS = $(HOST_CONFIGURE_OPTS) \
@@ -27,4 +45,5 @@ define HOST_SEPOLGEN_INSTALL_CMDS
        $(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_SEPOLGEN_MAKE_CMDS) DESTDIR=$(HOST_DIR) install
 endef
 
+$(eval $(generic-package))
 $(eval $(host-generic-package))