1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_COMPAT=( python{2_7,3_{4,5,6}} )
7 inherit autotools ltprune linux-info flag-o-matic python-any-r1 readme.gentoo-r1 systemd virtualx user multilib-minimal
9 DESCRIPTION="A message bus system, a simple way for applications to talk to each other"
10 HOMEPAGE="https://dbus.freedesktop.org/"
11 SRC_URI="https://dbus.freedesktop.org/releases/dbus/${P}.tar.gz"
13 LICENSE="|| ( AFL-2.1 GPL-2 )"
15 KEYWORDS="alpha amd64 ~arm ~arm64 ~hppa ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
16 IUSE="debug doc elogind selinux static-libs systemd test user-session X"
21 ?? ( elogind systemd )
27 selinux? ( sys-libs/libselinux )
28 elogind? ( sys-auth/elogind )
29 systemd? ( sys-apps/systemd:0= )
37 app-text/docbook-xml-dtd:4.4
39 doc? ( app-doc/doxygen )
41 >=dev-libs/glib-2.36:2
46 selinux? ( sec-policy/selinux-dbus )
50 Some applications require a session bus in addition to the system
51 bus. Please see \`man dbus-launch\` for more information.
54 # out of sources build dir for make check
55 TBD="${WORKDIR}/${P}-tests-build"
58 "${FILESDIR}/${PN}-enable-elogind.patch"
63 enewuser messagebus -1 -1 -1 messagebus
65 use test && python-any-r1_pkg_setup
67 if use kernel_linux; then
74 # Tests were restricted because of this
76 -e 's/.*bus_dispatch_test.*/printf ("Disabled due to excess noise\\n");/' \
78 bus/test-main.c || die
82 # required for bug 263909, cross-compile so don't remove eautoreconf
86 multilib_src_configure() {
89 # so we can get backtraces from apps
92 # error: unrecognized command line option '-rdynamic' wrt #488036
95 append-flags -rdynamic
99 # libaudit is *only* used in DBus wrt SELinux support, so disable it, if
100 # not on an SELinux profile.
102 --localstatedir="${EPREFIX}/var"
103 --docdir="${EPREFIX}/usr/share/doc/${PF}"
104 --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
105 $(use_enable static-libs static)
106 $(use_enable debug verbose-mode)
109 $(use_enable selinux)
110 $(use_enable selinux libaudit)
112 $(use_enable kernel_linux inotify)
113 $(use_enable kernel_FreeBSD kqueue)
114 $(use_enable elogind)
115 $(use_enable systemd)
116 $(use_enable user-session)
117 --disable-embedded-tests
118 --disable-modular-tests
119 $(use_enable debug stats)
120 --with-session-socket-dir="${EPREFIX}"/tmp
121 --with-system-pid-file="${EPREFIX}"/var/run/dbus.pid
122 --with-system-socket="${EPREFIX}"/var/run/dbus/system_bus_socket
123 --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
124 --with-dbus-user=messagebus
128 if [[ ${CHOST} == *-darwin* ]]; then
131 --with-launchd-agent-dir="${EPREFIX}"/Library/LaunchAgents
135 if multilib_is_native_abi; then
138 $(use_enable doc doxygen-docs)
143 --disable-doxygen-docs
152 # expat is used for the daemon only
153 # fake the check for multilib library build
154 ac_cv_lib_expat_XML_ParserCreate_MM=yes
158 einfo "Running configure in ${BUILD_DIR}"
159 ECONF_SOURCE="${S}" econf "${myconf[@]}" "${docconf[@]}"
161 if multilib_is_native_abi && use test; then
162 mkdir "${TBD}" || die
164 einfo "Running configure in ${TBD}"
165 ECONF_SOURCE="${S}" econf "${myconf[@]}" \
166 $(use_enable test asserts) \
167 $(use_enable test checks) \
168 $(use_enable test embedded-tests) \
169 $(has_version dev-libs/dbus-glib && echo --enable-modular-tests)
173 multilib_src_compile() {
174 if multilib_is_native_abi; then
175 # after the compile, it uses a selinuxfs interface to
176 # check if the SELinux policy has the right support
177 use selinux && addwrite /selinux/access
179 einfo "Running make in ${BUILD_DIR}"
183 einfo "Running make in ${TBD}"
187 emake -C dbus libdbus-1.la
192 DBUS_VERBOSE=1 virtx emake -j1 -C "${TBD}" check
195 multilib_src_install() {
196 if multilib_is_native_abi; then
197 emake DESTDIR="${D}" install
199 emake DESTDIR="${D}" install-pkgconfigDATA
200 emake DESTDIR="${D}" -C dbus \
201 install-libLTLIBRARIES install-dbusincludeHEADERS \
202 install-nodist_dbusarchincludeHEADERS
206 multilib_src_install_all() {
207 newinitd "${FILESDIR}"/dbus.initd-r1 dbus
210 # dbus X session script (#77504)
211 # turns out to only work for GDM (and startx). has been merged into
212 # other desktop (kdm and such scripts)
213 exeinto /etc/X11/xinit/xinitrc.d
214 doexe "${FILESDIR}"/80-dbus
217 # needs to exist for dbus sessions to launch
218 keepdir /usr/share/dbus-1/services
219 keepdir /etc/dbus-1/{session,system}.d
220 # machine-id symlink from pkg_postinst()
221 keepdir /var/lib/dbus
222 # let the init script create the /var/run/dbus directory
223 rm -rf "${ED}"/var/run
225 dodoc AUTHORS ChangeLog HACKING NEWS README doc/TODO
226 readme.gentoo_create_doc
228 prune_libtool_files --all
232 readme.gentoo_print_elog
234 # Ensure unique id is generated and put it in /etc wrt #370451 but symlink
235 # for DBUS_MACHINE_UUID_FILE (see tools/dbus-launch.c) and reverse
236 # dependencies with hardcoded paths (although the known ones got fixed already)
237 dbus-uuidgen --ensure="${EROOT}"/etc/machine-id
238 ln -sf "${EPREFIX}"/etc/machine-id "${EROOT}"/var/lib/dbus/machine-id
240 if [[ ${CHOST} == *-darwin* ]]; then
241 local plist="org.freedesktop.dbus-session.plist"
244 elog "For MacOS/Darwin we now ship launchd support for dbus."
245 elog "This enables autolaunch of dbus at session login and makes"
246 elog "dbus usable under MacOS/Darwin."
248 elog "The launchd plist file ${plist} has been"
249 elog "installed in ${EPREFIX}/Library/LaunchAgents."
250 elog "For it to be used, you will have to do all of the following:"
251 elog " + cd ~/Library/LaunchAgents"
252 elog " + ln -s ${EPREFIX}/Library/LaunchAgents/${plist}"
253 elog " + logout and log back in"
255 elog "If your application needs a proper DBUS_SESSION_BUS_ADDRESS"
256 elog "specified and refused to start otherwise, then export the"
257 elog "the following to your environment:"
258 elog " DBUS_SESSION_BUS_ADDRESS=\"launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET\""
261 if use user-session; then
262 ewarn "You have enabled user-session. Please note this can cause"
263 ewarn "bogus behaviors in several dbus consumers that are not prepared"
264 ewarn "for this dbus activation method yet."
266 ewarn "See the following link for background on this change:"
267 ewarn "https://lists.freedesktop.org/archives/systemd-devel/2015-January/027711.html"
269 ewarn "Known issues are tracked here:"
270 ewarn "https://bugs.gentoo.org/show_bug.cgi?id=576028"