| 1 |
gustavoz |
1.1 |
# Copyright 1999-2007 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
strerror |
1.7 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/hal-0.5.9.1-r1.ebuild,v 1.6 2007/08/07 13:39:50 gustavoz Exp $
|
| 4 |
gustavoz |
1.1 |
|
| 5 |
|
|
inherit eutils linux-info autotools flag-o-matic
|
| 6 |
|
|
|
| 7 |
|
|
DESCRIPTION="Hardware Abstraction Layer"
|
| 8 |
|
|
HOMEPAGE="http://www.freedesktop.org/Software/hal"
|
| 9 |
|
|
SRC_URI="http://people.freedesktop.org/~david/dist/${P}.tar.gz"
|
| 10 |
|
|
|
| 11 |
|
|
LICENSE="|| ( GPL-2 AFL-2.0 )"
|
| 12 |
|
|
SLOT="0"
|
| 13 |
gustavoz |
1.6 |
KEYWORDS="alpha ~amd64 ~arm ~hppa ~ia64 -mips ~ppc -ppc64 ~sh sparc ~x86 ~x86-fbsd"
|
| 14 |
gustavoz |
1.1 |
|
| 15 |
|
|
KERNEL_IUSE="kernel_linux kernel_FreeBSD"
|
| 16 |
|
|
IUSE="acpi crypt debug dell disk-partition doc pcmcia selinux ${KERNEL_IUSE}"
|
| 17 |
|
|
|
| 18 |
|
|
RDEPEND=">=dev-libs/glib-2.6
|
| 19 |
|
|
>=dev-libs/dbus-glib-0.61
|
| 20 |
|
|
kernel_linux? ( >=sys-fs/udev-104 )
|
| 21 |
|
|
kernel_linux? ( >=sys-apps/util-linux-2.12r-r1 )
|
| 22 |
|
|
kernel_linux? ( >=sys-kernel/linux-headers-2.6.17 )
|
| 23 |
|
|
kernel_FreeBSD? ( dev-libs/libvolume_id )
|
| 24 |
|
|
>=dev-libs/expat-1.95.8
|
| 25 |
|
|
>=sys-apps/pciutils-2.2.3
|
| 26 |
|
|
>=dev-libs/libusb-0.1.10a
|
| 27 |
|
|
sys-apps/usbutils
|
| 28 |
|
|
virtual/eject
|
| 29 |
|
|
amd64? ( >=sys-apps/dmidecode-2.7 )
|
| 30 |
|
|
x86? ( >=sys-apps/dmidecode-2.7 )
|
| 31 |
|
|
ia64? ( >=sys-apps/dmidecode-2.7 )
|
| 32 |
|
|
dell? ( >=sys-libs/libsmbios-0.13.4 )
|
| 33 |
cardoe |
1.3 |
disk-partition? ( >=sys-apps/parted-1.7.1
|
| 34 |
|
|
<=sys-apps/parted-1.8.7 )
|
| 35 |
strerror |
1.7 |
kernel_linux? ( crypt? ( || ( >=sys-fs/cryptsetup-1.0.5
|
| 36 |
|
|
>=sys-fs/cryptsetup-luks-1.0.1 ) ) )
|
| 37 |
gustavoz |
1.1 |
selinux? ( sys-libs/libselinux
|
| 38 |
|
|
sec-policy/selinux-hal )"
|
| 39 |
|
|
# pam? ( sys-auth/consolekit )"
|
| 40 |
|
|
|
| 41 |
|
|
DEPEND="${RDEPEND}
|
| 42 |
|
|
dev-util/pkgconfig
|
| 43 |
|
|
>=dev-util/intltool-0.35
|
| 44 |
|
|
doc? ( app-doc/doxygen
|
| 45 |
|
|
app-text/docbook-sgml-utils
|
| 46 |
|
|
app-text/xmlto )"
|
| 47 |
|
|
|
| 48 |
|
|
PDEPEND="app-misc/hal-info"
|
| 49 |
|
|
|
| 50 |
|
|
## HAL Daemon drops privledges so we need group access to read disks
|
| 51 |
|
|
HALDAEMON_GROUPS_LINUX="haldaemon,plugdev,disk,cdrom,cdrw,floppy,usb"
|
| 52 |
|
|
HALDAEMON_GROUPS_FREEBSD="haldaemon,plugdev,operator"
|
| 53 |
|
|
|
| 54 |
|
|
function notify_uevent() {
|
| 55 |
|
|
ewarn
|
| 56 |
|
|
ewarn "You must enable Kernel Userspace Events in your kernel."
|
| 57 |
|
|
ewarn "For this you need to enable 'Hotplug' under 'General Setup' and"
|
| 58 |
|
|
ewarn "basic networking. They are marked CONFIG_HOTPLUG and CONFIG_NET"
|
| 59 |
|
|
ewarn "in the config file."
|
| 60 |
|
|
ewarn
|
| 61 |
|
|
ebeep 5
|
| 62 |
|
|
}
|
| 63 |
|
|
|
| 64 |
|
|
function notify_procfs() {
|
| 65 |
|
|
ewarn
|
| 66 |
|
|
ewarn "You must enable the proc filesystem in your kernel."
|
| 67 |
|
|
ewarn "For this you need to enable '/proc file system support' under"
|
| 68 |
|
|
ewarn "'Pseudo filesystems' in 'File systems'. It is marked"
|
| 69 |
|
|
ewarn "CONFIG_PROC_FS in the config file."
|
| 70 |
|
|
ewarn
|
| 71 |
|
|
ebeep 5
|
| 72 |
|
|
}
|
| 73 |
|
|
|
| 74 |
|
|
function notify_inotify() {
|
| 75 |
|
|
ewarn
|
| 76 |
|
|
ewarn "You must enable the Inotify system in your kernel."
|
| 77 |
|
|
ewarn "For this you need to enable 'Inotify support for userspace'"
|
| 78 |
|
|
ewarn "in 'File systems'. It is marked CONFIG_INOTIFY_USER in the config file."
|
| 79 |
|
|
ewarn
|
| 80 |
|
|
ebeep 5
|
| 81 |
|
|
}
|
| 82 |
|
|
|
| 83 |
|
|
pkg_setup() {
|
| 84 |
vapier |
1.4 |
if ! built_with_use --missing false sys-apps/pciutils hal ; then
|
| 85 |
|
|
if built_with_use --missing false sys-apps/pciutils zlib ; then
|
| 86 |
|
|
eerror "You MUST build sys-apps/pciutils without the zlib USE flag"
|
| 87 |
|
|
die "You MUST build sys-apps/pciutils without the zlib USE flag"
|
| 88 |
|
|
fi
|
| 89 |
gustavoz |
1.1 |
fi
|
| 90 |
|
|
|
| 91 |
|
|
if use kernel_linux; then
|
| 92 |
|
|
kernel_is ge 2 6 17 || ewarn "HAL requires a kernel version 2.6.17 or newer"
|
| 93 |
|
|
|
| 94 |
|
|
if ! ( linux_chkconfig_present HOTPLUG && linux_chkconfig_present NET )
|
| 95 |
|
|
then
|
| 96 |
|
|
notify_uevent
|
| 97 |
|
|
fi
|
| 98 |
|
|
|
| 99 |
|
|
linux_chkconfig_present INOTIFY_USER || notify_inotify
|
| 100 |
|
|
|
| 101 |
|
|
if use acpi ; then
|
| 102 |
|
|
linux_chkconfig_present PROC_FS || notify_procfs
|
| 103 |
|
|
fi
|
| 104 |
|
|
fi
|
| 105 |
|
|
|
| 106 |
|
|
if [[ -d ${ROOT}/etc/hal/device.d ]]; then
|
| 107 |
|
|
eerror "HAL 0.5.x will not run with the HAL 0.4.x series of"
|
| 108 |
|
|
eerror "/etc/hal/device.d/ so please remove this directory"
|
| 109 |
|
|
eerror "with rm -rf /etc/hal/device.d/ and then re-emerge."
|
| 110 |
|
|
eerror "This is due to configuration protection of /etc/"
|
| 111 |
|
|
die "remove /etc/hal/device.d/"
|
| 112 |
|
|
fi
|
| 113 |
|
|
}
|
| 114 |
|
|
|
| 115 |
|
|
src_unpack() {
|
| 116 |
|
|
unpack ${A}
|
| 117 |
|
|
cd ${S}
|
| 118 |
|
|
|
| 119 |
|
|
# Gentoo patchset
|
| 120 |
|
|
epatch ${FILESDIR}/0.5.9/07_malloc_h_for_stdlib_h.patch
|
| 121 |
|
|
epatch ${FILESDIR}/0.5.9/23_runner_64bit_values.patch
|
| 122 |
cardoe |
1.3 |
epatch ${FILESDIR}/0.5.9/24_libparted_1_8_7.patch
|
| 123 |
gustavoz |
1.1 |
#epatch ${FILESDIR}/0.5.9/95_gentoo_man_page.patch
|
| 124 |
|
|
epatch ${FILESDIR}/0.5.9/96_plugdev_allow_send.patch
|
| 125 |
|
|
epatch ${FILESDIR}/0.5.9/97_ignore_fixed_drives.patch
|
| 126 |
|
|
epatch ${FILESDIR}/0.5.9/98_hald_cache_test_path.patch
|
| 127 |
cardoe |
1.2 |
epatch ${FILESDIR}/0.5.9/99_sun_disklabel_ignore.patch
|
| 128 |
gustavoz |
1.1 |
|
| 129 |
|
|
eautoreconf
|
| 130 |
|
|
}
|
| 131 |
|
|
|
| 132 |
|
|
src_compile() {
|
| 133 |
|
|
local backend=""
|
| 134 |
|
|
local acpi=""
|
| 135 |
|
|
|
| 136 |
|
|
# TODO :: policykit should have a pam useflag
|
| 137 |
|
|
append-flags -rdynamic
|
| 138 |
|
|
|
| 139 |
|
|
if use kernel_linux ; then
|
| 140 |
|
|
backend="linux"
|
| 141 |
|
|
use acpi && acpi="--enable-acpi-toshiba --enable-acpi-ibm"
|
| 142 |
|
|
elif use kernel_FreeBSD ; then
|
| 143 |
|
|
backend="freebsd"
|
| 144 |
|
|
else
|
| 145 |
|
|
eerror "Invalid backend"
|
| 146 |
|
|
fi
|
| 147 |
|
|
|
| 148 |
|
|
if ! use acpi ; then
|
| 149 |
|
|
acpi="--disable-acpi-proc --disable-acpi-acpid"
|
| 150 |
|
|
fi
|
| 151 |
|
|
|
| 152 |
|
|
econf --disable-policy-kit \
|
| 153 |
|
|
--docdir=/usr/share/doc/${PF} \
|
| 154 |
|
|
--with-os-type=gentoo \
|
| 155 |
|
|
--with-pid-file=/var/run/hald.pid \
|
| 156 |
|
|
--with-socket-dir=/var/run/hald \
|
| 157 |
|
|
--with-hwdata=/usr/share/misc \
|
| 158 |
|
|
--enable-hotplug-map \
|
| 159 |
|
|
--enable-man-pages \
|
| 160 |
|
|
--with-backend=${backend} \
|
| 161 |
|
|
$(use_enable debug verbose-mode) \
|
| 162 |
|
|
$(use_with dell dell-backlight) \
|
| 163 |
|
|
$(use_enable disk-partition parted) \
|
| 164 |
|
|
$(use_enable pcmcia pcmcia-support) \
|
| 165 |
|
|
$(use_enable doc docbook-docs) \
|
| 166 |
|
|
$(use_enable doc doxygen-docs) \
|
| 167 |
|
|
$(use_enable selinux) \
|
| 168 |
|
|
--disable-console-kit \
|
| 169 |
|
|
${acpi} \
|
| 170 |
|
|
|| die "configure failed"
|
| 171 |
|
|
#$(use_enable pam console-kit)
|
| 172 |
|
|
|
| 173 |
|
|
emake || die "make failed"
|
| 174 |
|
|
}
|
| 175 |
|
|
|
| 176 |
|
|
src_install() {
|
| 177 |
|
|
make DESTDIR="${D}" install || die
|
| 178 |
|
|
dodoc AUTHORS ChangeLog NEWS README
|
| 179 |
|
|
|
| 180 |
|
|
# remove dep on gnome-python
|
| 181 |
|
|
mv "${D}"/usr/bin/hal-device-manager "${D}"/usr/share/hal/device-manager/
|
| 182 |
|
|
|
| 183 |
|
|
# hal umount for unclean unmounts
|
| 184 |
|
|
exeinto /lib/udev/
|
| 185 |
|
|
newexe "${FILESDIR}"/hal-unmount.dev hal_unmount
|
| 186 |
|
|
|
| 187 |
|
|
# initscript
|
| 188 |
|
|
newinitd "${FILESDIR}"/0.5.9-hald.rc hald
|
| 189 |
|
|
cp "${FILESDIR}"/0.5.9-hald.conf "${WORKDIR}"/
|
| 190 |
|
|
# if use pam; then
|
| 191 |
|
|
# sed -e 's:RC_NEED="":RC_NEED="consolekit":' -i "${WORKDIR}"/0.5.9-hald.conf
|
| 192 |
|
|
# fi
|
| 193 |
|
|
if use debug; then
|
| 194 |
|
|
sed -e 's:HALD_VERBOSE="no":HALD_VERBOSE="yes":' \
|
| 195 |
|
|
-i "${WORKDIR}"/0.5.9-hald.conf
|
| 196 |
|
|
fi
|
| 197 |
|
|
newconfd "${WORKDIR}"/0.5.9-hald.conf hald
|
| 198 |
|
|
|
| 199 |
|
|
# We now create and keep /media here as both gnome-mount and pmount
|
| 200 |
|
|
# use these directories, to avoid collision.
|
| 201 |
|
|
keepdir /media
|
| 202 |
|
|
|
| 203 |
|
|
# We also need to create and keep /etc/fdi/{information,policy,preprobe}
|
| 204 |
|
|
# or else hal bombs.
|
| 205 |
|
|
keepdir /etc/hal/fdi/{information,policy,preprobe}
|
| 206 |
|
|
|
| 207 |
|
|
# HAL stores it's fdi cache in /var/lib/cache/hald
|
| 208 |
|
|
keepdir /var/lib/cache/hald
|
| 209 |
|
|
|
| 210 |
|
|
# HAL keeps its unix socket here
|
| 211 |
|
|
keepdir /var/run/hald
|
| 212 |
|
|
}
|
| 213 |
|
|
|
| 214 |
|
|
pkg_postinst() {
|
| 215 |
|
|
# Despite what people keep changing this location. Either one works.. it doesn't matter
|
| 216 |
|
|
# http://dev.gentoo.org/~plasmaroo/devmanual/ebuild-writing/functions/
|
| 217 |
|
|
|
| 218 |
|
|
# Create groups for hotplugging and HAL
|
| 219 |
|
|
enewgroup haldaemon || die "Problem adding haldaemon group"
|
| 220 |
|
|
enewgroup plugdev || die "Problem adding plugdev group"
|
| 221 |
|
|
|
| 222 |
|
|
# HAL drops priviledges by default now ...
|
| 223 |
|
|
# ... so we must make sure it can read disk/cdrom info (ie. be in ${HALDAEMON_GROUPS} groups)
|
| 224 |
|
|
if use kernel_linux; then
|
| 225 |
|
|
enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_LINUX} \
|
| 226 |
|
|
|| die "Problem adding haldaemon user"
|
| 227 |
|
|
elif use kernel_FreeBSD; then
|
| 228 |
|
|
enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_FREEBSD} \
|
| 229 |
|
|
|| die "Problem addding haldaemon user"
|
| 230 |
|
|
fi
|
| 231 |
|
|
|
| 232 |
|
|
# Make sure that the haldaemon user is in the ${HALDAEMON_GROUPS}
|
| 233 |
|
|
# If users have a problem with this, let them file a bug
|
| 234 |
|
|
if [[ ${ROOT} == / ]] ; then
|
| 235 |
|
|
if use kernel_linux; then
|
| 236 |
|
|
usermod -G ${HALDAEMON_GROUPS_LINUX} haldaemon
|
| 237 |
|
|
elif use kernel_FreeBSD; then
|
| 238 |
|
|
pw usermod haldaemon -G ${HALDAEMON_GROUPS_FREEBSD}
|
| 239 |
|
|
fi
|
| 240 |
|
|
fi
|
| 241 |
|
|
|
| 242 |
|
|
elog "The HAL daemon needs to be running for certain applications to"
|
| 243 |
|
|
elog "work. Suggested is to add the init script to your start-up"
|
| 244 |
|
|
elog "scripts, this should be done like this :"
|
| 245 |
|
|
elog "\`rc-update add hald default\`"
|
| 246 |
|
|
echo
|
| 247 |
|
|
elog "Looking for automounting support? Add yourself to the plugdev group"
|
| 248 |
|
|
}
|