Makefile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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:=refpolicy
  7. PKG_VERSION:=2.20250923
  8. PKG_RELEASE:=1
  9. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  10. PKG_SOURCE_URL:=https://github.com/SELinuxProject/refpolicy/releases/download/RELEASE_2_20250923
  11. PKG_HASH:=e5b435c934048d01ca4415a1f2670a51e113f26f5d01ad4227c98fbe8dea8d5b
  12. PKG_INSTALL:=1
  13. PKG_BUILD_DEPENDS:=checkpolicy/host policycoreutils/host
  14. PKG_MAINTAINER:=Thomas Petazzoni <[email protected]>
  15. PKG_CPE_ID:=cpe:/a:tresys:refpolicy
  16. PKG_LICENSE:=GPL-2.0-or-later
  17. PKG_LICENSE_FILES:=COPYING
  18. TAR_OPTIONS:=--transform='s%^refpolicy%$(PKG_NAME)-$(PKG_VERSION)%' -xf -
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/refpolicy
  21. SECTION:=system
  22. CATEGORY:=Base system
  23. TITLE:=SELinux reference policy
  24. URL:=http://selinuxproject.org/page/Main_Page
  25. PKGARCH:=all
  26. endef
  27. define Package/refpolicy/description
  28. The SELinux Reference Policy project (refpolicy) is a
  29. complete SELinux policy that can be used as the system
  30. policy for a variety of systems and used as the basis for
  31. creating other policies. Reference Policy was originally
  32. based on the NSA example policy, but aims to accomplish many
  33. additional goals.
  34. The current refpolicy does not fully support OpenWRT and
  35. needs modifications to work with the default system file
  36. layout. These changes should be added as patches to the
  37. refpolicy that modify a single SELinux policy.
  38. The refpolicy works for the most part in permissive
  39. mode. Only the basic set of utilities are enabled in the
  40. example policy config and some of the pathing in the
  41. policies is not correct. Individual policies would need to
  42. be tweaked to get everything functioning properly.
  43. endef
  44. # Yes, we want CC=$(HOSTCC) because the only code that checkpolicy
  45. # builds is a small host tool that gets run as part of the build
  46. # process.
  47. MAKE_FLAGS += \
  48. SETFILES="$(STAGING_DIR_HOST)/bin/setfiles" \
  49. CHECKPOLICY="$(STAGING_DIR_HOSTPKG)/bin/checkpolicy" \
  50. CC="$(HOSTCC)" \
  51. CFLAGS="$(HOST_CFLAGS)"
  52. define Build/Configure
  53. $(SED) "/MONOLITHIC/c\MONOLITHIC = y" $(PKG_BUILD_DIR)/build.conf
  54. $(SED) "/NAME/c\NAME = targeted" $(PKG_BUILD_DIR)/build.conf
  55. $(call Build/Compile/Default,conf)
  56. endef
  57. define Package/refpolicy/conffiles
  58. /etc/selinux/config
  59. endef
  60. define Package/refpolicy/install
  61. $(INSTALL_DIR) $(1)/etc/selinux
  62. $(CP) $(PKG_INSTALL_DIR)/etc/selinux/* $(1)/etc/selinux/
  63. $(CP) ./files/selinux-config $(1)/etc/selinux/config
  64. endef
  65. $(eval $(call BuildPackage,refpolicy))