blob: cf7f830f1606942b6f9f2ad09b3ebabd379ee4b4 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001SUMMARY = "D-Bus message bus"
2DESCRIPTION = "D-Bus is a message bus system, a simple way for applications to talk to one another. In addition to interprocess communication, D-Bus helps coordinate process lifecycle; it makes it simple and reliable to code a \"single instance\" application or daemon, and to launch applications and daemons on demand when their services are needed."
3HOMEPAGE = "https://dbus.freedesktop.org"
4SECTION = "base"
5
6inherit autotools pkgconfig gettext upstream-version-is-even ptest-gnome
7
8LICENSE = "AFL-2.1 | GPL-2.0-or-later"
Patrick Williams2390b1b2022-11-03 13:47:49 -05009LIC_FILES_CHKSUM = "file://COPYING;md5=6423dcd74d7be9715b0db247fd889da3 \
10 file://dbus/dbus.h;beginline=6;endline=20;md5=866739837ccd835350af94dccd6457d8 \
11 "
Andrew Geissler9aee5002022-03-30 16:27:02 +000012
13SRC_URI = "https://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.xz \
14 file://run-ptest \
15 file://tmpdir.patch \
16 file://dbus-1.init \
17"
18
Patrick Williams2390b1b2022-11-03 13:47:49 -050019SRC_URI[sha256sum] = "7c0f9b8e5ec0ff2479383e62c0084a3a29af99edf1514e9f659b81b30d4e353e"
Andrew Geissler9aee5002022-03-30 16:27:02 +000020
21EXTRA_OECONF = "--disable-xml-docs \
22 --disable-doxygen-docs \
23 --enable-largefile \
24 --with-system-socket=/run/dbus/system_bus_socket \
25 --enable-tests \
26 --enable-checks \
27 --enable-asserts \
Andrew Geissler78b72792022-06-14 06:47:25 -050028 --runstatedir=/run \
Andrew Geissler9aee5002022-03-30 16:27:02 +000029 "
30EXTRA_OECONF:append:class-target = " SYSTEMCTL=${base_bindir}/systemctl"
31
32PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \
33 user-session \
34 "
35PACKAGECONFIG:class-native = ""
36PACKAGECONFIG:class-nativesdk = ""
37
38PACKAGECONFIG[systemd] = "--enable-systemd --with-systemdsystemunitdir=${systemd_system_unitdir},--disable-systemd --without-systemdsystemunitdir,systemd"
39PACKAGECONFIG[x11] = "--enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm"
40PACKAGECONFIG[user-session] = "--enable-user-session --with-systemduserunitdir=${systemd_user_unitdir},--disable-user-session"
41PACKAGECONFIG[verbose-mode] = "--enable-verbose-mode,,,"
42PACKAGECONFIG[audit] = "--enable-libaudit,--disable-libaudit,audit"
43PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
44
45DEPENDS = "expat virtual/libintl autoconf-archive glib-2.0"
46RDEPENDS:${PN} += "${PN}-common ${PN}-tools"
47RDEPENDS:${PN}:class-native = ""
48
49inherit useradd update-rc.d
50
51INITSCRIPT_NAME = "dbus-1"
52INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
53
54python __anonymous() {
55 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
56 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
57}
58
59PACKAGES =+ "${PN}-lib ${PN}-common ${PN}-tools"
60
61USERADD_PACKAGES = "dbus-common"
62USERADD_PARAM:dbus-common = "--system --home ${localstatedir}/lib/dbus \
63 --no-create-home --shell /bin/false \
64 --user-group messagebus"
65
66CONFFILES:${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
67
68DEBIANNAME:${PN} = "dbus-1"
69
70OLDPKGNAME = "dbus-x11"
71OLDPKGNAME:class-nativesdk = ""
72
73# for compatibility
74RPROVIDES:${PN} = "${OLDPKGNAME}"
75RREPLACES:${PN} += "${OLDPKGNAME}"
76
77FILES:${PN} = "${bindir}/dbus-daemon* \
78 ${bindir}/dbus-cleanup-sockets \
79 ${bindir}/dbus-launch \
80 ${bindir}/dbus-run-session \
81 ${libexecdir}/dbus* \
82 ${sysconfdir} \
83 ${localstatedir} \
84 ${systemd_system_unitdir} \
85 ${systemd_user_unitdir} \
86 ${nonarch_libdir}/tmpfiles.d/dbus.conf \
87"
88FILES:${PN}-common = "${sysconfdir}/dbus-1 \
89 ${datadir}/dbus-1/services \
90 ${datadir}/dbus-1/system-services \
91 ${datadir}/dbus-1/session.d \
92 ${datadir}/dbus-1/session.conf \
93 ${datadir}/dbus-1/system.d \
94 ${datadir}/dbus-1/system.conf \
95 ${systemd_system_unitdir}/dbus.socket \
96 ${systemd_system_unitdir}/sockets.target.wants \
97 ${systemd_user_unitdir}/dbus.socket \
98 ${systemd_user_unitdir}/sockets.target.wants \
99 ${nonarch_libdir}/sysusers.d/dbus.conf \
100"
101FILES:${PN}-tools = "${bindir}/dbus-uuidgen \
102 ${bindir}/dbus-send \
103 ${bindir}/dbus-monitor \
104 ${bindir}/dbus-update-activation-environment \
105"
106FILES:${PN}-lib = "${libdir}/lib*.so.*"
107RRECOMMENDS:${PN}-lib = "${PN}"
108FILES:${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-test-tool ${datadir}/xml/dbus-1"
109
110RDEPENDS:${PN}-ptest += "bash make dbus"
111
112PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}"
113pkg_postinst:dbus() {
114 # If both systemd and sysvinit are enabled, mask the dbus-1 init script
115 if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
116 if [ -n "$D" ]; then
117 OPTS="--root=$D"
118 fi
119 systemctl $OPTS mask dbus-1.service
120 fi
121
122 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
123 /etc/init.d/populate-volatile.sh update
124 fi
125}
126
127
128do_install() {
129 autotools_do_install
130
131 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
132 install -d ${D}${sysconfdir}/init.d
133 sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-1.init >${WORKDIR}/dbus-1.init.sh
134 install -m 0755 ${WORKDIR}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
135 install -d ${D}${sysconfdir}/default/volatiles
Andrew Geissler78b72792022-06-14 06:47:25 -0500136 echo "d messagebus messagebus 0755 /run/dbus none" \
Andrew Geissler9aee5002022-03-30 16:27:02 +0000137 > ${D}${sysconfdir}/default/volatiles/99_dbus
138 fi
139
140 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
141 for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \
142 install -d ${D}${systemd_system_unitdir}/$i; done
143 install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_system_unitdir}/
144 ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/dbus.target.wants/dbus.socket
145 ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/sockets.target.wants/dbus.socket
146 ln -fs ../dbus.service ${D}${systemd_system_unitdir}/multi-user.target.wants/dbus.service
147 fi
148
149
150 mkdir -p ${D}${localstatedir}/lib/dbus
151
152 chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
153
154 chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
155 chmod 4755 ${D}${libexecdir}/dbus-daemon-launch-helper
156
157 # Remove Red Hat initscript
158 rm -rf ${D}${sysconfdir}/rc.d
159
160 # Remove empty testexec directory as we don't build tests
161 rm -rf ${D}${libdir}/dbus-1.0/test
162
163 # Remove /var/run as it is created on startup
164 rm -rf ${D}${localstatedir}/run
165}
166
167do_install:class-native() {
168 autotools_do_install
169
170 # dbus-launch has no X support so lets not install it in case the host
171 # has a more featured and useful version
172 rm -f ${D}${bindir}/dbus-launch
173}
174
175do_install:class-nativesdk() {
176 autotools_do_install
177
178 # dbus-launch has no X support so lets not install it in case the host
179 # has a more featured and useful version
180 rm -f ${D}${bindir}/dbus-launch
181
182 # Remove /var/run to avoid QA error
183 rm -rf ${D}${localstatedir}/run
184}
185BBCLASSEXTEND = "native nativesdk"