Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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_SOURCE_DATE:=2021-05-05
  13. PKG_SOURCE_VERSION:=021ece84de430fca988acd6934f6046ea59d8c37
  14. PKG_MIRROR_HASH:=edbe464cadbae000f4a48a6f1e6a0f5d27ae3ad521e308205252ad89639b6f9d
  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 \
  22. CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
  23. CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
  24. include $(INCLUDE_DIR)/package.mk
  25. include $(INCLUDE_DIR)/cmake.mk
  26. ifeq ($(DUMP),)
  27. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | $(MKHASH) md5)
  28. endif
  29. CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
  30. TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
  31. TARGET_CFLAGS += -flto
  32. TARGET_LDFLAGS += -flto
  33. define Package/procd/Default
  34. SECTION:=base
  35. CATEGORY:=Base system
  36. DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox \
  37. +libubus +libblobmsg-json +libjson-c +jshn
  38. TITLE:=OpenWrt system process manager
  39. USERID:=:dialout=20 :audio=29
  40. endef
  41. define Package/procd
  42. $(call Package/procd/Default)
  43. VARIANT:=default
  44. CONFLICTS:=procd-selinux
  45. endef
  46. define Package/procd-selinux
  47. $(call Package/procd/Default)
  48. DEPENDS += +libselinux
  49. TITLE += with SELinux support
  50. PROVIDES:=procd
  51. VARIANT:=selinux
  52. endef
  53. define Package/procd-ujail
  54. SECTION:=base
  55. CATEGORY:=Base system
  56. DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS \
  57. +libubox +libubus +libblobmsg-json
  58. TITLE:=OpenWrt process jail helper
  59. endef
  60. define Package/procd-ujail-console
  61. SECTION:=base
  62. CATEGORY:=Base system
  63. DEPENDS:=+procd-ujail +libubus +libubox
  64. TITLE:=OpenWrt process jail console
  65. endef
  66. define Package/procd-seccomp
  67. SECTION:=base
  68. CATEGORY:=Base system
  69. DEPENDS:=@(aarch64||arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml \
  70. @KERNEL_SECCOMP +libubox +libblobmsg-json
  71. TITLE:=OpenWrt process seccomp helper + utrace
  72. endef
  73. define Package/uxc
  74. SECTION:=base
  75. CATEGORY:=Base system
  76. DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json
  77. TITLE:=OpenWrt container management
  78. MAINTAINER:=Daniel Golle <[email protected]>
  79. endef
  80. define Package/procd/config
  81. menu "Configuration"
  82. depends on PACKAGE_procd || PACKAGE_procd-selinux
  83. config PROCD_SHOW_BOOT
  84. bool
  85. default n
  86. prompt "Print the shutdown to the console as well as logging it to syslog"
  87. config PROCD_ZRAM_TMPFS
  88. bool
  89. default n
  90. prompt "Mount /tmp using zram."
  91. endmenu
  92. endef
  93. ifeq ($(BUILD_VARIANT),selinux)
  94. CMAKE_OPTIONS += -DSELINUX=1
  95. endif
  96. ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
  97. CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
  98. endif
  99. ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
  100. CMAKE_OPTIONS += -DZRAM_TMPFS=1
  101. endif
  102. ifdef CONFIG_PACKAGE_procd-ujail
  103. CMAKE_OPTIONS += -DJAIL_SUPPORT=1
  104. endif
  105. SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0)
  106. CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
  107. define Package/procd/install
  108. $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
  109. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
  110. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
  111. $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
  112. $(INSTALL_CONF) ./files/hotplug*.json $(1)/etc/
  113. $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
  114. endef
  115. Package/procd-selinux/install = $(Package/procd/install)
  116. define Package/procd-ujail/install
  117. $(INSTALL_DIR) $(1)/sbin
  118. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
  119. endef
  120. define Package/procd-ujail-console/install
  121. $(INSTALL_DIR) $(1)/sbin
  122. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail-console $(1)/sbin/
  123. endef
  124. define Package/procd-seccomp/install
  125. $(INSTALL_DIR) $(1)/sbin $(1)/lib
  126. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
  127. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
  128. $(LN) utrace $(1)/sbin/seccomp-trace
  129. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
  130. endef
  131. define Package/uxc/conffiles
  132. /etc/uxc
  133. endef
  134. define Package/uxc/install
  135. $(INSTALL_DIR) $(1)/sbin
  136. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/uxc $(1)/sbin/
  137. $(INSTALL_DIR) $(1)/etc/init.d
  138. $(INSTALL_BIN) ./files/uxc.init $(1)/etc/init.d/uxc
  139. endef
  140. $(eval $(call BuildPackage,procd))
  141. $(eval $(call BuildPackage,procd-selinux))
  142. $(eval $(call BuildPackage,procd-ujail))
  143. $(eval $(call BuildPackage,procd-ujail-console))
  144. $(eval $(call BuildPackage,procd-seccomp))
  145. $(eval $(call BuildPackage,uxc))