1 |
# Copyright 1999-2007 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.9_rc3.ebuild,v 1.5 2007/04/02 17:06:31 cardoe Exp $ |
4 |
|
5 |
inherit eutils linux-info autotools flag-o-matic |
6 |
|
7 |
MY_PV=${PV/_/.} |
8 |
|
9 |
DESCRIPTION="Hardware Abstraction Layer" |
10 |
HOMEPAGE="http://www.freedesktop.org/Software/hal" |
11 |
SRC_URI="http://people.freedesktop.org/~david/dist/${PN}-${MY_PV}.tar.gz" |
12 |
|
13 |
LICENSE="|| ( GPL-2 AFL-2.0 )" |
14 |
SLOT="0" |
15 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 -mips ~ppc ~ppc64 ~sh ~sparc ~x86" |
16 |
IUSE="acpi crypt debug dell disk-partition doc mactel pcmcia selinux" |
17 |
|
18 |
RDEPEND=">=dev-libs/glib-2.6 |
19 |
>=dev-libs/dbus-glib-0.61 |
20 |
>=sys-fs/udev-104 |
21 |
>=sys-apps/util-linux-2.12r-r1 |
22 |
>=sys-kernel/linux-headers-2.6.17 |
23 |
>=dev-libs/expat-1.95.8 |
24 |
>=sys-apps/pciutils-2.2.3 |
25 |
>=dev-libs/libusb-0.1.10a |
26 |
virtual/eject |
27 |
amd64? ( >=sys-apps/dmidecode-2.7 ) |
28 |
x86? ( >=sys-apps/dmidecode-2.7 ) |
29 |
ia64? ( >=sys-apps/dmidecode-2.7 ) |
30 |
dell? ( >=sys-libs/libsmbios-0.13.4 ) |
31 |
disk-partition? ( >=sys-apps/parted-1.7.1 ) |
32 |
crypt? ( >=sys-fs/cryptsetup-luks-1.0.1 ) |
33 |
selinux? ( sys-libs/libselinux )" |
34 |
|
35 |
DEPEND="${RDEPEND} |
36 |
dev-util/pkgconfig |
37 |
>=dev-util/intltool-0.35 |
38 |
doc? ( app-doc/doxygen app-text/docbook-sgml-utils )" |
39 |
|
40 |
PDEPEND="app-misc/hal-info" |
41 |
|
42 |
S="${WORKDIR}"/${PN}-${PV%%_*} |
43 |
|
44 |
## HAL Daemon drops privledges so we need group access to read disks |
45 |
HALDAEMON_GROUPS="haldaemon,plugdev,disk,cdrom,cdrw,floppy,usb" |
46 |
|
47 |
function notify_uevent() { |
48 |
ewarn |
49 |
ewarn "You must enable Kernel Userspace Events in your kernel." |
50 |
ewarn "For this you need to enable 'Hotplug' under 'General Setup' and" |
51 |
ewarn "basic networking. They are marked CONFIG_HOTPLUG and CONFIG_NET" |
52 |
ewarn "in the config file." |
53 |
ewarn |
54 |
ebeep 5 |
55 |
} |
56 |
|
57 |
function notify_procfs() { |
58 |
ewarn |
59 |
ewarn "You must enable the proc filesystem in your kernel." |
60 |
ewarn "For this you need to enable '/proc file system support' under" |
61 |
ewarn "'Pseudo filesystems' in 'File systems'. It is marked" |
62 |
ewarn "CONFIG_PROC_FS in the config file." |
63 |
ewarn |
64 |
ebeep 5 |
65 |
} |
66 |
|
67 |
pkg_setup() { |
68 |
kernel_is ge 2 6 17 || ewarn "HAL requires a kernel version 2.6.17 or newer" |
69 |
|
70 |
if ! ( linux_chkconfig_present HOTPLUG && linux_chkconfig_present NET ) |
71 |
then |
72 |
notify_uevent |
73 |
fi |
74 |
|
75 |
if use acpi ; then |
76 |
linux_chkconfig_present PROC_FS || notify_procfs |
77 |
fi |
78 |
|
79 |
if [[ -d ${ROOT}/etc/hal/device.d ]]; then |
80 |
eerror "HAL 0.5.x will not run with the HAL 0.4.x series of" |
81 |
eerror "/etc/hal/device.d/ so please remove this directory" |
82 |
eerror "with rm -rf /etc/hal/device.d/ and then re-emerge." |
83 |
eerror "This is due to configuration protection of /etc/" |
84 |
die "remove /etc/hal/device.d/" |
85 |
fi |
86 |
} |
87 |
|
88 |
src_unpack() { |
89 |
unpack ${A} |
90 |
cd ${S} |
91 |
epatch ${FILESDIR}/${PN}-0.5.7-plugdev-allow-send.patch |
92 |
epatch ${FILESDIR}/${PN}-0.5.9-update_dtd.patch |
93 |
} |
94 |
|
95 |
src_compile() { |
96 |
# TODO :: policykit should have a pam useflag |
97 |
append-flags -rdynamic |
98 |
|
99 |
econf --disable-policy-kit \ |
100 |
--with-doc-dir=/usr/share/doc/${PF} \ |
101 |
--with-os-type=gentoo \ |
102 |
--with-pid-file=/var/run/hald.pid \ |
103 |
--with-hwdata=/usr/share/misc \ |
104 |
--enable-hotplug-map \ |
105 |
$(use_enable debug verbose-mode) \ |
106 |
$(use_enable disk-partition parted) \ |
107 |
$(use_enable pcmcia pcmcia-support) \ |
108 |
$(use_enable acpi acpi-proc) \ |
109 |
$(use_enable doc docbook-docs) \ |
110 |
$(use_enable doc doxygen-docs) \ |
111 |
$(use_with mactel macbookpro) \ |
112 |
$(use_enable selinux) \ |
113 |
|| die "configure failed" |
114 |
|
115 |
emake || die "make failed" |
116 |
} |
117 |
|
118 |
src_install() { |
119 |
make DESTDIR="${D}" install || die |
120 |
dodoc AUTHORS ChangeLog NEWS README |
121 |
|
122 |
# remove dep on gnome-python |
123 |
mv "${D}"/usr/bin/hal-device-manager "${D}"/usr/share/hal/device-manager/ |
124 |
|
125 |
# hal umount for unclean unmounts |
126 |
exeinto /lib/udev/ |
127 |
newexe "${FILESDIR}"/hal-unmount.dev hal_unmount |
128 |
|
129 |
# initscript |
130 |
newinitd "${FILESDIR}"/0.5-hald.rc hald |
131 |
|
132 |
# We now create and keep /media here as both gnome-mount and pmount |
133 |
# use these directories, to avoid collision. |
134 |
dodir /media |
135 |
keepdir /media |
136 |
# We also need to create and keep /etc/fdi/{information,policy,preprobe} |
137 |
# or else hal bombs. |
138 |
dodir /etc/hal/fdi/{information,policy,preprobe} |
139 |
keepdir /etc/hal/fdi/{information,policy,preprobe} |
140 |
} |
141 |
|
142 |
pkg_postinst() { |
143 |
# Despite what people keep changing this location. Either one works.. it doesn't matter |
144 |
# http://dev.gentoo.org/~plasmaroo/devmanual/ebuild-writing/functions/ |
145 |
|
146 |
# Create groups for hotplugging and HAL |
147 |
enewgroup haldaemon || die "Problem adding haldaemon group" |
148 |
enewgroup plugdev || die "Problem adding plugdev group" |
149 |
|
150 |
# HAL drops priviledges by default now ... |
151 |
# ... so we must make sure it can read disk/cdrom info (ie. be in ${HALDAEMON_GROUPS} groups) |
152 |
enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS} || die "Problem adding haldaemon user" |
153 |
|
154 |
# Make sure that the haldaemon user is in the ${HALDAEMON_GROUPS} |
155 |
# If users have a problem with this, let them file a bug |
156 |
usermod -G ${HALDAEMON_GROUPS} haldaemon |
157 |
|
158 |
elog "The HAL daemon needs to be running for certain applications to" |
159 |
elog "work. Suggested is to add the init script to your start-up" |
160 |
elog "scripts, this should be done like this :" |
161 |
elog "\`rc-update add hald default\`" |
162 |
echo |
163 |
elog "Looking for automounting support? Add yourself to the plugdev group" |
164 |
} |