# Maintainer: Eric Belanger <eric@archlinux.org>
# Contributor: Aurelien Foret <orelien@chez.com>

pkgname=lm_sensors
pkgver=3.2.0
pkgrel=1
pkgdesc="Collection of user space tools for general SMBus access and hardware monitoring."
arch=('i686' 'x86_64')
url="http://www.lm-sensors.org/"
license=('GPL')
depends=('perl' 'sysfsutils')
makedepends=('rrdtool')
optdepends=('rrdtool: for logging with sensord')
backup=('etc/sensors3.conf')
install='sensors.install'
source=("http://dl.lm-sensors.org/lm-sensors/releases/$pkgname-$pkgver.tar.bz2"
        'rc.sensors'
        'rc.fancontrol'
        'sensors-detect.patch'
        'healthd'
        'healthd.conf'
        'rc.healthd'
        'sensord.conf'
        'rc.sensord')
md5sums=('829d88fb09d67723fbf42853eb84d1fd'
         'c370f5e620bfe41113354a1e22c0c18c'
         'b3695cd70f5cac17205a24f1249819af'
         '47c40b381d1f25d6634ae84cecf35f33'
         '6415014dc77365a48525901f30fe99da'
         'f649261f52bd4329347bf93f5f83cb0a'
         '970408d2e509dc4138927020efefe323'
         '96a8dd468e81d455ec9b165bdf33e0b7'
         '41a5c20854bbff00ea7174bd2276b736')

build() {
  cd $srcdir/$pkgname-$pkgver
  
  patch -p1 < $srcdir/sensors-detect.patch || return 1
  
  make PREFIX=/usr PROG_EXTRA:=sensord || return 1
}

package() {
  cd $srcdir/$pkgname-$pkgver
  
  make PREFIX=/usr MANDIR=/usr/share/man DESTDIR=$pkgdir install || return 1
  
  install -Dm755 prog/sensord/sensord $pkgdir/usr/sbin/sensord || return 1

  # install rc init scripts
  install -Dm755 $srcdir/rc.sensors $pkgdir/etc/rc.d/sensors || return 1
  install -Dm755 $srcdir/rc.fancontrol $pkgdir/etc/rc.d/fancontrol || return 1
  install -Dm755 $srcdir/rc.healthd $pkgdir/etc/rc.d/healthd || return 1
  install -Dm755 $srcdir/rc.sensord $pkgdir/etc/rc.d/sensord || return 1
  
  install -Dm755 $srcdir/healthd $pkgdir/usr/sbin/healthd || return 1
  
  # install config files
  install -Dm644 $srcdir/healthd.conf $pkgdir/etc/conf.d/healthd || return 1
  install -Dm644 $srcdir/sensord.conf $pkgdir/etc/conf.d/sensord || return 1
  
  # remove the static lib
  rm -rf $pkgdir/usr/lib/libsensors.a || return 1
  rmdir $pkgdir/etc/sensors.d || return 1
}

# vim:set ts=2 sw=2 et:
