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