#Maintainer: Shador <futur~DOT~andy~AT~googlemail.com>

pkgname=acpica
pkgver=20091214
pkgrel=1ab
arch=i486
source=("http://www.acpica.org/download/acpica-unix-20091214.tar.gz" "LICENSE")
sourcetemplate="http://gaia.homelinux.org/salix/packages/$pkgname/$pkgver/"
docs=("readme" "changes.txt" "LICENSE")
url='http://www.acpica.org/'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (ACPI Source Language [ASL] Utils)"
"ACPI CA includes:"
" - iasl, an ASL compiler/decompiler"
" - acpisrc, a source code conversion tool"
" - acpiexec, a user-space AML interpreter"
" - acpixtract, convert ascii ACPI tables to binary"
""
"Homepage: http://acpica.org"
)


build() {
  threadcount=$(($(sed -ne '/cpu cores/h;${g;s/[^0-9]*//p}' \
            < /proc/cpuinfo)*2))
  if [ $threadcount -lt 2 ]; then
    threadcount=2
  elif [ $threadcount -gt 8 ]; then
    threadcount=8
  fi
  threads="-j${threadcount}"
  set -e

  cd $startdir/src/acpica-unix-$pkgver
  
  cd compiler
    echo "Compiling 'iasl'..."
    make
    install -vD -m755 iasl $startdir/pkg/usr/bin/iasl
    make clean
  cd -
  
  for i in acpixtract acpisrc acpiexec; do
    cd tools/$i
      echo "Compiling $i..."
      make
      install -vD -m755 $i $startdir/pkg/usr/bin/$i
      make clean
    cd -
  done
  
  set +e
}