| 1 |
# Copyright 1999-2008 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/hal-0.5.10.ebuild,v 1.5 2008/01/05 19:23:07 compnerd Exp $ |
| 4 |
|
| 5 |
inherit eutils linux-info autotools flag-o-matic |
| 6 |
|
| 7 |
PATCH_VER="0" |
| 8 |
|
| 9 |
DESCRIPTION="Hardware Abstraction Layer" |
| 10 |
HOMEPAGE="http://www.freedesktop.org/Software/hal" |
| 11 |
SRC_URI="http://hal.freedesktop.org/releases/${P}.tar.gz |
| 12 |
http://dev.gentoo.org/~compnerd/files/${PN}/${P}-gentoo-patches-${PATCH_VER}.tar.bz2" |
| 13 |
|
| 14 |
LICENSE="|| ( GPL-2 AFL-2.0 )" |
| 15 |
SLOT="0" |
| 16 |
KEYWORDS="~amd64 ~x86" |
| 17 |
|
| 18 |
KERNEL_IUSE="kernel_linux kernel_FreeBSD" |
| 19 |
IUSE="acpi apm crypt debug dell disk-partition doc laptop selinux ${KERNEL_IUSE}" |
| 20 |
|
| 21 |
RDEPEND=">=dev-libs/glib-2.6 |
| 22 |
>=dev-libs/dbus-glib-0.61 |
| 23 |
>=dev-libs/expat-1.95.8 |
| 24 |
>=sys-apps/pciutils-2.2.7-r1 |
| 25 |
>=dev-libs/libusb-0.1.10a |
| 26 |
>=dev-util/gperf-3.0.3 |
| 27 |
sys-apps/usbutils |
| 28 |
virtual/eject |
| 29 |
amd64? ( >=sys-apps/dmidecode-2.7 ) |
| 30 |
dell? ( >=sys-libs/libsmbios-0.13.4 ) |
| 31 |
disk-partition? ( |
| 32 |
|| ( |
| 33 |
~sys-apps/parted-1.7.1 |
| 34 |
~sys-apps/parted-1.8.6 |
| 35 |
~sys-apps/parted-1.8.7 |
| 36 |
) |
| 37 |
) |
| 38 |
ia64? ( >=sys-apps/dmidecode-2.7 ) |
| 39 |
kernel_linux? ( |
| 40 |
>=sys-fs/udev-111 |
| 41 |
>=sys-apps/util-linux-2.13 |
| 42 |
>=sys-kernel/linux-headers-2.6.19 |
| 43 |
crypt? ( |
| 44 |
|| ( |
| 45 |
>=sys-fs/cryptsetup-1.0.5 |
| 46 |
>=sys-fs/cryptsetup-luks-1.0.1 |
| 47 |
) |
| 48 |
) |
| 49 |
) |
| 50 |
kernel_FreeBSD? ( dev-libs/libvolume_id ) |
| 51 |
x86? ( >=sys-apps/dmidecode-2.7 ) |
| 52 |
selinux? ( sys-libs/libselinux sec-policy/selinux-hal )" |
| 53 |
DEPEND="${RDEPEND} |
| 54 |
dev-util/pkgconfig |
| 55 |
>=dev-util/intltool-0.35 |
| 56 |
doc? ( |
| 57 |
app-doc/doxygen |
| 58 |
app-text/docbook-sgml-utils |
| 59 |
app-text/xmlto |
| 60 |
dev-libs/libxml2 |
| 61 |
)" |
| 62 |
PDEPEND=">=app-misc/hal-info-20071011 |
| 63 |
laptop? ( >=sys-power/pm-utils-0.99.3 )" |
| 64 |
|
| 65 |
## HAL Daemon drops privledges so we need group access to read disks |
| 66 |
HALDAEMON_GROUPS_LINUX="haldaemon,plugdev,disk,cdrom,cdrw,floppy,usb" |
| 67 |
HALDAEMON_GROUPS_FREEBSD="haldaemon,plugdev,operator" |
| 68 |
|
| 69 |
function notify_uevent() { |
| 70 |
ewarn |
| 71 |
ewarn "You must enable Kernel Userspace Events in your kernel." |
| 72 |
ewarn "For this you need to enable 'Hotplug' under 'General Setup' and" |
| 73 |
ewarn "basic networking. They are marked CONFIG_HOTPLUG and CONFIG_NET" |
| 74 |
ewarn "in the config file." |
| 75 |
ewarn |
| 76 |
ebeep 5 |
| 77 |
} |
| 78 |
|
| 79 |
function notify_inotify() { |
| 80 |
ewarn |
| 81 |
ewarn "You must enable the Inotify system in your kernel." |
| 82 |
ewarn "For this you need to enable 'Inotify support for userspace'" |
| 83 |
ewarn "in 'File systems'. It is marked CONFIG_INOTIFY_USER in the config file." |
| 84 |
ewarn |
| 85 |
ebeep 5 |
| 86 |
} |
| 87 |
|
| 88 |
function notify_acpi_procfs() { |
| 89 |
ewarn |
| 90 |
ewarn "You must enable support for the ACPI proc files in your kernel." |
| 91 |
ewarn "For this you need to enable '/proc/acpi files' in" |
| 92 |
ewarn "'ACPI Support (Advanced Configuration and Power Interface) Support'." |
| 93 |
ewarn "It is marked ewarn CONFIG_ACPI_PROCFS in the config file." |
| 94 |
ewarn |
| 95 |
ebeep 5 |
| 96 |
} |
| 97 |
|
| 98 |
function notify_acpi_proc_event() { |
| 99 |
ewarn |
| 100 |
ewarn "You have not enabled support for the /proc/acpi/event interface." |
| 101 |
ewarn "For this you need to enable '/proc/acpi/event support' in" |
| 102 |
ewarn "ACPI Support (Advanced Configuration and Power Interface) Support" |
| 103 |
ewarn |
| 104 |
ebeep 5 |
| 105 |
} |
| 106 |
|
| 107 |
pkg_setup() { |
| 108 |
if use kernel_linux; then |
| 109 |
kernel_is ge 2 6 19 || ewarn "HAL requires a kernel version 2.6.19 or newer" |
| 110 |
|
| 111 |
if ! ( linux_chkconfig_present HOTPLUG && linux_chkconfig_present NET ) |
| 112 |
then |
| 113 |
notify_uevent |
| 114 |
fi |
| 115 |
|
| 116 |
linux_chkconfig_present INOTIFY_USER || notify_inotify |
| 117 |
|
| 118 |
if kernel_is lt 2 6 23 && use acpi ; then |
| 119 |
linux_chkconfig_present ACPI_PROCFS || notify_acpi_procfs |
| 120 |
linux_chkconfig_present ACPI_PROC_EVENT || notify_acpi_proc_event |
| 121 |
fi |
| 122 |
fi |
| 123 |
|
| 124 |
# http://devmanual.gentoo.org/ebuild-writing/functions/ |
| 125 |
# http://bugs.gentoo.org/show_bug.cgi?id=191605 |
| 126 |
|
| 127 |
# Create groups for hotplugging and HAL |
| 128 |
enewgroup haldaemon || die "Problem adding haldaemon group" |
| 129 |
enewgroup plugdev || die "Problem adding plugdev group" |
| 130 |
|
| 131 |
# HAL drops priviledges by default now ... |
| 132 |
# ... so we must make sure it can read disk/cdrom info (ie. be in ${HALDAEMON_GROUPS} groups) |
| 133 |
if use kernel_linux; then |
| 134 |
enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_LINUX} \ |
| 135 |
|| die "Problem adding haldaemon user" |
| 136 |
elif use kernel_FreeBSD; then |
| 137 |
enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_FREEBSD} \ |
| 138 |
|| die "Problem addding haldaemon user" |
| 139 |
fi |
| 140 |
|
| 141 |
# Make sure that the haldaemon user is in the ${HALDAEMON_GROUPS} |
| 142 |
# If users have a problem with this, let them file a bug |
| 143 |
if [[ ${ROOT} == / ]] ; then |
| 144 |
if use kernel_linux; then |
| 145 |
usermod -G ${HALDAEMON_GROUPS_LINUX} haldaemon |
| 146 |
elif use kernel_FreeBSD; then |
| 147 |
pw usermod haldaemon -G ${HALDAEMON_GROUPS_FREEBSD} |
| 148 |
fi |
| 149 |
fi |
| 150 |
} |
| 151 |
|
| 152 |
src_unpack() { |
| 153 |
unpack ${A} |
| 154 |
cd "${S}" |
| 155 |
|
| 156 |
EPATCH_MULTI_MSG="Applying Gentoo Patchset ..." \ |
| 157 |
EPATCH_SUFFIX="patch" \ |
| 158 |
EPATCH_SOURCE="${WORKDIR}/hal-0.5.10-patches/" \ |
| 159 |
EPATCH_FORCE="yes" \ |
| 160 |
epatch |
| 161 |
|
| 162 |
# Hide recovery partitions |
| 163 |
epatch "${FILESDIR}/hal-0.5.9-hide-recovery-partitions.patch" |
| 164 |
|
| 165 |
# Enable plugdev support |
| 166 |
epatch "${FILESDIR}/96_plugdev_allow_send.patch" |
| 167 |
|
| 168 |
eautoreconf |
| 169 |
} |
| 170 |
|
| 171 |
src_compile() { |
| 172 |
local acpi="$(use_enable acpi)" |
| 173 |
local backend= |
| 174 |
local hardware= |
| 175 |
|
| 176 |
append-flags -rdynamic |
| 177 |
|
| 178 |
if use kernel_linux ; then |
| 179 |
backend="linux" |
| 180 |
elif use kernel_FreeBSD ; then |
| 181 |
backend="freebsd" |
| 182 |
else |
| 183 |
eerror "Invalid backend" |
| 184 |
fi |
| 185 |
|
| 186 |
if use kernel_linux ; then |
| 187 |
if use acpi ; then |
| 188 |
# Using IBM ACPI and Toshiba ACPI results in double notification as this |
| 189 |
# was merged into the Linux Kernel 2.6.22 |
| 190 |
if kernel_is lt 2 6 22 ; then |
| 191 |
acpi="$acpi --enable-acpi-ibm --enable-acpi-toshiba" |
| 192 |
else |
| 193 |
acpi="$acpi --disable-acpi-ibm --disable-acpi-toshiba" |
| 194 |
fi |
| 195 |
|
| 196 |
acpi="$acpi --enable-acpi-proc --enable-acpi-acpid" |
| 197 |
else |
| 198 |
acpi="$acpi --disable-acpi-ibm --disable-acpi-toshiba" |
| 199 |
acpi="$acpi --disable-acpi-proc --disable-acpi-acpid" |
| 200 |
fi |
| 201 |
|
| 202 |
hardware="--with-cpufreq --with-usb-csr --with-keymaps" |
| 203 |
use arm && hardware="$hardware --enable-omap" |
| 204 |
|
| 205 |
if use dell ; then |
| 206 |
hardware="$hardware --with-dell-backlight" |
| 207 |
else |
| 208 |
hardware="$hardware --without-dell-backlight" |
| 209 |
fi |
| 210 |
else |
| 211 |
hardware="--without-cpufreq --without-usb-csr --without-keymaps" |
| 212 |
hardware="$hardware --disable-omap" |
| 213 |
hardware="$hardware --without-dell-backlight" |
| 214 |
hardware="$hardware --enable-acpi-ibm --enable-acpi-toshiba" |
| 215 |
fi |
| 216 |
|
| 217 |
econf --with-backend=${backend} \ |
| 218 |
--with-os-type=gentoo \ |
| 219 |
--with-pid-file=/var/run/hald.pid \ |
| 220 |
--with-hwdata=/usr/share/misc \ |
| 221 |
--with-socket-dir=/var/run/hald \ |
| 222 |
--enable-umount-helper \ |
| 223 |
--enable-man-pages \ |
| 224 |
--disable-policy-kit \ |
| 225 |
--disable-console-kit \ |
| 226 |
--disable-acl-management \ |
| 227 |
--enable-pci \ |
| 228 |
--enable-sonypic \ |
| 229 |
$(use_enable apm) \ |
| 230 |
$(use_enable arm pmu) \ |
| 231 |
$(use_enable arm omap) \ |
| 232 |
$(use_enable debug verbose-mode) \ |
| 233 |
$(use_enable disk-partition parted) \ |
| 234 |
$(use_enable doc docbook-docs) \ |
| 235 |
$(use_enable doc doxygen-docs) \ |
| 236 |
--docdir=/usr/share/doc/${PF} \ |
| 237 |
--localstatedir=/var \ |
| 238 |
${acpi} ${hardware} \ |
| 239 |
|| die "configure failed" |
| 240 |
|
| 241 |
emake || die "make failed" |
| 242 |
} |
| 243 |
|
| 244 |
src_install() { |
| 245 |
make DESTDIR="${D}" install || die |
| 246 |
dodoc AUTHORS ChangeLog NEWS README |
| 247 |
|
| 248 |
# hal umount for unclean unmounts |
| 249 |
exeinto /lib/udev/ |
| 250 |
newexe "${FILESDIR}"/hal-unmount.dev hal_unmount |
| 251 |
|
| 252 |
# initscript |
| 253 |
newinitd "${FILESDIR}"/0.5.10-hald.rc hald |
| 254 |
|
| 255 |
# configuration |
| 256 |
cp "${FILESDIR}"/0.5.10-hald.conf "${WORKDIR}"/ |
| 257 |
|
| 258 |
if use debug; then |
| 259 |
sed -e 's:HALD_VERBOSE="no":HALD_VERBOSE="yes":' \ |
| 260 |
-i "${WORKDIR}"/0.5.10-hald.conf |
| 261 |
fi |
| 262 |
newconfd "${WORKDIR}"/0.5.10-hald.conf hald |
| 263 |
|
| 264 |
# We now create and keep /media here as both gnome-mount and pmount |
| 265 |
# use these directories, to avoid collision. |
| 266 |
keepdir /media |
| 267 |
|
| 268 |
# We also need to create and keep /etc/fdi/{information,policy,preprobe} |
| 269 |
# or else hal bombs. |
| 270 |
keepdir /etc/hal/fdi/{information,policy,preprobe} |
| 271 |
|
| 272 |
# HAL stores it's fdi cache in /var/lib/cache/hald |
| 273 |
keepdir /var/lib/cache/hald |
| 274 |
|
| 275 |
# HAL keeps its unix socket here |
| 276 |
keepdir /var/run/hald |
| 277 |
keepdir /var/lib/hal |
| 278 |
} |
| 279 |
|
| 280 |
pkg_postinst() { |
| 281 |
# Despite what people keep changing this location. Either one works.. it doesn't matter |
| 282 |
# http://dev.gentoo.org/~plasmaroo/devmanual/ebuild-writing/functions/ |
| 283 |
|
| 284 |
elog "The HAL daemon needs to be running for certain applications to" |
| 285 |
elog "work. Suggested is to add the init script to your start-up" |
| 286 |
elog "scripts, this should be done like this :" |
| 287 |
elog "\`rc-update add hald default\`" |
| 288 |
echo |
| 289 |
elog "Looking for automounting support? Add yourself to the plugdev group" |
| 290 |
|
| 291 |
elog "IF you have additional applications which consume ACPI events, you" |
| 292 |
elog "should consider installing acpid to allow applications to share ACPI" |
| 293 |
elog "events." |
| 294 |
} |