Makefile 4.2 KB

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