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

Contents of /sys-apps/hal/hal-0.5.14-r3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Jan 25 14:40:40 2011 UTC (3 years, 8 months ago) by ssuominen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Stabilize for everybody now that amd64 and x86 has tested it wrt #352179.

(Portage version: 2.2.0_alpha19/cvs/Linux x86_64)

1 # Copyright 1999-2010 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.14-r3.ebuild,v 1.2 2010/12/05 21:14:21 dang Exp $
4
5 EAPI="2"
6
7 inherit eutils linux-info autotools flag-o-matic multilib
8
9 PATCH_VERSION="3"
10
11 MY_P=${P/_/}
12 S=${WORKDIR}/${MY_P}
13 PATCHNAME="${MY_P}-gentoo-patches-${PATCH_VERSION}"
14 DESCRIPTION="Hardware Abstraction Layer"
15 HOMEPAGE="http://www.freedesktop.org/wiki/Software/hal"
16 SRC_URI="http://hal.freedesktop.org/releases/${MY_P}.tar.bz2
17 http://dev.gentoo.org/~dang/files/${PATCHNAME}.tar.bz2"
18
19 LICENSE="|| ( GPL-2 AFL-2.0 )"
20 SLOT="0"
21 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
22
23 KERNEL_IUSE="kernel_linux kernel_FreeBSD"
24 IUSE="X acpi apm crypt consolekit debug dell disk-partition doc laptop policykit selinux ${KERNEL_IUSE}"
25
26 RDEPEND=">=dev-libs/dbus-glib-0.61
27 >=dev-libs/glib-2.14
28 >=dev-libs/expat-1.95.8
29 =virtual/libusb-0*
30 >=sys-apps/pciutils-2.2.7-r1
31 sys-apps/usbutils
32 virtual/eject
33 amd64? ( >=sys-apps/dmidecode-2.7 )
34 dell? ( >=sys-libs/libsmbios-0.13.4 )
35 disk-partition? ( >=sys-block/parted-1.8.0 )
36 ia64? ( >=sys-apps/dmidecode-2.7 )
37 kernel_linux? (
38 >=sys-fs/udev-125
39 >=sys-apps/util-linux-2.16
40 >=sys-kernel/linux-headers-2.6.22
41 crypt? ( >=sys-fs/cryptsetup-1.0.5 )
42 )
43 kernel_FreeBSD? ( >=dev-libs/libvolume_id-0.77 )
44 x86? ( >=sys-apps/dmidecode-2.7 )
45 selinux? ( sys-libs/libselinux sec-policy/selinux-hal )
46 consolekit? ( >=sys-auth/consolekit-0.4 )
47 policykit? (
48 sys-auth/consolekit[policykit]
49 sys-auth/policykit[pam]
50 )"
51 DEPEND="${RDEPEND}
52 dev-util/pkgconfig
53 >=dev-util/gperf-3.0.3
54 >=dev-util/intltool-0.35
55 doc? (
56 app-text/xmlto
57 dev-libs/libxml2
58 dev-util/gtk-doc
59 app-text/docbook-sgml-utils
60 app-text/docbook-xml-dtd:4.1.2
61 )"
62 PDEPEND=">=app-misc/hal-info-20081219
63 !gnome-extra/hal-device-manager
64 laptop? ( >=sys-power/pm-utils-0.99.3 )"
65
66 ## HAL Daemon drops privledges so we need group access to read disks
67 HALDAEMON_GROUPS_LINUX="haldaemon,plugdev,disk,cdrom,cdrw,floppy,usb"
68 HALDAEMON_GROUPS_FREEBSD="haldaemon,plugdev,operator"
69
70 function check_hotplug_net() {
71 local CONFIG_CHECK="~HOTPLUG ~NET"
72 local WARNING_HOTPLUG="CONFIG_HOTPLUG:\tis not set (required for HAL)\n"
73 local WARNING_NET="CONFIG_NET:\tis not set (required for HAL)\n"
74 check_extra_config
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)\n"
80 check_extra_config
81 }
82
83 function check_acpi_proc() {
84 local CONFIG_CHECK="~ACPI_PROCFS ~ACPI_PROC_EVENT"
85 local WARNING_ACPI_PROCFS="CONFIG_ACPI_PROCFS:\tis not set (required for HAL)\n"
86 local WARNING_ACPI_PROC_EVENT="CONFIG_ACPI_PROC_EVENT:\tis not set (required for HAL)\n"
87 check_extra_config
88 }
89
90 pkg_setup() {
91 if use kernel_linux ; then
92 if [[ -e "${ROOT}/usr/src/linux/.config" ]] ; then
93 kernel_is ge 2 6 19 || ewarn "HAL requires a kernel version 2.6.19 or newer"
94
95 if kernel_is lt 2 6 23 && use acpi ; then
96 check_acpi_proc
97 fi
98 fi
99
100 check_hotplug_net
101 check_inotify
102 fi
103
104 # http://devmanual.gentoo.org/ebuild-writing/functions/
105 # http://bugs.gentoo.org/show_bug.cgi?id=191605
106
107 # Create groups for hotplugging and HAL
108 enewgroup haldaemon
109 enewgroup plugdev
110
111 # HAL drops priviledges by default now ...
112 # ... so we must make sure it can read disk/cdrom info (ie. be in ${HALDAEMON_GROUPS} groups)
113 if use kernel_linux; then
114 enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_LINUX}
115 elif use kernel_FreeBSD; then
116 enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_FREEBSD}
117 fi
118
119 # Make sure that the haldaemon user is in the ${HALDAEMON_GROUPS}
120 # If users have a problem with this, let them file a bug
121 if [[ ${ROOT} == / ]] ; then
122 if use kernel_linux; then
123 usermod -G ${HALDAEMON_GROUPS_LINUX} haldaemon
124 elif use kernel_FreeBSD; then
125 pw usermod haldaemon -G ${HALDAEMON_GROUPS_FREEBSD}
126 fi
127 fi
128 }
129
130 src_prepare() {
131 # Patch for fbsd, Bug #309263. MOVE INTO PATCHSET FOR NEXT BUMP!
132 epatch "${FILESDIR}"/${P}-r2-fbsd.patch
133
134 # Only apply one of the policy patches. Bug #267042
135 if use policykit ; then
136 rm "${WORKDIR}/${PATCHNAME}/patches/0001-plugdev-dbus-policy.patch"
137 else
138 rm "${WORKDIR}/${PATCHNAME}/patches/0002-policykit-dbus-policy.patch"
139 fi
140
141 EPATCH_MULTI_MSG="Applying Gentoo Patchset ..." \
142 EPATCH_SUFFIX="patch" \
143 EPATCH_SOURCE="${WORKDIR}/${PATCHNAME}/patches/" \
144 EPATCH_FORCE="yes" \
145 epatch
146
147 eautoreconf
148 }
149
150 src_configure() {
151 local acpi="$(use_enable acpi)"
152 local backend=
153 local hardware=
154 local consolekit="$(use_enable consolekit console-kit)"
155
156 append-flags -rdynamic
157
158 if use kernel_linux ; then
159 backend="linux"
160 elif use kernel_FreeBSD ; then
161 backend="freebsd"
162 else
163 eerror "Invalid backend"
164 fi
165
166 if use kernel_linux ; then
167 if use acpi ; then
168 # Using IBM ACPI and Toshiba ACPI results in double notification as this
169 # was merged into the Linux Kernel 2.6.22
170 if kernel_is lt 2 6 22 ; then
171 acpi="$acpi --enable-acpi-ibm --enable-acpi-toshiba"
172 else
173 acpi="$acpi --disable-acpi-ibm --disable-acpi-toshiba"
174 fi
175
176 acpi="$acpi --enable-acpi-proc --enable-acpi-acpid"
177 else
178 acpi="$acpi --disable-acpi-ibm --disable-acpi-toshiba"
179 acpi="$acpi --disable-acpi-proc --disable-acpi-acpid"
180 fi
181
182 hardware="--with-cpufreq --with-usb-csr --with-keymaps"
183 use arm && hardware="$hardware --with-omap --enable-pmu"
184 use ppc && hardware="$hardware --enable-pmu"
185 if use x86 || use amd64; then
186 hardware="$hardware --with-macbook --with-macbookpro"
187 fi
188
189 if use dell ; then
190 hardware="$hardware --with-dell-backlight"
191 else
192 hardware="$hardware --without-dell-backlight"
193 fi
194
195 hardware="$hardware --enable-sonypic"
196 else
197 hardware="--without-cpufreq --without-usb-csr --without-keymaps"
198 hardware="$hardware --without-omap"
199 hardware="$hardware --without-dell-backlight"
200 hardware="$hardware --enable-acpi-ibm --enable-acpi-toshiba"
201 hardware="$hardware --disable-sonypic"
202 fi
203
204 # Policykit support depends on consolekit support. Therefore, force on
205 # consolekit, even if it's USE flag is off, if policykit support is on.
206 # This enables packages to USE-depend on hal[policykit?]
207 if use policykit ; then
208 consolekit="--enable-console-kit"
209 fi
210
211 econf --with-backend=${backend} \
212 --with-os-type=gentoo \
213 --with-pid-file=/var/run/hald.pid \
214 --with-hwdata=/usr/share/misc \
215 --with-socket-dir=/var/run/hald \
216 --with-udev-prefix=/etc \
217 --enable-umount-helper \
218 --enable-man-pages \
219 --disable-acl-management \
220 --enable-pci \
221 $(use_enable apm) \
222 $(use_enable debug verbose-mode) \
223 $(use_enable disk-partition parted) \
224 $(use_enable doc docbook-docs) \
225 $(use_enable doc gtk-doc) \
226 $(use_enable policykit policy-kit) \
227 ${consolekit} \
228 --docdir=/usr/share/doc/${PF} \
229 --localstatedir=/var \
230 ${acpi} ${hardware} \
231 || die "configure failed"
232 }
233
234 src_install() {
235 emake DESTDIR="${D}" install || die
236 dodoc AUTHORS ChangeLog NEWS README || die "docs failed"
237
238 # hal umount for unclean unmounts
239 exeinto /$(get_libdir)/udev/
240 newexe "${FILESDIR}/hal-unmount.dev" hal_unmount || die "udev helper failed"
241
242 # initscript
243 cp "${FILESDIR}/0.5.14-hald.rc.1" "${WORKDIR}/" || \
244 die "failed to copy hald.rc.1"
245 if use consolekit || use policykit; then
246 sed -e 's:need dbus:need dbus consolekit:' \
247 -i "${WORKDIR}/0.5.14-hald.rc.1" || die "failed to change verbose"
248 fi
249 newinitd "${WORKDIR}/0.5.14-hald.rc.1" hald || die "init script failed"
250
251 # configuration
252 cp "${FILESDIR}/0.5.14-hald.conf" "${WORKDIR}/" || \
253 die "failed to copy hald.conf"
254
255 if use debug; then
256 sed -e 's:HALD_VERBOSE="no":HALD_VERBOSE="yes":' \
257 -i "${WORKDIR}/0.5.14-hald.conf" || die "failed to change verbose"
258 fi
259 newconfd "${WORKDIR}/0.5.14-hald.conf" hald || \
260 die "failed to install hald.conf"
261
262 if use X ; then
263 # New Configuration Snippets
264 dodoc "${WORKDIR}/${PATCHNAME}/config-examples/"*.fdi || \
265 die "dodoc X examples failed"
266 fi
267
268 # We now create and keep /media here as both gnome-mount and pmount
269 # use these directories, to avoid collision.
270 keepdir /media
271
272 # We also need to create and keep /etc/fdi/{information,policy,preprobe}
273 # or else hal bombs.
274 keepdir /etc/hal/fdi/{information,policy,preprobe}
275
276 # HAL stores it's fdi cache in /var/cache/hald
277 keepdir /var/cache/hald
278
279 # HAL keeps its unix socket here
280 keepdir /var/run/hald
281 keepdir /var/lib/hal
282 }
283
284 pkg_postinst() {
285 # Despite what people keep changing this location. Either one works.. it doesn't matter
286 # http://dev.gentoo.org/~plasmaroo/devmanual/ebuild-writing/functions/
287
288 elog "The HAL daemon needs to be running for certain applications to"
289 elog "work. Suggested is to add the init script to your start-up"
290 elog "scripts, this should be done like this :"
291 elog "\`rc-update add hald default\`"
292 echo
293 elog "Access to hal is now protected by either policykit or the plugdev group."
294 elog "If you have problems discovering/configuring hardware, try adding"
295 elog "yourself to plugdev, or ensuring consolekit is started"
296 echo
297 elog "IF you have additional applications which consume ACPI events, you"
298 elog "should consider installing acpid to allow applications to share ACPI"
299 elog "events."
300 if use X ; then
301 echo
302 elog "If you wish to use a non US layout, you may do so by executing:"
303 elog "setxkbmap <layout> or by utilizing your Desktop Environment's"
304 elog "Keyboard Layout Settings mechanism."
305 elog "Under GNOME, this is gnome-keyboard-properties, and under KDE"
306 elog "it is kxkb."
307 fi
308 echo
309 elog "In order have suspend/hibernate function with HAL or apps that use HAL"
310 elog "(such as gnome-power-manager), you should build HAL with the laptop"
311 elog "useflag which will install pm-utils."
312 if use X ; then
313 echo
314 elog "X Input Hotplugging (if you build xorg-server with the HAL useflag)"
315 elog "reads user specific configuration from /etc/hal/fdi/policy/."
316 echo
317 elog "You should remove the Input sections from your xorg.conf once you have"
318 elog "migrated the rules to a HAL fdi file."
319 fi
320
321 ebeep 5
322 epause 5
323 }

  ViewVC Help
Powered by ViewVC 1.1.20