nfc-manager-neard: update recipe
[scm/bb/meta-tizen.git] / recipes-core / dbus / dbus.inc
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('DISTRO_FEATURES', 'ptest', '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://Set-correct-address-when-using-address-systemd.patch \
21            file://fixed-memory-freeing-if-error-during-listing-service.patch \
22 "
23
24 inherit useradd autotools pkgconfig gettext update-rc.d
25
26 INITSCRIPT_NAME = "dbus-1"
27 INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
28
29 python __anonymous() {
30     if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
31         d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
32 }
33
34 USERADD_PACKAGES = "${PN}"
35 GROUPADD_PARAM_${PN} = "-r netdev"
36 USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
37                        --no-create-home --shell /bin/false \
38                        --user-group messagebus"
39
40 CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
41
42 DEBIANNAME_${PN} = "dbus-1"
43
44 PACKAGES =+ "${PN}-lib"
45
46 OLDPKGNAME = "dbus-x11"
47 OLDPKGNAME_class-nativesdk = ""
48
49 # for compatibility
50 RPROVIDES_${PN} = "${OLDPKGNAME}"
51 RREPLACES_${PN} += "${OLDPKGNAME}"
52
53 FILES_${PN} = "${bindir}/dbus-daemon* \
54                ${bindir}/dbus-uuidgen \
55                ${bindir}/dbus-cleanup-sockets \
56                ${bindir}/dbus-send \
57                ${bindir}/dbus-monitor \
58                ${bindir}/dbus-launch \
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                 --with-xml=expat \
88                 --disable-systemd"
89
90 PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
91                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
92 PACKAGECONFIG_class-native = ""
93 PACKAGECONFIG_class-nativesdk = ""
94
95 # Would like to --enable-systemd but that's a circular build-dependency between
96 # systemd<->dbus
97 PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir"
98 PACKAGECONFIG[x11] = "--with-x --enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm"
99
100 do_install() {
101         autotools_do_install
102
103         if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
104                 install -d ${D}${sysconfdir}/init.d
105                 sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-1.init >${WORKDIR}/dbus-1.init.sh
106                 install -m 0755 ${WORKDIR}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
107         fi
108
109         install -d ${D}${sysconfdir}/default/volatiles
110         echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \
111              > ${D}${sysconfdir}/default/volatiles/99_dbus
112
113
114         mkdir -p ${D}${localstatedir}/lib/dbus
115
116         chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
117
118         chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
119         chmod 4755 ${D}${libexecdir}/dbus-daemon-launch-helper
120
121         # Remove Red Hat initscript
122         rm -rf ${D}${sysconfdir}/rc.d
123
124         # Remove empty testexec directory as we don't build tests
125         rm -rf ${D}${libdir}/dbus-1.0/test
126
127         # Remove /var/run as it is created on startup
128         rm -rf ${D}${localstatedir}/run
129 }
130
131 do_install_class-native() {
132         autotools_do_install
133
134         # for dbus-glib-native introspection generation
135         install -d ${STAGING_DATADIR_NATIVE}/dbus/
136         # N.B. is below install actually required?
137         install -m 0644 bus/session.conf ${STAGING_DATADIR_NATIVE}/dbus/session.conf
138
139         # dbus-glib-native and dbus-glib need this xml file
140         ./bus/dbus-daemon --introspect > ${STAGING_DATADIR_NATIVE}/dbus/dbus-bus-introspect.xml
141         
142         # dbus-launch has no X support so lets not install it in case the host
143         # has a more featured and useful version
144         rm -f ${D}${bindir}/dbus-launch
145 }
146
147 do_install_class-nativesdk() {
148         autotools_do_install
149
150         # dbus-launch has no X support so lets not install it in case the host
151         # has a more featured and useful version
152         rm -f ${D}${bindir}/dbus-launch
153
154         # Remove /var/run to avoid QA error
155         rm -rf ${D}${localstatedir}/run
156 }
157 BBCLASSEXTEND = "native nativesdk"