Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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_VERSION:=2015-10-29.1
  10. PKG_RELEASE=$(PKG_SOURCE_VERSION)
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL:=git://nbd.name/luci2/procd.git
  13. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  14. PKG_SOURCE_VERSION:=d5fddd91b966424bb63e943e789704d52382cc18
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  16. CMAKE_INSTALL:=1
  17. PKG_LICENSE:=GPL-2.0
  18. PKG_LICENSE_FILES:=
  19. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
  20. PKG_CONFIG_DEPENDS:= CONFIG_KERNEL_SECCOMP CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
  21. CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
  22. include $(INCLUDE_DIR)/package.mk
  23. include $(INCLUDE_DIR)/cmake.mk
  24. TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
  25. define Package/procd
  26. SECTION:=base
  27. CATEGORY:=Base system
  28. DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand
  29. TITLE:=OpenWrt system process manager
  30. endef
  31. define Package/procd-ujail
  32. SECTION:=base
  33. CATEGORY:=Base system
  34. DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS +libubox +libblobmsg-json
  35. TITLE:=OpenWrt process jail helper
  36. endef
  37. define Package/procd-seccomp
  38. SECTION:=base
  39. CATEGORY:=Base system
  40. DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
  41. TITLE:=OpenWrt process seccomp helper + utrace
  42. endef
  43. define Package/procd-nand
  44. SECTION:=utils
  45. CATEGORY:=Utilities
  46. DEPENDS:=@NAND_SUPPORT +ubi-utils
  47. TITLE:=OpenWrt sysupgrade nand helper
  48. endef
  49. define Package/procd-nand-firstboot
  50. SECTION:=utils
  51. CATEGORY:=Utilities
  52. DEPENDS:=procd-nand
  53. TITLE:=OpenWrt firstboot nand helper
  54. endef
  55. define Package/procd/config
  56. menu "Configuration"
  57. depends on PACKAGE_procd
  58. config PROCD_SHOW_BOOT
  59. bool
  60. default n
  61. prompt "Print the shutdown to the console as well as logging it to syslog"
  62. config PROCD_ZRAM_TMPFS
  63. bool
  64. default n
  65. prompt "Mount /tmp using zram."
  66. endmenu
  67. endef
  68. ifeq ($(CONFIG_NAND_SUPPORT),y)
  69. CMAKE_OPTIONS += -DBUILD_UPGRADED=1
  70. endif
  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. ifdef CONFIG_PACKAGE_procd-seccomp
  81. CMAKE_OPTIONS += -DSECCOMP_SUPPORT=1 -DUTRACE_SUPPORT=1
  82. endif
  83. define Package/procd/install
  84. $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
  85. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/
  86. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
  87. $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
  88. $(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
  89. $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
  90. endef
  91. define Package/procd-ujail/install
  92. $(INSTALL_DIR) $(1)/sbin
  93. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
  94. endef
  95. define Package/procd-seccomp/install
  96. $(INSTALL_DIR) $(1)/sbin $(1)/lib
  97. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
  98. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
  99. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
  100. endef
  101. define Package/procd-nand/install
  102. $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade
  103. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
  104. $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
  105. endef
  106. define Package/procd-nand-firstboot/install
  107. $(INSTALL_DIR) $(1)/lib/preinit
  108. $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh
  109. endef
  110. $(eval $(call BuildPackage,procd))
  111. $(eval $(call BuildPackage,procd-ujail))
  112. $(eval $(call BuildPackage,procd-seccomp))
  113. $(eval $(call BuildPackage,procd-nand))
  114. $(eval $(call BuildPackage,procd-nand-firstboot))