Username: Password: Remember me
# Maintainer: UtG  <utg[dot]chakra.linux[at]gmail[dot]com>
# Contributor: Maxime Gauduin <alucryd@gmail.com>
# Contributor: ahjolinna <ahjolinna@ovi.com>
 
pkgname=acpi_call-ck
pkgver=1.1.0
pkgrel=3
 
_goodkver=4.0
_badkver=4.1
_modver="${_goodkver}-ck"
_extramodules="extramodules-${_modver}"
_kernver="$(cat "/usr/lib/modules/${_extramodules}/version")"
_SYSSRC="/usr/lib/modules/${_kernver}/build"
 
_extramodules=extramodules-3.18-ck
pkgdesc='A linux-ck kernel module that enables calls to ACPI methods through /proc/acpi/call'
arch=('x86_64')
url="http://github.com/mkottman/acpi_call"
license=('GPL')
depends=("linux-ck>=${_goodkver}" "linux-ck<${_badkver}")
makedepends=("linux-ck-headers>=${_goodkver}" "linux-ck-headers<${_badkver}")
provides=("${pkgname%-*}")
install=acpi_call-ck.install
source=("${url}/archive/v${pkgver}.tar.gz")
sha256sums=('d0d14b42944282724fca76f57d598eed794ef97448f387d1c489d85ad813f2f0')
 
prepare() {
  #automatically update acpi_call-ck.install
  sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${_extramodules}'/" "${startdir}/acpi_call-ck.install"
 
  cd acpi_call-${pkgver}
 
  # Fix build with Linux >= 3.17
  sed -i 's|acpi/acpi.h|linux/acpi.h|' acpi_call.c
}
 
build() {
  cd ${pkgname%-*}-${pkgver}
 
  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
 
  make KVERSION="${_kernver}"
}
 
package() {
  cd ${pkgname%-*}-${pkgver}
 
  install -dm 755 "${pkgdir}"/usr/lib/{modules/${_extramodules},modules-load.d}
  install -m 644 ${pkgname%-*}.ko "${pkgdir}"/usr/lib/modules/${_extramodules}
 
  gzip "${pkgdir}"/usr/lib/modules/${_extramodules}/${pkgname%-*}.ko
  echo ${pkgname%-*} > "${pkgdir}"/usr/lib/modules-load.d/${pkgname}.conf
 
  install -dm 755 "${pkgdir}"/usr/share/${pkgname}
  cp -dr --no-preserve='ownership' {examples,support} "${pkgdir}"/usr/share/${pkgname}/
 
  ln -s /usr/share/${pkgname%-*}/examples/turn_off_gpu.sh  \
    ${pkgdir}/usr/bin/turn_off_gpu.sh 
}