Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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-02-11
  13. PKG_SOURCE_VERSION:=c30b23e3657a2838a99daa8bd2d16909c027a261
  14. PKG_MIRROR_HASH:=cb105e0269d6fb5641ab636f36b943652302a3341bc0068eff38a646d34ae80d
  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-seccomp
  47. SECTION:=base
  48. CATEGORY:=Base system
  49. DEPENDS:=@(arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
  50. TITLE:=OpenWrt process seccomp helper + utrace
  51. endef
  52. define Package/procd/config
  53. menu "Configuration"
  54. depends on PACKAGE_procd
  55. config PROCD_SHOW_BOOT
  56. bool
  57. default n
  58. prompt "Print the shutdown to the console as well as logging it to syslog"
  59. config PROCD_ZRAM_TMPFS
  60. bool
  61. default n
  62. prompt "Mount /tmp using zram."
  63. endmenu
  64. endef
  65. ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
  66. CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
  67. endif
  68. ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
  69. CMAKE_OPTIONS += -DZRAM_TMPFS=1
  70. endif
  71. ifdef CONFIG_PACKAGE_procd-ujail
  72. CMAKE_OPTIONS += -DJAIL_SUPPORT=1
  73. endif
  74. SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0)
  75. CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
  76. define Package/procd/install
  77. $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
  78. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
  79. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
  80. $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
  81. $(INSTALL_CONF) ./files/hotplug*.json $(1)/etc/
  82. $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
  83. endef
  84. define Package/procd-ujail/install
  85. $(INSTALL_DIR) $(1)/sbin
  86. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
  87. endef
  88. define Package/procd-seccomp/install
  89. $(INSTALL_DIR) $(1)/sbin $(1)/lib
  90. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
  91. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
  92. $(LN) utrace $(1)/sbin/seccomp-trace
  93. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
  94. endef
  95. $(eval $(call BuildPackage,procd))
  96. $(eval $(call BuildPackage,procd-ujail))
  97. $(eval $(call BuildPackage,procd-seccomp))