| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/dbus/dbus-1.6.4.ebuild,v 1.2 2012/09/22 11:16:00 ssuominen Exp $ |
| 4 |
|
| 5 |
EAPI=4 |
| 6 |
inherit autotools eutils linux-info flag-o-matic python systemd virtualx user |
| 7 |
|
| 8 |
DESCRIPTION="A message bus system, a simple way for applications to talk to each other" |
| 9 |
HOMEPAGE="http://dbus.freedesktop.org/" |
| 10 |
SRC_URI="http://dbus.freedesktop.org/releases/dbus/${P}.tar.gz" |
| 11 |
|
| 12 |
LICENSE="|| ( AFL-2.1 GPL-2 )" |
| 13 |
SLOT="0" |
| 14 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" |
| 15 |
IUSE="debug doc selinux static-libs systemd test X" |
| 16 |
|
| 17 |
RDEPEND=">=dev-libs/expat-2 |
| 18 |
selinux? ( |
| 19 |
sec-policy/selinux-dbus |
| 20 |
sys-libs/libselinux |
| 21 |
) |
| 22 |
X? ( |
| 23 |
x11-libs/libX11 |
| 24 |
x11-libs/libXt |
| 25 |
)" |
| 26 |
DEPEND="${RDEPEND} |
| 27 |
virtual/pkgconfig |
| 28 |
doc? ( |
| 29 |
app-doc/doxygen |
| 30 |
app-text/docbook-xml-dtd:4.1.2 |
| 31 |
app-text/xmlto |
| 32 |
) |
| 33 |
test? ( |
| 34 |
>=dev-libs/glib-2.24 |
| 35 |
dev-lang/python:2.7 |
| 36 |
)" |
| 37 |
|
| 38 |
# out of sources build directory |
| 39 |
BD=${WORKDIR}/${P}-build |
| 40 |
# out of sources build dir for make check |
| 41 |
TBD=${WORKDIR}/${P}-tests-build |
| 42 |
|
| 43 |
pkg_setup() { |
| 44 |
enewgroup messagebus |
| 45 |
enewuser messagebus -1 -1 -1 messagebus |
| 46 |
|
| 47 |
if use test; then |
| 48 |
python_set_active_version 2 |
| 49 |
python_pkg_setup |
| 50 |
fi |
| 51 |
|
| 52 |
if use kernel_linux; then |
| 53 |
CONFIG_CHECK="~EPOLL" |
| 54 |
linux-info_pkg_setup |
| 55 |
fi |
| 56 |
} |
| 57 |
|
| 58 |
src_prepare() { |
| 59 |
epatch \ |
| 60 |
"${FILESDIR}"/${PN}-1.5.12-selinux-when-dropping-capabilities-only-include-AUDI.patch \ |
| 61 |
"${FILESDIR}"/${PN}-1.6.4-CVE-2012-3524-Don-t-access-environment-variables-or-.patch |
| 62 |
|
| 63 |
# Tests were restricted because of this |
| 64 |
sed -i \ |
| 65 |
-e 's/.*bus_dispatch_test.*/printf ("Disabled due to excess noise\\n");/' \ |
| 66 |
-e '/"dispatch"/d' \ |
| 67 |
bus/test-main.c || die |
| 68 |
|
| 69 |
# required for asneeded patch but also for bug 263909, cross-compile so |
| 70 |
# don't remove eautoreconf |
| 71 |
eautoreconf |
| 72 |
} |
| 73 |
|
| 74 |
src_configure() { |
| 75 |
# so we can get backtraces from apps |
| 76 |
append-flags -rdynamic |
| 77 |
|
| 78 |
local myconf=( --disable-systemd ) |
| 79 |
if use systemd && has_version sys-apps/systemd; then |
| 80 |
myconf=( --enable-systemd ) |
| 81 |
fi |
| 82 |
|
| 83 |
# libaudit is *only* used in DBus wrt SELinux support, so disable it, if |
| 84 |
# not on an SELinux profile. |
| 85 |
myconf+=( |
| 86 |
--localstatedir=/var |
| 87 |
--docdir=/usr/share/doc/${PF} |
| 88 |
--htmldir=/usr/share/doc/${PF}/html |
| 89 |
$(use_enable static-libs static) |
| 90 |
$(use_enable debug verbose-mode) |
| 91 |
--disable-asserts |
| 92 |
--disable-checks |
| 93 |
$(use_enable selinux) |
| 94 |
$(use_enable selinux libaudit) |
| 95 |
$(use_enable kernel_linux inotify) |
| 96 |
$(use_enable kernel_FreeBSD kqueue) |
| 97 |
--disable-embedded-tests |
| 98 |
--disable-modular-tests |
| 99 |
$(use_enable debug stats) |
| 100 |
--with-xml=expat |
| 101 |
--with-session-socket-dir=/tmp |
| 102 |
--with-system-pid-file=/var/run/dbus.pid |
| 103 |
--with-system-socket=/var/run/dbus/system_bus_socket |
| 104 |
--with-dbus-user=messagebus |
| 105 |
$(use_with X x) |
| 106 |
"$(systemd_with_unitdir)" |
| 107 |
) |
| 108 |
|
| 109 |
mkdir "${BD}" |
| 110 |
cd "${BD}" |
| 111 |
einfo "Running configure in ${BD}" |
| 112 |
ECONF_SOURCE="${S}" econf "${myconf[@]}" \ |
| 113 |
$(use_enable doc xml-docs) \ |
| 114 |
$(use_enable doc doxygen-docs) |
| 115 |
|
| 116 |
if use test; then |
| 117 |
mkdir "${TBD}" |
| 118 |
cd "${TBD}" |
| 119 |
einfo "Running configure in ${TBD}" |
| 120 |
ECONF_SOURCE="${S}" econf "${myconf[@]}" \ |
| 121 |
$(use_enable test asserts) \ |
| 122 |
$(use_enable test checks) \ |
| 123 |
$(use_enable test embedded-tests) \ |
| 124 |
$(has_version dev-libs/dbus-glib && echo --enable-modular-tests) |
| 125 |
fi |
| 126 |
} |
| 127 |
|
| 128 |
src_compile() { |
| 129 |
# after the compile, it uses a selinuxfs interface to |
| 130 |
# check if the SELinux policy has the right support |
| 131 |
use selinux && addwrite /selinux/access |
| 132 |
|
| 133 |
cd "${BD}" |
| 134 |
einfo "Running make in ${BD}" |
| 135 |
emake |
| 136 |
|
| 137 |
if use test; then |
| 138 |
cd "${TBD}" |
| 139 |
einfo "Running make in ${TBD}" |
| 140 |
emake |
| 141 |
fi |
| 142 |
} |
| 143 |
|
| 144 |
src_test() { |
| 145 |
cd "${TBD}" |
| 146 |
DBUS_VERBOSE=1 Xemake -j1 check |
| 147 |
} |
| 148 |
|
| 149 |
src_install() { |
| 150 |
newinitd "${FILESDIR}"/dbus.initd dbus |
| 151 |
|
| 152 |
if use X; then |
| 153 |
# dbus X session script (#77504) |
| 154 |
# turns out to only work for GDM (and startx). has been merged into |
| 155 |
# other desktop (kdm and such scripts) |
| 156 |
exeinto /etc/X11/xinit/xinitrc.d |
| 157 |
doexe "${FILESDIR}"/80-dbus |
| 158 |
fi |
| 159 |
|
| 160 |
# needs to exist for dbus sessions to launch |
| 161 |
keepdir /usr/share/dbus-1/services |
| 162 |
keepdir /etc/dbus-1/{session,system}.d |
| 163 |
# machine-id symlink from pkg_postinst() |
| 164 |
keepdir /var/lib/dbus |
| 165 |
|
| 166 |
dodoc AUTHORS ChangeLog HACKING NEWS README doc/TODO |
| 167 |
|
| 168 |
cd "${BD}" |
| 169 |
emake DESTDIR="${D}" install |
| 170 |
|
| 171 |
prune_libtool_files |
| 172 |
} |
| 173 |
|
| 174 |
pkg_postinst() { |
| 175 |
elog "To start the D-Bus system-wide messagebus by default" |
| 176 |
elog "you should add it to the default runlevel :" |
| 177 |
elog "\`rc-update add dbus default\`" |
| 178 |
elog |
| 179 |
elog "Some applications require a session bus in addition to the system" |
| 180 |
elog "bus. Please see \`man dbus-launch\` for more information." |
| 181 |
elog |
| 182 |
ewarn "You must restart D-Bus \`/etc/init.d/dbus restart\` to run" |
| 183 |
ewarn "the new version of the daemon." |
| 184 |
ewarn "Don't do this while X is running because it will restart your X as well." |
| 185 |
|
| 186 |
# Ensure unique id is generated and put it in /etc wrt #370451 but symlink |
| 187 |
# for DBUS_MACHINE_UUID_FILE (see tools/dbus-launch.c) and reverse |
| 188 |
# dependencies with hardcoded paths (although the known ones got fixed already) |
| 189 |
dbus-uuidgen --ensure="${EROOT}"/etc/machine-id |
| 190 |
ln -sf "${EROOT}"/etc/machine-id "${EROOT}"/var/lib/dbus/machine-id |
| 191 |
} |