bdc861af920d94e318b73f302a21a7353b7a2051
[librecmc/librecmc.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)/procd.git
15 PKG_SOURCE_DATE:=2019-05-30
16 PKG_SOURCE_VERSION:=ade00ca585a49c8478bf60eb24ce385676be37a4
17 PKG_MIRROR_HASH:=1417727ae6fcda01017e1bec3ec66e3e78116f9343cfe0256e40af54c52f2acc
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 TARGET_CFLAGS += -flto
41 TARGET_LDFLAGS += -flto
42
43 define Package/procd
44   SECTION:=base
45   CATEGORY:=Base system
46   DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +libblobmsg-json +libjson-c
47   TITLE:=libreCMC system process manager
48   USERID:=:dialout=20 :audio=29
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:=libreCMC 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||powerpc||x86_64) @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
62   TITLE:=libreCMC process seccomp helper + utrace
63 endef
64
65 define Package/procd/config
66 menu "Configuration"
67         depends on PACKAGE_procd
68
69 config PROCD_SHOW_BOOT
70         bool
71         default n
72         prompt "Print the shutdown to the console as well as logging it to syslog"
73
74 config PROCD_ZRAM_TMPFS
75         bool
76         default n
77         prompt "Mount /tmp using zram."
78 endmenu
79 endef
80
81
82 ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
83   CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
84 endif
85
86 ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
87   CMAKE_OPTIONS += -DZRAM_TMPFS=1
88 endif
89
90 ifdef CONFIG_PACKAGE_procd-ujail
91   CMAKE_OPTIONS += -DJAIL_SUPPORT=1
92 endif
93
94 SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0)
95 CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
96
97 define Package/procd/install
98         $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
99
100         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
101         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
102         $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
103         $(INSTALL_CONF) ./files/hotplug*.json $(1)/etc/
104         $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
105 endef
106
107 define Package/procd-ujail/install
108         $(INSTALL_DIR) $(1)/sbin
109         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
110 endef
111
112 define Package/procd-seccomp/install
113         $(INSTALL_DIR) $(1)/sbin $(1)/lib
114         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
115         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
116         $(LN) utrace $(1)/sbin/seccomp-trace
117         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
118 endef
119
120 $(eval $(call BuildPackage,procd))
121 $(eval $(call BuildPackage,procd-ujail))
122 $(eval $(call BuildPackage,procd-seccomp))