python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / policycoreutils / policycoreutils.mk
blob6076bb9c078d773f484fd644ad965d6a5fc93a43
1 ################################################################################
3 # policycoreutils
5 ################################################################################
7 POLICYCOREUTILS_VERSION = 2.6
8 POLICYCOREUTILS_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20161014
9 POLICYCOREUTILS_LICENSE = GPLv2
10 POLICYCOREUTILS_LICENSE_FILES = COPYING
12 POLICYCOREUTILS_DEPENDENCIES = libsemanage libcap-ng
14 ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
15 POLICYCOREUTILS_DEPENDENCIES += linux-pam
16 POLICYCOREUTILS_MAKE_OPTS += NAMESPACE_PRIV=y
17 define POLICYCOREUTILS_INSTALL_TARGET_LINUX_PAM_CONFS
18 $(INSTALL) -D -m 0644 $(@D)/newrole/newrole-lspp.pamd $(TARGET_DIR)/etc/pam.d/newrole
19 $(INSTALL) -D -m 0644 $(@D)/run_init/run_init.pamd $(TARGET_DIR)/etc/pam.d/run_init
20 endef
21 endif
23 ifeq ($(BR2_PACKAGE_AUDIT),y)
24 POLICYCOREUTILS_DEPENDENCIES += audit
25 POLICYCOREUTILS_MAKE_OPTS += AUDIT_LOG_PRIV=y
26 endif
28 # Enable LSPP_PRIV if both audit and linux pam are enabled
29 ifeq ($(BR2_PACKAGE_LINUX_PAM)$(BR2_PACKAGE_AUDIT),yy)
30 POLICYCOREUTILS_MAKE_OPTS += LSPP_PRIV=y
31 endif
33 # Undefining _FILE_OFFSET_BITS here because of a "bug" with glibc fts.h
34 # large file support.
35 # See https://bugzilla.redhat.com/show_bug.cgi?id=574992 for more information
36 POLICYCOREUTILS_MAKE_OPTS += \
37 $(TARGET_CONFIGURE_OPTS) \
38 CFLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \
39 CPPFLAGS="$(TARGET_CPPFLAGS) -U_FILE_OFFSET_BITS" \
40 ARCH="$(BR2_ARCH)"
42 POLICYCOREUTILS_MAKE_DIRS = \
43 load_policy newrole run_init \
44 secon semodule semodule_deps \
45 semodule_expand semodule_link \
46 semodule_package sepolgen-ifgen \
47 sestatus setfiles setsebool
49 ifeq ($(BR2_PACKAGE_POLICYCOREUTILS_RESTORECOND),y)
50 POLICYCOREUTILS_MAKE_DIRS += restorecond
51 POLICYCOREUTILS_DEPENDENCIES += libglib2
52 endif
53 # We need to pass DESTDIR at build time because it's used by
54 # policycoreutils build system to find headers and libraries.
55 define POLICYCOREUTILS_BUILD_CMDS
56 $(foreach d,$(POLICYCOREUTILS_MAKE_DIRS),
57 $(MAKE) -C $(@D)/$(d) $(POLICYCOREUTILS_MAKE_OPTS) \
58 DESTDIR=$(STAGING_DIR) all
60 endef
62 define POLICYCOREUTILS_INSTALL_TARGET_CMDS
63 $(foreach d,$(POLICYCOREUTILS_MAKE_DIRS),
64 $(MAKE) -C $(@D)/$(d) $(POLICYCOREUTILS_MAKE_OPTS) \
65 DESTDIR=$(TARGET_DIR) install
67 endef
69 HOST_POLICYCOREUTILS_DEPENDENCIES = \
70 host-libsemanage host-dbus-glib \
71 host-sepolgen host-setools
73 # Undefining _FILE_OFFSET_BITS here because of a "bug" with glibc fts.h
74 # large file support.
75 # See https://bugzilla.redhat.com/show_bug.cgi?id=574992 for more information
76 HOST_POLICYCOREUTILS_MAKE_OPTS = \
77 $(HOST_CONFIGURE_OPTS) \
78 CFLAGS="$(HOST_CFLAGS) -U_FILE_OFFSET_BITS" \
79 CPPFLAGS="$(HOST_CPPFLAGS) -U_FILE_OFFSET_BITS" \
80 PYTHON="$(HOST_DIR)/usr/bin/python" \
81 PYTHON_INSTALL_ARGS="$(HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS)" \
82 ARCH="$(HOSTARCH)"
84 ifeq ($(BR2_PACKAGE_PYTHON3),y)
85 HOST_POLICYCOREUTILS_DEPENDENCIES += host-python3
86 HOST_POLICYCOREUTILS_MAKE_OPTS += \
87 PYLIBVER="python$(PYTHON3_VERSION_MAJOR)"
88 else
89 HOST_POLICYCOREUTILS_DEPENDENCIES += host-python
90 HOST_POLICYCOREUTILS_MAKE_OPTS += \
91 PYLIBVER="python$(PYTHON_VERSION_MAJOR)"
92 endif
94 # Note: We are only building the programs required by the refpolicy build
95 HOST_POLICYCOREUTILS_MAKE_DIRS = \
96 load_policy semodule semodule_deps \
97 semodule_expand semodule_link \
98 semodule_package setfiles restorecond \
99 audit2allow scripts semanage sepolicy
101 # We need to pass DESTDIR at build time because it's used by
102 # policycoreutils build system to find headers and libraries.
103 define HOST_POLICYCOREUTILS_BUILD_CMDS
104 $(foreach d,$(HOST_POLICYCOREUTILS_MAKE_DIRS),
105 $(MAKE) -C $(@D)/$(d) $(HOST_POLICYCOREUTILS_MAKE_OPTS) \
106 DESTDIR=$(HOST_DIR) all
108 endef
110 define HOST_POLICYCOREUTILS_INSTALL_CMDS
111 $(foreach d,$(HOST_POLICYCOREUTILS_MAKE_DIRS),
112 $(MAKE) -C $(@D)/$(d) $(HOST_POLICYCOREUTILS_MAKE_OPTS) \
113 DESTDIR=$(HOST_DIR) install
115 # Fix python paths
116 $(SED) 's%/usr/bin/%$(HOST_DIR)/usr/bin/%g' $(HOST_DIR)/usr/bin/audit2allow
117 $(SED) 's%/usr/bin/%$(HOST_DIR)/usr/bin/%g' $(HOST_DIR)/usr/bin/sepolgen-ifgen
118 $(SED) 's%/usr/bin/%$(HOST_DIR)/usr/bin/%g' $(HOST_DIR)/usr/bin/sepolicy
119 endef
121 $(eval $(generic-package))
122 $(eval $(host-generic-package))