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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Dec 21 16:33:20 2010 UTC (3 years, 8 months ago) by dang
Branch: MAIN
bug #340337

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

  ViewVC Help
Powered by ViewVC 1.1.20