blob: ee05496203c028544ab188c803b0a066bcfe050c [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 \
Andrew Geisslerc5535c92023-01-27 16:10:19 -060016 file://0001-Define-_DBUS_ALIGNOF-using-_Alignof-when-using-C11-o.patch \
Andrew Geissler9aee5002022-03-30 16:27:02 +000017 file://dbus-1.init \
18"
19
Patrick Williams2390b1b2022-11-03 13:47:49 -050020SRC_URI[sha256sum] = "7c0f9b8e5ec0ff2479383e62c0084a3a29af99edf1514e9f659b81b30d4e353e"
Andrew Geissler9aee5002022-03-30 16:27:02 +000021
22EXTRA_OECONF = "--disable-xml-docs \
23 --disable-doxygen-docs \
24 --enable-largefile \
25 --with-system-socket=/run/dbus/system_bus_socket \
26 --enable-tests \
27 --enable-checks \
28 --enable-asserts \
Andrew Geissler78b72792022-06-14 06:47:25 -050029 --runstatedir=/run \
Andrew Geissler9aee5002022-03-30 16:27:02 +000030 "
31EXTRA_OECONF:append:class-target = " SYSTEMCTL=${base_bindir}/systemctl"
32
33PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \
34 user-session \
35 "
36PACKAGECONFIG:class-native = ""
37PACKAGECONFIG:class-nativesdk = ""
38
39PACKAGECONFIG[systemd] = "--enable-systemd --with-systemdsystemunitdir=${systemd_system_unitdir},--disable-systemd --without-systemdsystemunitdir,systemd"
40PACKAGECONFIG[x11] = "--enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm"
41PACKAGECONFIG[user-session] = "--enable-user-session --with-systemduserunitdir=${systemd_user_unitdir},--disable-user-session"
42PACKAGECONFIG[verbose-mode] = "--enable-verbose-mode,,,"
43PACKAGECONFIG[audit] = "--enable-libaudit,--disable-libaudit,audit"
44PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
45
46DEPENDS = "expat virtual/libintl autoconf-archive glib-2.0"
47RDEPENDS:${PN} += "${PN}-common ${PN}-tools"
48RDEPENDS:${PN}:class-native = ""
49
50inherit useradd update-rc.d
51
52INITSCRIPT_NAME = "dbus-1"
53INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
54
55python __anonymous() {
56 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
57 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
58}
59
60PACKAGES =+ "${PN}-lib ${PN}-common ${PN}-tools"
61
62USERADD_PACKAGES = "dbus-common"
63USERADD_PARAM:dbus-common = "--system --home ${localstatedir}/lib/dbus \
64 --no-create-home --shell /bin/false \
65 --user-group messagebus"
66
67CONFFILES:${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
68
69DEBIANNAME:${PN} = "dbus-1"
70
71OLDPKGNAME = "dbus-x11"
72OLDPKGNAME:class-nativesdk = ""
73
74# for compatibility
75RPROVIDES:${PN} = "${OLDPKGNAME}"
76RREPLACES:${PN} += "${OLDPKGNAME}"
77
78FILES:${PN} = "${bindir}/dbus-daemon* \
79 ${bindir}/dbus-cleanup-sockets \
80 ${bindir}/dbus-launch \
81 ${bindir}/dbus-run-session \
82 ${libexecdir}/dbus* \
83 ${sysconfdir} \
84 ${localstatedir} \
85 ${systemd_system_unitdir} \
86 ${systemd_user_unitdir} \
87 ${nonarch_libdir}/tmpfiles.d/dbus.conf \
88"
89FILES:${PN}-common = "${sysconfdir}/dbus-1 \
90 ${datadir}/dbus-1/services \
91 ${datadir}/dbus-1/system-services \
92 ${datadir}/dbus-1/session.d \
93 ${datadir}/dbus-1/session.conf \
94 ${datadir}/dbus-1/system.d \
95 ${datadir}/dbus-1/system.conf \
96 ${systemd_system_unitdir}/dbus.socket \
97 ${systemd_system_unitdir}/sockets.target.wants \
98 ${systemd_user_unitdir}/dbus.socket \
99 ${systemd_user_unitdir}/sockets.target.wants \
100 ${nonarch_libdir}/sysusers.d/dbus.conf \
101"
102FILES:${PN}-tools = "${bindir}/dbus-uuidgen \
103 ${bindir}/dbus-send \
104 ${bindir}/dbus-monitor \
105 ${bindir}/dbus-update-activation-environment \
106"
107FILES:${PN}-lib = "${libdir}/lib*.so.*"
108RRECOMMENDS:${PN}-lib = "${PN}"
109FILES:${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-test-tool ${datadir}/xml/dbus-1"
110
111RDEPENDS:${PN}-ptest += "bash make dbus"
112
113PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}"
114pkg_postinst:dbus() {
115 # If both systemd and sysvinit are enabled, mask the dbus-1 init script
116 if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
117 if [ -n "$D" ]; then
118 OPTS="--root=$D"
119 fi
120 systemctl $OPTS mask dbus-1.service
121 fi
122
123 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
124 /etc/init.d/populate-volatile.sh update
125 fi
126}
127
128
129do_install() {
130 autotools_do_install
131
132 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
133 install -d ${D}${sysconfdir}/init.d
134 sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-1.init >${WORKDIR}/dbus-1.init.sh
135 install -m 0755 ${WORKDIR}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
136 install -d ${D}${sysconfdir}/default/volatiles
Andrew Geissler78b72792022-06-14 06:47:25 -0500137 echo "d messagebus messagebus 0755 /run/dbus none" \
Andrew Geissler9aee5002022-03-30 16:27:02 +0000138 > ${D}${sysconfdir}/default/volatiles/99_dbus
139 fi
140
141 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
142 for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \
143 install -d ${D}${systemd_system_unitdir}/$i; done
144 install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_system_unitdir}/
145 ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/dbus.target.wants/dbus.socket
146 ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/sockets.target.wants/dbus.socket
147 ln -fs ../dbus.service ${D}${systemd_system_unitdir}/multi-user.target.wants/dbus.service
148 fi
149
150
151 mkdir -p ${D}${localstatedir}/lib/dbus
152
153 chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
154
155 chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
156 chmod 4755 ${D}${libexecdir}/dbus-daemon-launch-helper
157
158 # Remove Red Hat initscript
159 rm -rf ${D}${sysconfdir}/rc.d
160
161 # Remove empty testexec directory as we don't build tests
162 rm -rf ${D}${libdir}/dbus-1.0/test
163
164 # Remove /var/run as it is created on startup
165 rm -rf ${D}${localstatedir}/run
166}
167
168do_install:class-native() {
169 autotools_do_install
170
171 # dbus-launch has no X support so lets not install it in case the host
172 # has a more featured and useful version
173 rm -f ${D}${bindir}/dbus-launch
174}
175
176do_install:class-nativesdk() {
177 autotools_do_install
178
179 # dbus-launch has no X support so lets not install it in case the host
180 # has a more featured and useful version
181 rm -f ${D}${bindir}/dbus-launch
182
183 # Remove /var/run to avoid QA error
184 rm -rf ${D}${localstatedir}/run
185}
186BBCLASSEXTEND = "native nativesdk"
Andrew Geissler517393d2023-01-13 08:55:19 -0600187
188CVE_PRODUCT += "d-bus_project:d-bus"