Merge remote-tracking branch 'dm/opendreambox-1.6' into test_0701
[vuplus_openembedded] / recipes / hal / hal.inc
1 DESCRIPTION = "Hardware Abstraction Layer"
2 HOMEPAGE = "http://freedesktop.org/Software/hal"
3 SECTION = "unknown"
4 LICENSE = "GPL LGPL AFL"
5
6 SRC_URI = "http://hal.freedesktop.org/releases/hal-${PV}.tar.gz"
7
8 S = "${WORKDIR}/hal-${PV}"
9
10 inherit autotools pkgconfig
11
12 DEPENDS = "virtual/kernel util-linux-ng dbus-glib udev intltool intltool-native expat virtual/libusb0 gperf-native"
13 RDEPENDS += "hal-info udev-utils"
14 RRECOMMENDS += "eject"
15
16 SRC_URI += "file://99_hal \
17             file://20hal \
18            "
19
20 LEAD_SONAME = "libhal.so"
21
22 # machines with pci and acpi get a machine dependant hal
23 EXTRA_OECONF = "--with-hwdata=${datadir}/hwdata \
24                 --with-expat=${STAGING_LIBDIR}/.. \
25                 --with-dbus-sys=${sysconfdir}/dbus-1/system.d \
26                 --with-hotplug=${sysconfdir}/hotplug.d \
27                 --disable-docbook-docs \
28                 --disable-policy-kit \
29                 --disable-pmu \
30                 --disable-pnp-ids \
31                 --with-udev-prefix=${sysconfdir} \
32                 ${@base_contains('COMBINED_FEATURES', 'pci', '--enable-pci --enable-pci-ids', '--disable-pci --disable-pci-ids',d)} \
33                 ${@base_contains('MACHINE_FEATURES', 'acpi', '--enable-acpi', '--disable-acpi',d)} \
34                "
35
36 MY_ARCH := "${PACKAGE_ARCH}"
37 PACKAGE_ARCH = "${@base_contains('MACHINE_FEATURES', 'acpi', '${MACHINE_ARCH}', '${MY_ARCH}',d)}"
38 PACKAGE_ARCH = "${@base_contains('MACHINE_FEATURES', 'pci', '${MACHINE_ARCH}', '${MY_ARCH}',d)}"
39
40 do_install_append() {
41         install -d ${D}/${sysconfdir}/default/volatiles
42         install -m 0644 ${WORKDIR}/99_hal ${D}/${sysconfdir}/default/volatiles
43         install -d ${D}/${sysconfdir}/dbus-1/event.d
44         install -m 0755 ${WORKDIR}/20hal ${D}/${sysconfdir}/dbus-1/event.d
45         rm -rf ${D}/${sysconfdir}/rc.d || true
46 }
47
48 do_stage() {
49         oe_libinstall -C libhal -a -so libhal ${STAGING_LIBDIR}
50         oe_libinstall -C libhal-storage -a -so libhal-storage ${STAGING_LIBDIR}
51
52         install -d ${STAGING_INCDIR}/hal
53         install -m 0644 libhal/libhal.h ${STAGING_INCDIR}/hal
54         install -m 0644 libhal-storage/libhal-storage.h ${STAGING_INCDIR}/hal
55 }
56
57 # At the time the postinst runs, dbus might not be setup so only restart if running
58 pkg_postinst_hal () {
59         # can't do this offline
60         if [ "x$D" != "x" ]; then
61                 exit 1
62         fi
63
64         grep haldaemon ${sysconfdir}/group || addgroup haldaemon
65         grep haldaemon ${sysconfdir}/passwd || adduser --disabled-password --system --home /var/run/hald --no-create-home haldaemon --ingroup haldaemon -g HAL
66
67         ${sysconfdir}/init.d/populate-volatile.sh update
68
69         DBUSPID=`pidof dbus-daemon`
70
71         if [ "x$DBUSPID" != "x" ]; then
72                 ${sysconfdir}/init.d/dbus-1 force-reload
73         fi
74 }
75
76 pkg_postrm_hal () {
77         deluser haldaemon || true
78         delgroup haldaemon || true
79 }
80
81 FILES_${PN} = "${sysconfdir} \
82                 ${bindir}/hal-disable-polling \
83                 ${bindir}/hal-setup-keymap \
84                 ${bindir}/lshal \
85                 ${bindir}/hal-find-by-capability \
86                 ${bindir}/hal-find-by-property \
87                 ${bindir}/hal-device  \
88                 ${bindir}/hal-get-property \
89                 ${bindir}/hal-set-property  \
90                 ${bindir}/hal-lock  \
91                 ${bindir}/hal-is-caller-locked-out  \
92                 ${sbindir} \
93                 ${libdir}/libhal.so.* \
94                 ${libdir}/libhal-storage.so.* \
95                 ${libdir}/hal \
96                 ${libexecdir} \
97                 ${datadir}/hal/fdi \
98                 ${datadir}/hal/scripts"