# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: mortzu <me@mortzu.de>
# Contributor: fnord0 <fnord0@riseup.net>

pkgname=acpi_call-dkms
pkgver=1.2.1
pkgrel=5
pkgdesc='A linux kernel module that enables calls to ACPI methods through /proc/acpi/call - module sources'
url=https://github.com/nix-community/acpi_call
arch=(any)
license=(GPL)
depends=(dkms)
makedepends=(git)
provides=(acpi_call=${pkgver}-${pkgrel})
conflicts=(acpi_call)
_tag=3a28aabfa337d59df91cc04c85b250da7f7cadea
source=(
  git+https://github.com/nix-community/acpi_call.git#tag=${_tag}
  dkms.conf
)
b2sums=('SKIP'
        '504da1102e778fe54368e990408dbef02f5b2ce91f683d170f3d6a1a2f9349d00d61dcbddd0262a8dfc958ea0964135ba58d8dd88ac06bd10b5e13b90f11faef')

pkgver() {
  cd acpi_call

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd acpi_call

  # Fix for 5.13+ kernels
  git cherry-pick -n '48011f82726c263f49a2b9ca3d9f674bdb4cfd22'
}

package() {
  install -Dm 644 acpi_call/{Makefile,acpi_call.c} dkms.conf -t "${pkgdir}"/usr/src/acpi_call-${pkgver}
  echo acpi_call | install -Dm 644 /dev/stdin "${pkgdir}"/usr/lib/modules-load.d/acpi_call.conf
  install -dm 755 "${pkgdir}"/usr/share/acpi_call
  cp -dr --no-preserve=ownership acpi_call/{examples,support} "${pkgdir}"/usr/share/acpi_call/
}

# vim: ts=2 sw=2 et:
