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