Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #
  2. # This is free software, licensed under the GNU General Public License v2.
  3. # See /LICENSE for more information.
  4. #
  5. include $(TOPDIR)/rules.mk
  6. PKG_NAME:=policycoreutils
  7. PKG_VERSION:=3.5
  8. PKG_RELEASE:=1
  9. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  10. PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/$(PKG_VERSION)
  11. PKG_HASH:=78453e1529fbbf800e88860094d555e781ce1fba11a7ef77b5aabb43e1173276
  12. PKG_INSTALL:=1
  13. HOST_BUILD_DEPENDS:=libsemanage/host gettext-full/host
  14. PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam gettext-full/host
  15. PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  16. PKG_CPE_ID:=cpe:/a:selinuxproject:policycoreutils
  17. PKG_LICENSE:=GPL-2.0-or-later
  18. PKG_LICENSE_FILES:=COPYING
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/nls.mk
  21. include $(INCLUDE_DIR)/host-build.mk
  22. DIR_USR_BIN:= \
  23. newrole \
  24. secon \
  25. sestatus
  26. DIR_USR_SBIN:= \
  27. load_policy \
  28. setsebool
  29. LIBEXEC_UTILS := \
  30. pp
  31. SBIN_UTILS:= \
  32. restorecon_xattr \
  33. setfiles
  34. USR_BIN_UTILS:= \
  35. newrole \
  36. secon \
  37. sestatus
  38. USR_SBIN_UTILS:= \
  39. fixfiles \
  40. genhomedircon \
  41. open_init_pty \
  42. run_init \
  43. semodule \
  44. load_policy \
  45. setsebool
  46. TARGET_LDFLAGS += $(INTL_LDFLAGS) $(if $(INTL_FULL),-lintl)
  47. MAKE_FLAGS += \
  48. PAMH=$(CONFIG_BUSYBOX_CONFIG_PAM)
  49. HOST_MAKE_FLAGS += \
  50. PAMH=$(CONFIG_BUSYBOX_CONFIG_PAM) \
  51. DESTDIR=$(STAGING_DIR_HOST) \
  52. PREFIX= \
  53. SBINDIR=/bin
  54. HOST_LDFLAGS += -Wl,-rpath=$(STAGING_DIR_HOSTPKG)/lib
  55. $(eval $(foreach a,$(DIR_SBIN),ALTS_$(a):=300:/sbin/$(a):/sbin/policycoreutils-$(a)$(newline)))
  56. $(eval $(foreach a,$(DIR_USR_BIN),ALTS_$(a):=300:/usr/bin/$(a):/usr/bin/policycoreutils-$(a)$(newline)))
  57. $(eval $(foreach a,$(DIR_USR_SBIN),ALTS_$(a):=300:/usr/sbin/$(a):/usr/sbin/policycoreutils-$(a)$(newline)))
  58. ALTS_setfiles:=300:/sbin/restorecon:/sbin/policycoreutils-setfiles 300:/sbin/setfiles:/sbin/policycoreutils-setfiles
  59. DEPENDS_genhomedircon:=+libsemanage $(INTL_DEPENDS)
  60. DEPENDS_load_policy:=+libselinux $(INTL_DEPENDS)
  61. DEPENDS_newrole:=+libselinux +libaudit +BUSYBOX_CONFIG_PAM:libpam $(INTL_DEPENDS)
  62. DEPENDS_open_init_pty:=$(INTL_DEPENDS)
  63. DEPENDS_pp:=+libsepol $(INTL_DEPENDS)
  64. DEPENDS_restorecon_xattr:=+libselinux +libsepol +libaudit $(INTL_DEPENDS)
  65. DEPENDS_run_init:=+libselinux +libaudit +BUSYBOX_CONFIG_PAM:libpam $(INTL_DEPENDS)
  66. DEPENDS_secon:=+libselinux $(INTL_DEPENDS)
  67. DEPENDS_semanage:=+libsemanage
  68. DEPENDS_semodule:=+libsemanage $(INTL_DEPENDS)
  69. DEPENDS_sestatus:=+libselinux $(INTL_DEPENDS)
  70. DEPENDS_setfiles:=+libselinux +libsepol +libaudit $(INTL_DEPENDS)
  71. DEPENDS_setsebool:=+libsemanage $(INTL_DEPENDS)
  72. define Package/policycoreutils/Default
  73. SECTION:=utils
  74. CATEGORY:=Utilities
  75. TITLE:=SELinux policy utility
  76. URL:=http://selinuxproject.org/page/Main_Page
  77. endef
  78. define Package/policycoreutils
  79. $(call Package/policycoreutils/Default)
  80. MENU:=1
  81. TITLE+= common files
  82. endef
  83. define GenUtilPkg
  84. define Package/$(1)
  85. $(call Package/policycoreutils/Default)
  86. DEPENDS+= policycoreutils $(DEPENDS_$(2))
  87. TITLE+= $(2)
  88. ALTERNATIVES:=$(ALTS_$(2))
  89. endef
  90. define Package/$(1)/description
  91. Policycoreutils is a collection of policy utilities
  92. (originally the "core" set of utilities needed to use
  93. SELinux, although it has grown a bit over time).
  94. This package provides the $(2) utility.
  95. endef
  96. endef
  97. $(foreach a,$(LIBEXEC_UTILS) $(SBIN_UTILS) $(USR_BIN_UTILS) $(USR_SBIN_UTILS),$(eval $(call GenUtilPkg,policycoreutils-$(a),$(a))))
  98. define Package/policycoreutils/install
  99. $(INSTALL_DIR) $(1)/etc
  100. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sestatus.conf $(1)/etc
  101. ifdef CONFIG_BUSYBOX_CONFIG_PAM
  102. $(INSTALL_DIR) $(1)/etc/pam.d
  103. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/pam.d/run_init $(1)/etc/pam.d
  104. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/pam.d/newrole $(1)/etc/pam.d
  105. endif
  106. endef
  107. define BuildUtil
  108. define Package/$(1)/install
  109. $(INSTALL_DIR) $$(1)$(2)
  110. $(INSTALL_BIN) $$(PKG_INSTALL_DIR)$(2)/$(3) $$(1)$(2)/$(if $(ALTS_$(3)),policycoreutils-$(3),$(3))
  111. endef
  112. $$(eval $$(call BuildPackage,$(1)))
  113. endef
  114. $(eval $(call BuildPackage,policycoreutils))
  115. $(foreach a,$(SBIN_UTILS),$(eval $(call BuildUtil,policycoreutils-$(a),/sbin,$(a))))
  116. $(foreach a,$(USR_BIN_UTILS),$(eval $(call BuildUtil,policycoreutils-$(a),/usr/bin,$(a))))
  117. $(foreach a,$(USR_SBIN_UTILS),$(eval $(call BuildUtil,policycoreutils-$(a),/usr/sbin,$(a))))
  118. $(foreach a,$(LIBEXEC_UTILS),$(eval $(call BuildUtil,policycoreutils-$(a),/usr/libexec/selinux/hll,$(a))))
  119. $(eval $(call HostBuild))