dbus-1.10.18.ebuild 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python2_7 )
  5. inherit autotools eutils linux-info flag-o-matic python-any-r1 readme.gentoo-r1 systemd virtualx user multilib-minimal
  6. DESCRIPTION="A message bus system, a simple way for applications to talk to each other"
  7. HOMEPAGE="https://dbus.freedesktop.org/"
  8. SRC_URI="https://dbus.freedesktop.org/releases/dbus/${P}.tar.gz"
  9. LICENSE="|| ( AFL-2.1 GPL-2 )"
  10. SLOT="0"
  11. 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"
  12. IUSE="debug doc elogind selinux static-libs systemd test user-session X"
  13. RESTRICT="test"
  14. REQUIRED_USE="?? ( elogind systemd )"
  15. CDEPEND="
  16. >=dev-libs/expat-2
  17. selinux? (
  18. sys-libs/libselinux
  19. )
  20. elogind? ( sys-auth/elogind )
  21. systemd? ( sys-apps/systemd:0= )
  22. X? (
  23. x11-libs/libX11
  24. x11-libs/libXt
  25. )
  26. abi_x86_32? (
  27. !<=app-emulation/emul-linux-x86-baselibs-20131008-r4
  28. !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
  29. )
  30. "
  31. DEPEND="${CDEPEND}
  32. app-text/xmlto
  33. app-text/docbook-xml-dtd:4.4
  34. virtual/pkgconfig
  35. doc? ( app-doc/doxygen )
  36. test? (
  37. >=dev-libs/glib-2.36:2
  38. ${PYTHON_DEPS}
  39. )
  40. "
  41. RDEPEND="${CDEPEND}
  42. selinux? ( sec-policy/selinux-dbus )
  43. "
  44. DOC_CONTENTS="
  45. Some applications require a session bus in addition to the system
  46. bus. Please see \`man dbus-launch\` for more information.
  47. "
  48. # out of sources build dir for make check
  49. TBD=${WORKDIR}/${P}-tests-build
  50. pkg_setup() {
  51. enewgroup messagebus
  52. enewuser messagebus -1 -1 -1 messagebus
  53. use test && python-any-r1_pkg_setup
  54. if use kernel_linux; then
  55. CONFIG_CHECK="~EPOLL"
  56. linux-info_pkg_setup
  57. fi
  58. }
  59. src_prepare() {
  60. # Tests were restricted because of this
  61. sed -i \
  62. -e 's/.*bus_dispatch_test.*/printf ("Disabled due to excess noise\\n");/' \
  63. -e '/"dispatch"/d' \
  64. bus/test-main.c || die
  65. eapply "${FILESDIR}/${PN}-enable-elogind.patch"
  66. eapply_user
  67. # required for asneeded patch but also for bug 263909, cross-compile so
  68. # don't remove eautoreconf
  69. eautoreconf
  70. }
  71. multilib_src_configure() {
  72. local docconf myconf
  73. # so we can get backtraces from apps
  74. case ${CHOST} in
  75. *-mingw*)
  76. # error: unrecognized command line option '-rdynamic' wrt #488036
  77. ;;
  78. *)
  79. append-flags -rdynamic
  80. ;;
  81. esac
  82. # libaudit is *only* used in DBus wrt SELinux support, so disable it, if
  83. # not on an SELinux profile.
  84. myconf=(
  85. --localstatedir="${EPREFIX}/var"
  86. --docdir="${EPREFIX}/usr/share/doc/${PF}"
  87. --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
  88. $(use_enable static-libs static)
  89. $(use_enable debug verbose-mode)
  90. --disable-asserts
  91. --disable-checks
  92. $(use_enable selinux)
  93. $(use_enable selinux libaudit)
  94. --disable-apparmor
  95. $(use_enable kernel_linux inotify)
  96. $(use_enable kernel_FreeBSD kqueue)
  97. $(use_enable elogind)
  98. $(use_enable systemd)
  99. $(use_enable user-session)
  100. --disable-embedded-tests
  101. --disable-modular-tests
  102. $(use_enable debug stats)
  103. --with-session-socket-dir="${EPREFIX}"/tmp
  104. --with-system-pid-file="${EPREFIX}"/var/run/dbus.pid
  105. --with-system-socket="${EPREFIX}"/var/run/dbus/system_bus_socket
  106. --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
  107. --with-dbus-user=messagebus
  108. $(use_with X x)
  109. )
  110. if [[ ${CHOST} == *-darwin* ]]; then
  111. myconf+=(
  112. --enable-launchd
  113. --with-launchd-agent-dir="${EPREFIX}"/Library/LaunchAgents
  114. )
  115. fi
  116. if multilib_is_native_abi; then
  117. docconf=(
  118. --enable-xml-docs
  119. $(use_enable doc doxygen-docs)
  120. )
  121. else
  122. docconf=(
  123. --disable-xml-docs
  124. --disable-doxygen-docs
  125. )
  126. myconf+=(
  127. --disable-selinux
  128. --disable-libaudit
  129. --disable-elogind
  130. --disable-systemd
  131. --without-x
  132. # expat is used for the daemon only
  133. # fake the check for multilib library build
  134. ac_cv_lib_expat_XML_ParserCreate_MM=yes
  135. )
  136. fi
  137. einfo "Running configure in ${BUILD_DIR}"
  138. ECONF_SOURCE="${S}" econf "${myconf[@]}" "${docconf[@]}"
  139. if multilib_is_native_abi && use test; then
  140. mkdir "${TBD}" || die
  141. cd "${TBD}" || die
  142. einfo "Running configure in ${TBD}"
  143. ECONF_SOURCE="${S}" econf "${myconf[@]}" \
  144. $(use_enable test asserts) \
  145. $(use_enable test checks) \
  146. $(use_enable test embedded-tests) \
  147. $(has_version dev-libs/dbus-glib && echo --enable-modular-tests)
  148. fi
  149. }
  150. multilib_src_compile() {
  151. if multilib_is_native_abi; then
  152. # after the compile, it uses a selinuxfs interface to
  153. # check if the SELinux policy has the right support
  154. use selinux && addwrite /selinux/access
  155. einfo "Running make in ${BUILD_DIR}"
  156. emake
  157. if use test; then
  158. einfo "Running make in ${TBD}"
  159. emake -C "${TBD}"
  160. fi
  161. else
  162. emake -C dbus libdbus-1.la
  163. fi
  164. }
  165. src_test() {
  166. DBUS_VERBOSE=1 Xemake -j1 -C "${TBD}" check
  167. }
  168. multilib_src_install() {
  169. if multilib_is_native_abi; then
  170. emake DESTDIR="${D}" install
  171. else
  172. emake DESTDIR="${D}" install-pkgconfigDATA
  173. emake DESTDIR="${D}" -C dbus \
  174. install-libLTLIBRARIES install-dbusincludeHEADERS \
  175. install-nodist_dbusarchincludeHEADERS
  176. fi
  177. }
  178. multilib_src_install_all() {
  179. newinitd "${FILESDIR}"/dbus.initd-r1 dbus
  180. if use X; then
  181. # dbus X session script (#77504)
  182. # turns out to only work for GDM (and startx). has been merged into
  183. # other desktop (kdm and such scripts)
  184. exeinto /etc/X11/xinit/xinitrc.d
  185. doexe "${FILESDIR}"/80-dbus
  186. fi
  187. # needs to exist for dbus sessions to launch
  188. keepdir /usr/share/dbus-1/services
  189. keepdir /etc/dbus-1/{session,system}.d
  190. # machine-id symlink from pkg_postinst()
  191. keepdir /var/lib/dbus
  192. # let the init script create the /var/run/dbus directory
  193. rm -rf "${ED}"/var/run
  194. dodoc AUTHORS ChangeLog HACKING NEWS README doc/TODO
  195. readme.gentoo_create_doc
  196. prune_libtool_files --all
  197. }
  198. pkg_postinst() {
  199. readme.gentoo_print_elog
  200. # Ensure unique id is generated and put it in /etc wrt #370451 but symlink
  201. # for DBUS_MACHINE_UUID_FILE (see tools/dbus-launch.c) and reverse
  202. # dependencies with hardcoded paths (although the known ones got fixed already)
  203. dbus-uuidgen --ensure="${EROOT%/}"/etc/machine-id
  204. ln -sf "${EPREFIX}"/etc/machine-id "${EROOT%/}"/var/lib/dbus/machine-id
  205. if [[ ${CHOST} == *-darwin* ]]; then
  206. local plist="org.freedesktop.dbus-session.plist"
  207. elog
  208. elog
  209. elog "For MacOS/Darwin we now ship launchd support for dbus."
  210. elog "This enables autolaunch of dbus at session login and makes"
  211. elog "dbus usable under MacOS/Darwin."
  212. elog
  213. elog "The launchd plist file ${plist} has been"
  214. elog "installed in ${EPREFIX}/Library/LaunchAgents."
  215. elog "For it to be used, you will have to do all of the following:"
  216. elog " + cd ~/Library/LaunchAgents"
  217. elog " + ln -s ${EPREFIX}/Library/LaunchAgents/${plist}"
  218. elog " + logout and log back in"
  219. elog
  220. elog "If your application needs a proper DBUS_SESSION_BUS_ADDRESS"
  221. elog "specified and refused to start otherwise, then export the"
  222. elog "the following to your environment:"
  223. elog " DBUS_SESSION_BUS_ADDRESS=\"launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET\""
  224. fi
  225. if use user-session; then
  226. ewarn "You have enabled user-session. Please note this can cause"
  227. ewarn "bogus behaviors in several dbus consumers that are not prepared"
  228. ewarn "for this dbus activation method yet."
  229. ewarn
  230. ewarn "See the following link for background on this change:"
  231. ewarn "https://lists.freedesktop.org/archives/systemd-devel/2015-January/027711.html"
  232. ewarn
  233. ewarn "Known issues are tracked here:"
  234. ewarn "https://bugs.gentoo.org/show_bug.cgi?id=576028"
  235. fi
  236. }