/[gentoo-x86]/sys-apps/hal/hal-0.5.10.ebuild
Gentoo

Contents of /sys-apps/hal/hal-0.5.10.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Fri Feb 8 20:11:00 2008 UTC (6 years, 5 months ago) by wolf31o2
Branch: MAIN
Changes since 1.8: +27 -45 lines
Refactoring Linux kernel checks so hal doesn't bomb out on an unconfigured kernel.  Closing bug #209025.
(Portage version: 2.1.4)

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.8 2008/01/10 18:05:15 jer 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 ~hppa ~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 check_hotplug_net() {
70 local CONFIG_CHECK="~HOTPLUG ~NET"
71 local WARNING_HOTPLUG="CONFIG_HOTPLUG:\tis not set (required for HAL)"
72 local WARNING_NET="CONFIG_NET:\tis not set (required for HAL)"
73 check_extra_config
74 echo
75 }
76
77 function check_inotify() {
78 local CONFIG_CHECK="~INOTIFY_USER"
79 local WARNING_INOTIFY_USER="CONFIG_INOTIFY_USER:\tis not set (required for HAL)"
80 check_extra_config
81 echo
82 }
83
84 function check_acpi_proc() {
85 local CONFIG_CHECK="~ACPI_PROCFS ~ACPI_PROC_EVENT"
86 local WARNING_ACPI_PROCFS="CONFIG_ACPI_PROCFS:\tis not set (required for HAL)"
87 local WARNING_ACPI_PROC_EVENT="CONFIG_ACPI_PROC_EVENT:\tis not set (required for HAL)"
88 check_extra_config
89 echo
90 }
91
92 pkg_setup() {
93 if use kernel_linux ; then
94 if [ -e ${ROOT}/usr/src/linux/.config ] ; then
95 kernel_is ge 2 6 19 || \
96 ewarn "HAL requires a kernel version 2.6.19 or newer"
97 if kernel_is lt 2 6 23 && use acpi ; then
98 check_acpi_proc
99 fi
100 fi
101
102 check_hotplug_net
103 check_inotify
104 fi
105
106 # http://devmanual.gentoo.org/ebuild-writing/functions/
107 # http://bugs.gentoo.org/show_bug.cgi?id=191605
108
109 # Create groups for hotplugging and HAL
110 enewgroup haldaemon || die "Problem adding haldaemon group"
111 enewgroup plugdev || die "Problem adding plugdev group"
112
113 # HAL drops priviledges by default now ...
114 # ... so we must make sure it can read disk/cdrom info (ie. be in ${HALDAEMON_GROUPS} groups)
115 if use kernel_linux; then
116 enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_LINUX} \
117 || die "Problem adding haldaemon user"
118 elif use kernel_FreeBSD; then
119 enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_FREEBSD} \
120 || die "Problem addding haldaemon user"
121 fi
122
123 # Make sure that the haldaemon user is in the ${HALDAEMON_GROUPS}
124 # If users have a problem with this, let them file a bug
125 if [[ ${ROOT} == / ]] ; then
126 if use kernel_linux; then
127 usermod -G ${HALDAEMON_GROUPS_LINUX} haldaemon
128 elif use kernel_FreeBSD; then
129 pw usermod haldaemon -G ${HALDAEMON_GROUPS_FREEBSD}
130 fi
131 fi
132 }
133
134 src_unpack() {
135 unpack ${A}
136 cd "${S}"
137
138 EPATCH_MULTI_MSG="Applying Gentoo Patchset ..." \
139 EPATCH_SUFFIX="patch" \
140 EPATCH_SOURCE="${WORKDIR}/hal-0.5.10-patches/" \
141 EPATCH_FORCE="yes" \
142 epatch
143
144 # Hide recovery partitions
145 epatch "${FILESDIR}/hal-0.5.9-hide-recovery-partitions.patch"
146
147 # Enable plugdev support
148 epatch "${FILESDIR}/96_plugdev_allow_send.patch"
149
150 eautoreconf
151 }
152
153 src_compile() {
154 local acpi="$(use_enable acpi)"
155 local backend=
156 local hardware=
157
158 append-flags -rdynamic
159
160 if use kernel_linux ; then
161 backend="linux"
162 elif use kernel_FreeBSD ; then
163 backend="freebsd"
164 else
165 eerror "Invalid backend"
166 fi
167
168 if use kernel_linux ; then
169 if use acpi ; then
170 # Using IBM ACPI and Toshiba ACPI results in double notification as this
171 # was merged into the Linux Kernel 2.6.22
172 if kernel_is lt 2 6 22 ; then
173 acpi="$acpi --enable-acpi-ibm --enable-acpi-toshiba"
174 else
175 acpi="$acpi --disable-acpi-ibm --disable-acpi-toshiba"
176 fi
177
178 acpi="$acpi --enable-acpi-proc --enable-acpi-acpid"
179 else
180 acpi="$acpi --disable-acpi-ibm --disable-acpi-toshiba"
181 acpi="$acpi --disable-acpi-proc --disable-acpi-acpid"
182 fi
183
184 hardware="--with-cpufreq --with-usb-csr --with-keymaps"
185 use arm && hardware="$hardware --enable-omap"
186
187 if use dell ; then
188 hardware="$hardware --with-dell-backlight"
189 else
190 hardware="$hardware --without-dell-backlight"
191 fi
192 else
193 hardware="--without-cpufreq --without-usb-csr --without-keymaps"
194 hardware="$hardware --disable-omap"
195 hardware="$hardware --without-dell-backlight"
196 hardware="$hardware --enable-acpi-ibm --enable-acpi-toshiba"
197 fi
198
199 econf --with-backend=${backend} \
200 --with-os-type=gentoo \
201 --with-pid-file=/var/run/hald.pid \
202 --with-hwdata=/usr/share/misc \
203 --with-socket-dir=/var/run/hald \
204 --enable-umount-helper \
205 --enable-man-pages \
206 --disable-policy-kit \
207 --disable-console-kit \
208 --disable-acl-management \
209 --enable-pci \
210 --enable-sonypic \
211 $(use_enable apm) \
212 $(use_enable arm pmu) \
213 $(use_enable arm omap) \
214 $(use_enable debug verbose-mode) \
215 $(use_enable disk-partition parted) \
216 $(use_enable doc docbook-docs) \
217 $(use_enable doc doxygen-docs) \
218 --docdir=/usr/share/doc/${PF} \
219 --localstatedir=/var \
220 ${acpi} ${hardware} \
221 || die "configure failed"
222
223 emake || die "make failed"
224 }
225
226 src_install() {
227 make DESTDIR="${D}" install || die
228 dodoc AUTHORS ChangeLog NEWS README
229
230 # hal umount for unclean unmounts
231 exeinto /lib/udev/
232 newexe "${FILESDIR}"/hal-unmount.dev hal_unmount
233
234 # initscript
235 newinitd "${FILESDIR}"/0.5.10-hald.rc hald
236
237 # configuration
238 cp "${FILESDIR}"/0.5.10-hald.conf "${WORKDIR}"/
239
240 if use debug; then
241 sed -e 's:HALD_VERBOSE="no":HALD_VERBOSE="yes":' \
242 -i "${WORKDIR}"/0.5.10-hald.conf
243 fi
244 newconfd "${WORKDIR}"/0.5.10-hald.conf hald
245
246 # We now create and keep /media here as both gnome-mount and pmount
247 # use these directories, to avoid collision.
248 keepdir /media
249
250 # We also need to create and keep /etc/fdi/{information,policy,preprobe}
251 # or else hal bombs.
252 keepdir /etc/hal/fdi/{information,policy,preprobe}
253
254 # HAL stores it's fdi cache in /var/lib/cache/hald
255 keepdir /var/lib/cache/hald
256
257 # HAL keeps its unix socket here
258 keepdir /var/run/hald
259 keepdir /var/lib/hal
260 }
261
262 pkg_postinst() {
263 # Despite what people keep changing this location. Either one works.. it doesn't matter
264 # http://dev.gentoo.org/~plasmaroo/devmanual/ebuild-writing/functions/
265
266 elog "The HAL daemon needs to be running for certain applications to"
267 elog "work. Suggested is to add the init script to your start-up"
268 elog "scripts, this should be done like this :"
269 elog "\`rc-update add hald default\`"
270 echo
271 elog "Looking for automounting support? Add yourself to the plugdev group"
272
273 elog "IF you have additional applications which consume ACPI events, you"
274 elog "should consider installing acpid to allow applications to share ACPI"
275 elog "events."
276
277 elog "If you wish to use a non US layout, you may do so by executing:"
278 elog "setxkbmap <layout> or by utilizing your Desktop Environment's"
279 elog "Keyboard Layout Settings mechanism."
280 elog "Under GNOME, this is gnome-keyboard-properties, and under KDE"
281 elog "it is kxkb."
282 }

  ViewVC Help
Powered by ViewVC 1.1.20