Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. #
  2. # Copyright (C) 2014-2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=procd
  9. PKG_RELEASE:=$(AUTORELEASE)
  10. PKG_SOURCE_PROTO:=git
  11. PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
  12. PKG_MIRROR_HASH:=b03b6cd3321451813bb802647b8d574e25d39434167f36f271fef170ebd2f2c8
  13. PKG_SOURCE_DATE:=2022-07-17
  14. PKG_SOURCE_VERSION:=ef5d3e36e8b23ee2e1989c22717b21649dc9a388
  15. CMAKE_INSTALL:=1
  16. PKG_LICENSE:=GPL-2.0
  17. PKG_LICENSE_FILES:=
  18. PKG_MAINTAINER:=John Crispin <[email protected]>
  19. PKG_ASLR_PIE_REGULAR:=1
  20. PKG_CONFIG_DEPENDS:= \
  21. CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP CONFIG_PROCD_SHOW_BOOT \
  22. CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
  23. include $(INCLUDE_DIR)/package.mk
  24. include $(INCLUDE_DIR)/cmake.mk
  25. ifeq ($(DUMP),)
  26. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | $(MKHASH) md5)
  27. endif
  28. CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
  29. TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
  30. TARGET_CFLAGS += -flto
  31. TARGET_LDFLAGS += -flto
  32. define Package/procd/Default
  33. SECTION:=base
  34. CATEGORY:=Base system
  35. DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox \
  36. +libubus +libblobmsg-json +libjson-c +jshn
  37. TITLE:=OpenWrt system process manager
  38. USERID:=:dialout=20 :audio=29
  39. endef
  40. define Package/procd
  41. $(call Package/procd/Default)
  42. VARIANT:=default
  43. CONFLICTS:=procd-selinux
  44. endef
  45. define Package/procd-selinux
  46. $(call Package/procd/Default)
  47. DEPENDS += +libselinux
  48. TITLE += with SELinux support
  49. PROVIDES:=procd
  50. VARIANT:=selinux
  51. endef
  52. define Package/procd-ujail
  53. SECTION:=base
  54. CATEGORY:=Base system
  55. DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS \
  56. +libubox +libubus +libuci +libblobmsg-json
  57. TITLE:=OpenWrt process jail helper
  58. endef
  59. define Package/procd-seccomp
  60. SECTION:=base
  61. CATEGORY:=Base system
  62. DEPENDS:=@SECCOMP +libubox +libblobmsg-json
  63. TITLE:=OpenWrt process seccomp helper + utrace
  64. endef
  65. define Package/uxc
  66. SECTION:=base
  67. CATEGORY:=Base system
  68. DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json +blockd +PACKAGE_uxc:rpcd
  69. TITLE:=OpenWrt container management
  70. MAINTAINER:=Daniel Golle <[email protected]>
  71. endef
  72. define Package/procd/config
  73. menu "Configuration"
  74. depends on PACKAGE_procd || PACKAGE_procd-selinux
  75. config PROCD_SHOW_BOOT
  76. bool
  77. default n
  78. prompt "Print the shutdown to the console as well as logging it to syslog"
  79. endmenu
  80. endef
  81. ifeq ($(BUILD_VARIANT),selinux)
  82. CMAKE_OPTIONS += -DSELINUX=1
  83. endif
  84. ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
  85. CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
  86. endif
  87. ifdef CONFIG_PACKAGE_procd-ujail
  88. CMAKE_OPTIONS += -DJAIL_SUPPORT=1
  89. endif
  90. SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0)
  91. CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
  92. define Package/procd/install
  93. $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
  94. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
  95. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
  96. $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
  97. $(INSTALL_CONF) ./files/hotplug*.json $(1)/etc/
  98. $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
  99. $(INSTALL_BIN) ./files/service $(1)/sbin/service
  100. endef
  101. Package/procd-selinux/install = $(Package/procd/install)
  102. define Package/procd-ujail/install
  103. $(INSTALL_DIR) $(1)/sbin
  104. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
  105. endef
  106. define Package/procd-seccomp/install
  107. $(INSTALL_DIR) $(1)/sbin $(1)/lib
  108. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
  109. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
  110. $(LN) utrace $(1)/sbin/seccomp-trace
  111. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
  112. endef
  113. define Package/uxc/conffiles
  114. /etc/uxc
  115. endef
  116. define Package/uxc/install
  117. $(INSTALL_DIR) $(1)/sbin
  118. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/uxc $(1)/sbin/
  119. $(INSTALL_DIR) $(1)/etc/init.d
  120. $(INSTALL_BIN) ./files/uxc.init $(1)/etc/init.d/uxc
  121. endef
  122. $(eval $(call BuildPackage,procd))
  123. $(eval $(call BuildPackage,procd-selinux))
  124. $(eval $(call BuildPackage,procd-ujail))
  125. $(eval $(call BuildPackage,procd-seccomp))
  126. $(eval $(call BuildPackage,uxc))