dbus-1.10.12.ebuild 7.2 KB

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