procd: update to git HEAD
[openwrt/staging/wigyori.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=$(PROJECT_GIT)/project/procd.git
15 PKG_SOURCE_DATE:=2020-08-06
16 PKG_SOURCE_VERSION:=16159bb1f70f662738395f2750a7a5e74a410408
17 PKG_MIRROR_HASH:=52189cf7ded713524e5afb94132665e2558be24c7c64fda89be4341bbe3af8c4
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_ASLR_PIE_REGULAR:=1
26 PKG_CONFIG_DEPENDS:= \
27 CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP \
28 CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
29 CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
30
31 include $(INCLUDE_DIR)/package.mk
32 include $(INCLUDE_DIR)/cmake.mk
33
34 ifeq ($(DUMP),)
35 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5)
36 endif
37
38 CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
39 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
40
41 TARGET_CFLAGS += -flto
42 TARGET_LDFLAGS += -flto
43
44 define Package/procd
45 SECTION:=base
46 CATEGORY:=Base system
47 DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +libblobmsg-json +libjson-c
48 TITLE:=OpenWrt system process manager
49 USERID:=:dialout=20 :audio=29
50 endef
51
52 define Package/procd-ujail
53 SECTION:=base
54 CATEGORY:=Base system
55 DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS +libubox +libubus +libblobmsg-json
56 TITLE:=OpenWrt process jail helper
57 endef
58
59 define Package/procd-ujail-console
60 SECTION:=base
61 CATEGORY:=Base system
62 DEPENDS:=+procd-ujail +libubus +libubox
63 TITLE:=OpenWrt process jail console
64 endef
65
66 define Package/procd-seccomp
67 SECTION:=base
68 CATEGORY:=Base system
69 DEPENDS:=@(arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
70 TITLE:=OpenWrt process seccomp helper + utrace
71 endef
72
73 define Package/uxc
74 SECTION:=base
75 CATEGORY:=Base system
76 DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json
77 TITLE:=OpenWrt container management
78 MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
79 endef
80
81 define Package/procd/config
82 menu "Configuration"
83 depends on PACKAGE_procd
84
85 config PROCD_SHOW_BOOT
86 bool
87 default n
88 prompt "Print the shutdown to the console as well as logging it to syslog"
89
90 config PROCD_ZRAM_TMPFS
91 bool
92 default n
93 prompt "Mount /tmp using zram."
94 endmenu
95 endef
96
97
98 ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
99 CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
100 endif
101
102 ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
103 CMAKE_OPTIONS += -DZRAM_TMPFS=1
104 endif
105
106 ifdef CONFIG_PACKAGE_procd-ujail
107 CMAKE_OPTIONS += -DJAIL_SUPPORT=1
108 endif
109
110 SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0)
111 CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
112
113 define Package/procd/install
114 $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
115
116 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
117 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
118 $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
119 $(INSTALL_CONF) ./files/hotplug*.json $(1)/etc/
120 $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
121 endef
122
123 define Package/procd-ujail/install
124 $(INSTALL_DIR) $(1)/sbin
125 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
126 endef
127
128 define Package/procd-ujail-console/install
129 $(INSTALL_DIR) $(1)/sbin
130 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail-console $(1)/sbin/
131 endef
132
133 define Package/procd-seccomp/install
134 $(INSTALL_DIR) $(1)/sbin $(1)/lib
135 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
136 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
137 $(LN) utrace $(1)/sbin/seccomp-trace
138 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
139 endef
140
141 define Package/uxc/conffiles
142 /etc/uxc
143 endef
144
145 define Package/uxc/install
146 $(INSTALL_DIR) $(1)/sbin
147 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/uxc $(1)/sbin/
148 $(INSTALL_DIR) $(1)/etc/init.d
149 $(INSTALL_BIN) ./files/uxc.init $(1)/etc/init.d/uxc
150 endef
151
152 $(eval $(call BuildPackage,procd))
153 $(eval $(call BuildPackage,procd-ujail))
154 $(eval $(call BuildPackage,procd-ujail-console))
155 $(eval $(call BuildPackage,procd-seccomp))
156 $(eval $(call BuildPackage,uxc))