# $Id: PKGBUILD 12450 2008-09-14 10:49:05Z pierre $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Link Dupont <link@subpop.net>

pkgname=hal
pkgver=0.5.11
pkgrel=4
pkgdesc="Hardware Abstraction Layer"
arch=(i686 x86_64)
license=('GPL' 'custom')
url="http://www.freedesktop.org/wiki/Software/hal"
depends=('dbus-glib>=0.74' 'dbus>=1.2.1' 'libusb>=0.1.12' 'udev>=118' 'filesystem>=0.7.1-5' 'hal-info>=0.20080508' 'eject' 'libsmbios>=2.0.2' 'dmidecode' 'pciutils>=2.2.8-3' 'usbutils>=0.73-5' 'pm-utils>=1.1.2')
makedepends=('pkgconfig' 'gperf')
options=('!libtool')
install=hal.install
source=(http://hal.freedesktop.org/releases/${pkgname}-${pkgver}.tar.bz2
	hal
	hal-policy.patch
	cryptsetup_location.patch
	hal-0.5.9-hide-diagnostic.patch
	ntfs3g-valid-options.patch
	fix-udev-compatibility.patch
	ntfs-mount-fix.patch)
md5sums=('5e8935ab61bcb14afd2d4548084aace0'
         '277e96ac130d7bfce0b30f0b80db8782'
         '18dcdaa79952e2057c2e4745fbc8ad52'
         'c688a3c6574699365926f4fef7441545'
         '4d4b6801a1cedca22b8bdd9db73b16fb'
         '4242a2c78885e396f639d0cd5e33218c'
         '1a33d73fa422df2f05b7e3483836f778'
         '96cf8835c30dc581c4fcf72b6ad7675e')

build() {
  cd ${startdir}/src/${pkgname}-${pkgver}
  patch -Np1 -i ${startdir}/src/hal-policy.patch || return 1
  patch -Np1 -i ${startdir}/src/cryptsetup_location.patch || return 1
  patch -Np1 -i ${startdir}/src/hal-0.5.9-hide-diagnostic.patch || return 1
  patch -Np0 -i ${startdir}/src/ntfs3g-valid-options.patch || return 1
  # Fix compatibility with udev 126 and later
  patch -Np1 -i ${startdir}/src/fix-udev-compatibility.patch || return 1
  patch -p0 -i ${srcdir}/ntfs-mount-fix.patch || return 1

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
              --libexecdir=/usr/lib/hal --enable-static=no \
	      --enable-acpi-ibm --enable-acpi-toshiba \
              --disable-docbook-docs --disable-doxygen-docs \
	      --with-hal-user=hal --with-hal-group=hal \
	      --with-pid-file=/var/run/hald.pid \
	      --enable-policy-kit=no || return 1
  sed -e 's/device-manager//' -i tools/Makefile || return 1
  make || return 1
  make DESTDIR=${startdir}/pkg install || return 1
  install -m755 -d ${startdir}/pkg/etc/rc.d
  install -m755 -d ${startdir}/pkg/media || return 1
  install -m 755 ${startdir}/src/hal ${startdir}/pkg/etc/rc.d/hal || return 1

  install -m755 -d ${startdir}/pkg/usr/share/licenses/${pkgname}
  install -m644 COPYING ${startdir}/pkg/usr/share/licenses/${pkgname}/ || return 1
}