# Maintainer (Arch): Maxime Gauduin <alucryd@archlinux.org>
# Contributor (Arch): mortzu <me@mortzu.de>
# Contributor (Arch): fnord0 <fnord0@riseup.net>
# Contributor (Hyperbola): André Silva <emulatorman@hyperbola.info>
# Contributor (Hyperbola): Márcio Silva <coadde@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>


_basekernel=5.9.12

pkgname=acpi_call-dkms
pkgver=1.2.1
pkgrel=2
pkgrel+=.parabola1.basekernel${_basekernel}
pkgdesc='A linux kernel module that enables calls to ACPI methods through /proc/acpi/call - module sources'
pkgdesc+=' (for linux-libre)'
url=https://github.com/nix-community/acpi_call
arch=(x86_64 i686)
license=(GPL)
depends=(dkms)
makedepends=(
  git
  linux-libre-headers=${_basekernel}
)
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//'
}

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/
}
