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