1################################################################################
2#
3# dbus
4#
5################################################################################
6
7# When updating dbus, check if there are changes in session.conf and
8# system.conf, and update the versions in the dbus-broker package accordingly.
9DBUS_VERSION = 1.14.10
10DBUS_SOURCE = dbus-$(DBUS_VERSION).tar.xz
11DBUS_SITE = https://dbus.freedesktop.org/releases/dbus
12DBUS_LICENSE = AFL-2.1 or GPL-2.0+ (library, tools), GPL-2.0+ (tools)
13DBUS_LICENSE_FILES = COPYING
14DBUS_CPE_ID_VENDOR = freedesktop
15DBUS_INSTALL_STAGING = YES
16
17define DBUS_PERMISSIONS
18	/usr/libexec/dbus-daemon-launch-helper f 4750 0 dbus - - - - -
19endef
20
21define DBUS_USERS
22	dbus -1 dbus -1 * /run/dbus - dbus DBus messagebus user
23endef
24
25DBUS_DEPENDENCIES = host-pkgconf expat
26
27DBUS_SELINUX_MODULES = dbus
28
29DBUS_CONF_OPTS = \
30	--with-dbus-user=dbus \
31	--disable-tests \
32	--disable-asserts \
33	--disable-xml-docs \
34	--disable-doxygen-docs \
35	--with-system-socket=/run/dbus/system_bus_socket \
36	--with-system-pid-file=/run/messagebus.pid
37
38ifeq ($(BR2_STATIC_LIBS),y)
39DBUS_CONF_OPTS += LIBS='-pthread'
40endif
41
42ifeq ($(BR2_microblaze),y)
43# microblaze toolchain doesn't provide inotify_rm_* but does have sys/inotify.h
44DBUS_CONF_OPTS += --disable-inotify
45endif
46
47ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
48DBUS_CONF_OPTS += --enable-selinux
49DBUS_DEPENDENCIES += libselinux
50else
51DBUS_CONF_OPTS += --disable-selinux
52endif
53
54ifeq ($(BR2_PACKAGE_AUDIT)$(BR2_PACKAGE_LIBCAP_NG),yy)
55DBUS_CONF_OPTS += --enable-libaudit
56DBUS_DEPENDENCIES += audit libcap-ng
57else
58DBUS_CONF_OPTS += --disable-libaudit
59endif
60
61ifeq ($(BR2_PACKAGE_XLIB_LIBX11),y)
62DBUS_CONF_OPTS += --with-x
63DBUS_DEPENDENCIES += xlib_libX11
64ifeq ($(BR2_PACKAGE_XLIB_LIBSM),y)
65DBUS_DEPENDENCIES += xlib_libSM
66endif
67else
68DBUS_CONF_OPTS += --without-x
69endif
70
71ifeq ($(BR2_INIT_SYSTEMD),y)
72DBUS_CONF_OPTS += \
73	--enable-systemd \
74	--with-systemdsystemunitdir=/usr/lib/systemd/system
75DBUS_DEPENDENCIES += systemd
76else
77DBUS_CONF_OPTS += --disable-systemd
78endif
79
80# fix rebuild (dbus makefile errors out if /var/lib/dbus is a symlink)
81define DBUS_REMOVE_VAR_LIB_DBUS
82	rm -rf $(TARGET_DIR)/var/lib/dbus
83endef
84
85DBUS_PRE_INSTALL_TARGET_HOOKS += DBUS_REMOVE_VAR_LIB_DBUS
86
87define DBUS_REMOVE_DEVFILES
88	rm -rf $(TARGET_DIR)/usr/lib/dbus-1.0
89endef
90
91DBUS_POST_INSTALL_TARGET_HOOKS += DBUS_REMOVE_DEVFILES
92
93define DBUS_INSTALL_INIT_SYSV
94	$(INSTALL) -m 0755 -D package/dbus/S30dbus \
95		$(TARGET_DIR)/etc/init.d/S30dbus
96
97	mkdir -p $(TARGET_DIR)/var/lib
98	rm -rf $(TARGET_DIR)/var/lib/dbus
99	ln -sf /tmp/dbus $(TARGET_DIR)/var/lib/dbus
100endef
101
102# If dbus-broker is installed, don't install the activation links for
103# dbus itself, not the configuration files. They will be overwritten
104# by dbus-broker
105ifeq ($(BR2_PACKAGE_DBUS_BROKER),y)
106define DBUS_REMOVE_SYSTEMD_ACTIVATION_LINKS
107	rm -f $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/dbus.service
108	rm -f $(TARGET_DIR)/usr/lib/systemd/system/sockets.target.wants/dbus.socket
109	rm -f $(TARGET_DIR)/usr/lib/systemd/system/dbus.socket
110	rm -f $(TARGET_DIR)/usr/share/dbus-1/session.conf
111	rm -f $(TARGET_DIR)/usr/share/dbus-1/system.conf
112endef
113DBUS_POST_INSTALL_TARGET_HOOKS += DBUS_REMOVE_SYSTEMD_ACTIVATION_LINKS
114endif
115
116define DBUS_INSTALL_INIT_SYSTEMD
117	mkdir -p $(TARGET_DIR)/var/lib/dbus
118	ln -sf /etc/machine-id $(TARGET_DIR)/var/lib/dbus/machine-id
119endef
120
121HOST_DBUS_DEPENDENCIES = host-pkgconf host-expat
122HOST_DBUS_CONF_OPTS = \
123	--with-dbus-user=dbus \
124	--disable-tests \
125	--disable-asserts \
126	--disable-selinux \
127	--disable-xml-docs \
128	--disable-doxygen-docs \
129	--disable-systemd \
130	--without-x
131
132# dbus for the host
133DBUS_HOST_INTROSPECT = $(HOST_DBUS_DIR)/introspect.xml
134
135HOST_DBUS_GEN_INTROSPECT = \
136	$(HOST_DIR)/bin/dbus-daemon --introspect > $(DBUS_HOST_INTROSPECT)
137
138HOST_DBUS_POST_INSTALL_HOOKS += HOST_DBUS_GEN_INTROSPECT
139
140$(eval $(autotools-package))
141$(eval $(host-autotools-package))
142