procd: make mDNS TXT record parsing more solid
[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:=$(AUTORELEASE)
12
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
15 PKG_MIRROR_HASH:=0d9b82919492e1ec0df4011b932a210b6256774d0cb1f1e3de24b6dbf36c6a77
16 PKG_SOURCE_DATE:=2022-06-01
17 PKG_SOURCE_VERSION:=7a0096853594874d4c60266ec338ac23728017df
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 CONFIG_PROCD_SHOW_BOOT \
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/Default
44 SECTION:=base
45 CATEGORY:=Base system
46 DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox \
47 +libubus +libblobmsg-json +libjson-c +jshn
48 TITLE:=OpenWrt system process manager
49 USERID:=:dialout=20 :audio=29
50 endef
51
52 define Package/procd
53 $(call Package/procd/Default)
54 VARIANT:=default
55 CONFLICTS:=procd-selinux
56 endef
57
58 define Package/procd-selinux
59 $(call Package/procd/Default)
60 DEPENDS += +libselinux
61 TITLE += with SELinux support
62 PROVIDES:=procd
63 VARIANT:=selinux
64 endef
65
66 define Package/procd-ujail
67 SECTION:=base
68 CATEGORY:=Base system
69 DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS \
70 +libubox +libubus +libuci +libblobmsg-json
71 TITLE:=OpenWrt process jail helper
72 endef
73
74 define Package/procd-seccomp
75 SECTION:=base
76 CATEGORY:=Base system
77 DEPENDS:=@SECCOMP +libubox +libblobmsg-json
78 TITLE:=OpenWrt process seccomp helper + utrace
79 endef
80
81 define Package/uxc
82 SECTION:=base
83 CATEGORY:=Base system
84 DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json +blockd +PACKAGE_uxc:rpcd
85 TITLE:=OpenWrt container management
86 MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
87 endef
88
89 define Package/procd/config
90 menu "Configuration"
91 depends on PACKAGE_procd || PACKAGE_procd-selinux
92
93 config PROCD_SHOW_BOOT
94 bool
95 default n
96 prompt "Print the shutdown to the console as well as logging it to syslog"
97
98 endmenu
99 endef
100
101 ifeq ($(BUILD_VARIANT),selinux)
102 CMAKE_OPTIONS += -DSELINUX=1
103 endif
104
105 ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
106 CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
107 endif
108
109 ifdef CONFIG_PACKAGE_procd-ujail
110 CMAKE_OPTIONS += -DJAIL_SUPPORT=1
111 endif
112
113 SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0)
114 CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP)
115
116 define Package/procd/install
117 $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
118
119 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
120 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
121 $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
122 $(INSTALL_CONF) ./files/hotplug*.json $(1)/etc/
123 $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
124 $(INSTALL_BIN) ./files/service $(1)/sbin/service
125 endef
126
127 Package/procd-selinux/install = $(Package/procd/install)
128
129 define Package/procd-ujail/install
130 $(INSTALL_DIR) $(1)/sbin
131 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
132 endef
133
134 define Package/procd-seccomp/install
135 $(INSTALL_DIR) $(1)/sbin $(1)/lib
136 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
137 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
138 $(LN) utrace $(1)/sbin/seccomp-trace
139 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
140 endef
141
142 define Package/uxc/conffiles
143 /etc/uxc
144 endef
145
146 define Package/uxc/install
147 $(INSTALL_DIR) $(1)/sbin
148 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/uxc $(1)/sbin/
149 $(INSTALL_DIR) $(1)/etc/init.d
150 $(INSTALL_BIN) ./files/uxc.init $(1)/etc/init.d/uxc
151 endef
152
153 $(eval $(call BuildPackage,procd))
154 $(eval $(call BuildPackage,procd-selinux))
155 $(eval $(call BuildPackage,procd-ujail))
156 $(eval $(call BuildPackage,procd-seccomp))
157 $(eval $(call BuildPackage,uxc))