Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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:=1
  10. PKG_SOURCE_PROTO:=git
  11. PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
  12. PKG_SOURCE_DATE:=2020-05-28
  13. PKG_SOURCE_VERSION:=b9b39e2061d7035a9d84eecbb4a4613deaf6d03f
  14. PKG_MIRROR_HASH:=0d6a96a2fb38f72c72b457a2a8638bee22f91009f9686152fcf4aee97846fc84
  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
  34. SECTION:=base
  35. CATEGORY:=Base system
  36. DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +libblobmsg-json +libjson-c
  37. TITLE:=OpenWrt system process manager
  38. USERID:=:dialout=20 :audio=29
  39. endef
  40. define Package/procd-ujail
  41. SECTION:=base
  42. CATEGORY:=Base system
  43. DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS +libubox +libubus +libblobmsg-json
  44. TITLE:=OpenWrt process jail helper
  45. endef
  46. define Package/procd-ujail-console
  47. SECTION:=base
  48. CATEGORY:=Base system
  49. DEPENDS:=+procd-ujail +libubus +libubox
  50. TITLE:=OpenWrt process jail console
  51. endef
  52. define Package/procd-seccomp
  53. SECTION:=base
  54. CATEGORY:=Base system
  55. DEPENDS:=@(arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
  56. TITLE:=OpenWrt process seccomp helper + utrace
  57. endef
  58. define Package/procd/config
  59. menu "Configuration"
  60. depends on PACKAGE_procd
  61. config PROCD_SHOW_BOOT
  62. bool
  63. default n
  64. prompt "Print the shutdown to the console as well as logging it to syslog"
  65. config PROCD_ZRAM_TMPFS
  66. bool
  67. default n
  68. prompt "Mount /tmp using zram."
  69. endmenu
  70. endef
  71. ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
  72. CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
  73. endif
  74. ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
  75. CMAKE_OPTIONS += -DZRAM_TMPFS=1
  76. endif
  77. ifdef CONFIG_PACKAGE_procd-ujail
  78. CMAKE_OPTIONS += -DJAIL_SUPPORT=1
  79. endif
  80. SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0)
  81. CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
  82. define Package/procd/install
  83. $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
  84. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
  85. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
  86. $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
  87. $(INSTALL_CONF) ./files/hotplug*.json $(1)/etc/
  88. $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
  89. endef
  90. define Package/procd-ujail/install
  91. $(INSTALL_DIR) $(1)/sbin
  92. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
  93. endef
  94. define Package/procd-ujail-console/install
  95. $(INSTALL_DIR) $(1)/sbin
  96. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail-console $(1)/sbin/
  97. endef
  98. define Package/procd-seccomp/install
  99. $(INSTALL_DIR) $(1)/sbin $(1)/lib
  100. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
  101. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
  102. $(LN) utrace $(1)/sbin/seccomp-trace
  103. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
  104. endef
  105. $(eval $(call BuildPackage,procd))
  106. $(eval $(call BuildPackage,procd-ujail))
  107. $(eval $(call BuildPackage,procd-ujail-console))
  108. $(eval $(call BuildPackage,procd-seccomp))