# Maintainer: Laurent Carlier <lordheavym@gmail.com>
# Contributor: Eric Bélanger <eric@archlinux.org>
# Contributor: Lubosz Sarnecki <lubosz0@gmail.com>

pkgname=lib32-lm_sensors
pkgver=3.6.0.r41.g31d1f125
_commit=31d1f125d8076f1c8c8f3224b31d240e6e6a1763
#_pkgver=${pkgver//./-}
pkgrel=1
epoch=1
pkgdesc="Collection of user space tools for general SMBus access and hardware monitoring (32-bit)"
arch=('x86_64')
url="http://www.lm-sensors.org/"
license=('GPL' 'LGPL')
makedepends=('git')
depends=('lm_sensors' 'lib32-glibc')
provides=('libsensors.so')
#source=(lm_sensors-${pkgver}.tar.gz::https://github.com/groeck/lm-sensors/archive/V${pkgver//\./-}.tar.gz)
source=("git+https://github.com/groeck/lm-sensors.git#commit=${_commit}")
sha256sums=('SKIP')

pkgver() {
  cd "${srcdir}"/lm-sensors*

  git describe --long --tags | sed 's/V//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "${srcdir}"/lm-sensors*

  sed -i 's/CC := gcc/CC := gcc -m32/' Makefile
}

build() {
  cd "${srcdir}"/lm-sensors*

  make PREFIX=/usr
}

package() {
  cd "${srcdir}"/lm-sensors*
  
  make PREFIX=/usr LIBDIR=/usr/lib32 BUILD_STATIC_LIB=0 DESTDIR="${pkgdir}" install 
  
  rm -r "${pkgdir}"/etc/
  rm -r "${pkgdir}"/usr/{bin,sbin,include,man}
}

