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

Contents of /sys-apps/hal/hal-0.5.13-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Thu Jul 23 15:10:07 2009 UTC (5 years, 4 months ago) by dang
Branch: MAIN
Fix udev hotplug events
(Portage version: 2.2_rc33/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20