diff options
Diffstat (limited to 'meta/recipes-core/dbus/dbus.inc')
-rw-r--r-- | meta/recipes-core/dbus/dbus.inc | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc new file mode 100644 index 0000000000..971eabf82c --- /dev/null +++ b/meta/recipes-core/dbus/dbus.inc | |||
@@ -0,0 +1,169 @@ | |||
1 | SUMMARY = "D-Bus message bus" | ||
2 | DESCRIPTION = "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." | ||
3 | HOMEPAGE = "http://dbus.freedesktop.org" | ||
4 | SECTION = "base" | ||
5 | LICENSE = "AFL-2 | GPLv2+" | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \ | ||
7 | file://dbus/dbus.h;beginline=6;endline=20;md5=7755c9d7abccd5dbd25a6a974538bb3c" | ||
8 | DEPENDS = "expat virtual/libintl" | ||
9 | RDEPENDS_dbus_class-native = "" | ||
10 | RDEPENDS_dbus_class-nativesdk = "" | ||
11 | PACKAGES += "${@bb.utils.contains('PTEST_ENABLED', '1', 'dbus-ptest', '', d)}" | ||
12 | ALLOW_EMPTY_dbus-ptest = "1" | ||
13 | RDEPENDS_dbus-ptest_class-target = "dbus-test-ptest" | ||
14 | |||
15 | SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \ | ||
16 | file://tmpdir.patch \ | ||
17 | file://dbus-1.init \ | ||
18 | file://os-test.patch \ | ||
19 | file://clear-guid_from_server-if-send_negotiate_unix_f.patch \ | ||
20 | file://CVE-2015-0245-prevent-forged-ActivationFailure.patch \ | ||
21 | " | ||
22 | |||
23 | inherit useradd autotools pkgconfig gettext update-rc.d | ||
24 | |||
25 | INITSCRIPT_NAME = "dbus-1" | ||
26 | INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ." | ||
27 | |||
28 | python __anonymous() { | ||
29 | if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): | ||
30 | d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") | ||
31 | } | ||
32 | |||
33 | USERADD_PACKAGES = "${PN}" | ||
34 | GROUPADD_PARAM_${PN} = "-r netdev" | ||
35 | USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \ | ||
36 | --no-create-home --shell /bin/false \ | ||
37 | --user-group messagebus" | ||
38 | |||
39 | CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf" | ||
40 | |||
41 | DEBIANNAME_${PN} = "dbus-1" | ||
42 | |||
43 | PACKAGES =+ "${PN}-lib" | ||
44 | |||
45 | OLDPKGNAME = "dbus-x11" | ||
46 | OLDPKGNAME_class-nativesdk = "" | ||
47 | |||
48 | # for compatibility | ||
49 | RPROVIDES_${PN} = "${OLDPKGNAME}" | ||
50 | RREPLACES_${PN} += "${OLDPKGNAME}" | ||
51 | |||
52 | FILES_${PN} = "${bindir}/dbus-daemon* \ | ||
53 | ${bindir}/dbus-uuidgen \ | ||
54 | ${bindir}/dbus-cleanup-sockets \ | ||
55 | ${bindir}/dbus-send \ | ||
56 | ${bindir}/dbus-monitor \ | ||
57 | ${bindir}/dbus-launch \ | ||
58 | ${bindir}/dbus-run-session \ | ||
59 | ${libexecdir}/dbus* \ | ||
60 | ${sysconfdir} \ | ||
61 | ${localstatedir} \ | ||
62 | ${datadir}/dbus-1/services \ | ||
63 | ${datadir}/dbus-1/system-services \ | ||
64 | ${systemd_unitdir}/system/" | ||
65 | FILES_${PN}-lib = "${libdir}/lib*.so.*" | ||
66 | RRECOMMENDS_${PN}-lib = "${PN}" | ||
67 | FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool" | ||
68 | |||
69 | pkg_postinst_dbus() { | ||
70 | # If both systemd and sysvinit are enabled, mask the dbus-1 init script | ||
71 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then | ||
72 | if [ -n "$D" ]; then | ||
73 | OPTS="--root=$D" | ||
74 | fi | ||
75 | systemctl $OPTS mask dbus-1.service | ||
76 | fi | ||
77 | |||
78 | if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then | ||
79 | /etc/init.d/populate-volatile.sh update | ||
80 | fi | ||
81 | } | ||
82 | |||
83 | EXTRA_OECONF = "--disable-tests \ | ||
84 | --disable-xml-docs \ | ||
85 | --disable-doxygen-docs \ | ||
86 | --disable-libaudit \ | ||
87 | --disable-systemd \ | ||
88 | --without-dbus-glib" | ||
89 | |||
90 | EXTRA_OECONF_append_class-native = " --disable-selinux" | ||
91 | |||
92 | PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ | ||
93 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" | ||
94 | PACKAGECONFIG_class-native = "" | ||
95 | PACKAGECONFIG_class-nativesdk = "" | ||
96 | |||
97 | # Would like to --enable-systemd but that's a circular build-dependency between | ||
98 | # systemd<->dbus | ||
99 | PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir" | ||
100 | PACKAGECONFIG[x11] = "--with-x --enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm" | ||
101 | |||
102 | do_install() { | ||
103 | autotools_do_install | ||
104 | |||
105 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
106 | install -d ${D}${sysconfdir}/init.d | ||
107 | sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-1.init >${WORKDIR}/dbus-1.init.sh | ||
108 | install -m 0755 ${WORKDIR}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1 | ||
109 | fi | ||
110 | |||
111 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
112 | for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \ | ||
113 | install -d ${D}${systemd_unitdir}/system/$i; done | ||
114 | install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_unitdir}/system/ | ||
115 | cd ${D}${systemd_unitdir}/system/dbus.target.wants/ | ||
116 | ln -fs ../dbus.socket ${D}${systemd_unitdir}/system/dbus.target.wants/dbus.socket | ||
117 | ln -fs ../dbus.socket ${D}${systemd_unitdir}/system/sockets.target.wants/dbus.socket | ||
118 | ln -fs ../dbus.service ${D}${systemd_unitdir}/system/multi-user.target.wants/dbus.service | ||
119 | fi | ||
120 | |||
121 | install -d ${D}${sysconfdir}/default/volatiles | ||
122 | echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \ | ||
123 | > ${D}${sysconfdir}/default/volatiles/99_dbus | ||
124 | |||
125 | |||
126 | mkdir -p ${D}${localstatedir}/lib/dbus | ||
127 | |||
128 | chown messagebus:messagebus ${D}${localstatedir}/lib/dbus | ||
129 | |||
130 | chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper | ||
131 | chmod 4755 ${D}${libexecdir}/dbus-daemon-launch-helper | ||
132 | |||
133 | # Remove Red Hat initscript | ||
134 | rm -rf ${D}${sysconfdir}/rc.d | ||
135 | |||
136 | # Remove empty testexec directory as we don't build tests | ||
137 | rm -rf ${D}${libdir}/dbus-1.0/test | ||
138 | |||
139 | # Remove /var/run as it is created on startup | ||
140 | rm -rf ${D}${localstatedir}/run | ||
141 | } | ||
142 | |||
143 | do_install_class-native() { | ||
144 | autotools_do_install | ||
145 | |||
146 | # for dbus-glib-native introspection generation | ||
147 | install -d ${STAGING_DATADIR_NATIVE}/dbus/ | ||
148 | # N.B. is below install actually required? | ||
149 | install -m 0644 bus/session.conf ${STAGING_DATADIR_NATIVE}/dbus/session.conf | ||
150 | |||
151 | # dbus-glib-native and dbus-glib need this xml file | ||
152 | ./bus/dbus-daemon --introspect > ${STAGING_DATADIR_NATIVE}/dbus/dbus-bus-introspect.xml | ||
153 | |||
154 | # dbus-launch has no X support so lets not install it in case the host | ||
155 | # has a more featured and useful version | ||
156 | rm -f ${D}${bindir}/dbus-launch | ||
157 | } | ||
158 | |||
159 | do_install_class-nativesdk() { | ||
160 | autotools_do_install | ||
161 | |||
162 | # dbus-launch has no X support so lets not install it in case the host | ||
163 | # has a more featured and useful version | ||
164 | rm -f ${D}${bindir}/dbus-launch | ||
165 | |||
166 | # Remove /var/run to avoid QA error | ||
167 | rm -rf ${D}${localstatedir}/run | ||
168 | } | ||
169 | BBCLASSEXTEND = "native nativesdk" | ||