2c7ea3bdccb1b1432cad76e3ba578758c58e5b48
[openwrt/svn-archive/archive.git] / package / system / procd / Makefile
1 #
2 # Copyright (C) 2014-2015 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:=2015-08-16
12
13 PKG_RELEASE=$(PKG_SOURCE_VERSION)
14
15 PKG_SOURCE_PROTO:=git
16 PKG_SOURCE_URL:=git://nbd.name/luci2/procd.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=0da5bf2ff222d1a499172a6e09507388676b5a08
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 <blogic@openwrt.org>
26
27 PKG_CONFIG_DEPENDS:= CONFIG_KERNEL_SECCOMP CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS CONFIG_PROCD_JAIL_SUPPORT
28
29 include $(INCLUDE_DIR)/package.mk
30 include $(INCLUDE_DIR)/cmake.mk
31
32 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
33
34 define Package/procd
35 SECTION:=base
36 CATEGORY:=Base system
37 DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand
38 TITLE:=OpenWrt system process manager
39 endef
40
41 define Package/procd-jail
42 SECTION:=base
43 CATEGORY:=Base system
44 DEPENDS:=procd +@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS @PROCD_JAIL_SUPPORT
45 TITLE:=OpenWrt process jail
46 DEFAULT:=n
47 endef
48
49 define Package/procd-nand
50 SECTION:=utils
51 CATEGORY:=Utilities
52 DEPENDS:=@NAND_SUPPORT +ubi-utils
53 TITLE:=OpenWrt sysupgrade nand helper
54 endef
55
56 define Package/procd-nand-firstboot
57 SECTION:=utils
58 CATEGORY:=Utilities
59 DEPENDS:=procd-nand
60 TITLE:=OpenWrt firstboot nand helper
61 endef
62
63 define Package/procd/config
64 menu "Configuration"
65 depends on PACKAGE_procd
66
67 config PROCD_SHOW_BOOT
68 bool
69 default n
70 prompt "Print the shutdown to the console as well as logging it to syslog"
71
72 config PROCD_ZRAM_TMPFS
73 bool
74 default n
75 prompt "Mount /tmp using zram."
76
77 config PROCD_JAIL_SUPPORT
78 bool
79 default y
80 depends on (arm || armeb || mips || mipsel || i386 || x86_64) && PROCD_SECCOMP_SUPPORT
81
82 config PROCD_SECCOMP_SUPPORT
83 bool
84 default y
85 depends on (arm || armeb || mips || mipsel || i386 || x86_64) && !TARGET_uml && @KERNEL_SECCOMP
86 endmenu
87 endef
88
89
90 ifeq ($(CONFIG_NAND_SUPPORT),y)
91 CMAKE_OPTIONS += -DBUILD_UPGRADED=1
92 endif
93
94 ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
95 CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
96 endif
97
98 ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
99 CMAKE_OPTIONS += -DZRAM_TMPFS=1
100 endif
101
102 ifeq ($(CONFIG_PROCD_JAIL_SUPPORT),y)
103 CMAKE_OPTIONS += -DJAIL_SUPPORT=1
104 endif
105
106 ifeq ($(CONFIG_PROCD_SECCOMP_SUPPORT),y)
107 CMAKE_OPTIONS += -DSECCOMP_SUPPORT=1
108 endif
109
110 define Package/procd/install
111 $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
112
113 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/
114 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
115 $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
116 $(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
117 $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
118 ifeq ($(CONFIG_PROCD_SECCOMP_SUPPORT),y)
119 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
120 endif
121 endef
122
123 define Package/procd-jail/install
124 $(INSTALL_DIR) $(1)/sbin $(1)/lib
125
126 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{utrace,ujail} $(1)/sbin/
127 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
128 endef
129
130 define Package/procd-nand/install
131 $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade
132
133 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
134 $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
135 endef
136
137 define Package/procd-nand-firstboot/install
138 $(INSTALL_DIR) $(1)/lib/preinit
139
140 $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh
141 endef
142
143 $(eval $(call BuildPackage,procd))
144 $(eval $(call BuildPackage,procd-jail))
145 $(eval $(call BuildPackage,procd-nand))
146 $(eval $(call BuildPackage,procd-nand-firstboot))