/[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.1 - (hide annotations) (download)
Tue Sep 28 06:20:47 2010 UTC (4 years, 2 months ago) by ssuominen
Branch: MAIN
Remove now unnecessary workaround for PATH and 512 bytes limit in init script wrt #267928.

(Portage version: 2.2_rc87/cvs/Linux x86_64)

1 ssuominen 1.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-r2.ebuild,v 1.11 2010/09/28 04:47:53 ssuominen 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     )"
61     PDEPEND=">=app-misc/hal-info-20081219
62     !gnome-extra/hal-device-manager
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)\n"
72     local WARNING_NET="CONFIG_NET:\tis not set (required for HAL)\n"
73     check_extra_config
74     }
75    
76     function check_inotify() {
77     local CONFIG_CHECK="~INOTIFY_USER"
78     local WARNING_INOTIFY_USER="CONFIG_INOTIFY_USER:\tis not set (required for HAL)\n"
79     check_extra_config
80     }
81    
82     function check_acpi_proc() {
83     local CONFIG_CHECK="~ACPI_PROCFS ~ACPI_PROC_EVENT"
84     local WARNING_ACPI_PROCFS="CONFIG_ACPI_PROCFS:\tis not set (required for HAL)\n"
85     local WARNING_ACPI_PROC_EVENT="CONFIG_ACPI_PROC_EVENT:\tis not set (required for HAL)\n"
86     check_extra_config
87     }
88    
89     pkg_setup() {
90     if use kernel_linux ; then
91     if [[ -e "${ROOT}/usr/src/linux/.config" ]] ; then
92     kernel_is ge 2 6 19 || ewarn "HAL requires a kernel version 2.6.19 or newer"
93    
94     if kernel_is lt 2 6 23 && use acpi ; then
95     check_acpi_proc
96     fi
97     fi
98    
99     check_hotplug_net
100     check_inotify
101     fi
102    
103     # http://devmanual.gentoo.org/ebuild-writing/functions/
104     # http://bugs.gentoo.org/show_bug.cgi?id=191605
105    
106     # Create groups for hotplugging and HAL
107     enewgroup haldaemon
108     enewgroup plugdev
109    
110     # HAL drops priviledges by default now ...
111     # ... so we must make sure it can read disk/cdrom info (ie. be in ${HALDAEMON_GROUPS} groups)
112     if use kernel_linux; then
113     enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_LINUX}
114     elif use kernel_FreeBSD; then
115     enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS_FREEBSD}
116     fi
117    
118     # Make sure that the haldaemon user is in the ${HALDAEMON_GROUPS}
119     # If users have a problem with this, let them file a bug
120     if [[ ${ROOT} == / ]] ; then
121     if use kernel_linux; then
122     usermod -G ${HALDAEMON_GROUPS_LINUX} haldaemon
123     elif use kernel_FreeBSD; then
124     pw usermod haldaemon -G ${HALDAEMON_GROUPS_FREEBSD}
125     fi
126     fi
127     }
128    
129     src_prepare() {
130     # Patch for fbsd, Bug #309263. MOVE INTO PATCHSET FOR NEXT BUMP!
131     epatch "${FILESDIR}"/${P}-r2-fbsd.patch
132    
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     cp "${FILESDIR}/0.5.14-hald.rc.1" "${WORKDIR}/" || \
243     die "failed to copy hald.rc.1"
244     if use consolekit || use policykit; then
245     sed -e 's:need dbus:need dbus consolekit:' \
246     -i "${WORKDIR}/0.5.14-hald.rc.1" || die "failed to change verbose"
247     fi
248     newinitd "${WORKDIR}/0.5.14-hald.rc.1" hald || die "init script failed"
249    
250     # configuration
251     cp "${FILESDIR}/0.5.14-hald.conf" "${WORKDIR}/" || \
252     die "failed to copy hald.conf"
253    
254     if use debug; then
255     sed -e 's:HALD_VERBOSE="no":HALD_VERBOSE="yes":' \
256     -i "${WORKDIR}/0.5.14-hald.conf" || die "failed to change verbose"
257     fi
258     newconfd "${WORKDIR}/0.5.14-hald.conf" hald || \
259     die "failed to install hald.conf"
260    
261     if use X ; then
262     # New Configuration Snippets
263     dodoc "${WORKDIR}/${PATCHNAME}/config-examples/"*.fdi || \
264     die "dodoc X examples failed"
265     fi
266    
267     # We now create and keep /media here as both gnome-mount and pmount
268     # use these directories, to avoid collision.
269     keepdir /media
270    
271     # We also need to create and keep /etc/fdi/{information,policy,preprobe}
272     # or else hal bombs.
273     keepdir /etc/hal/fdi/{information,policy,preprobe}
274    
275     # HAL stores it's fdi cache in /var/cache/hald
276     keepdir /var/cache/hald
277    
278     # HAL keeps its unix socket here
279     keepdir /var/run/hald
280     keepdir /var/lib/hal
281     }
282    
283     pkg_postinst() {
284     # Despite what people keep changing this location. Either one works.. it doesn't matter
285     # http://dev.gentoo.org/~plasmaroo/devmanual/ebuild-writing/functions/
286    
287     elog "The HAL daemon needs to be running for certain applications to"
288     elog "work. Suggested is to add the init script to your start-up"
289     elog "scripts, this should be done like this :"
290     elog "\`rc-update add hald default\`"
291     echo
292     elog "Access to hal is now protected by either policykit or the plugdev group."
293     elog "If you have problems discovering/configuring hardware, try adding"
294     elog "yourself to plugdev, or ensuring consolekit is started"
295     echo
296     elog "IF you have additional applications which consume ACPI events, you"
297     elog "should consider installing acpid to allow applications to share ACPI"
298     elog "events."
299     if use X ; then
300     echo
301     elog "If you wish to use a non US layout, you may do so by executing:"
302     elog "setxkbmap <layout> or by utilizing your Desktop Environment's"
303     elog "Keyboard Layout Settings mechanism."
304     elog "Under GNOME, this is gnome-keyboard-properties, and under KDE"
305     elog "it is kxkb."
306     fi
307     echo
308     elog "In order have suspend/hibernate function with HAL or apps that use HAL"
309     elog "(such as gnome-power-manager), you should build HAL with the laptop"
310     elog "useflag which will install pm-utils."
311     if use X ; then
312     echo
313     elog "X Input Hotplugging (if you build xorg-server with the HAL useflag)"
314     elog "reads user specific configuration from /etc/hal/fdi/policy/."
315     echo
316     elog "You should remove the Input sections from your xorg.conf once you have"
317     elog "migrated the rules to a HAL fdi file."
318     fi
319    
320     ebeep 5
321     epause 5
322     }

  ViewVC Help
Powered by ViewVC 1.1.20