pkgname=acpi_call pkgver=1.1.0 pkgrel=47 pkgdesc="A kernel module that enables you to call parameterless ACPI methods by writing the method name to /proc/acpi/call, e.g. to turn off discrete graphics card in a dual graphics environment (like NVIDIA Optimus)." arch=('x86_64') url="http://github.com/mkottman/acpi_call" license=('GPL') depends=("linux=4.17.12") makedepends=("linux-headers=4.17.12") _extramodules=extramodules-CHAKRA source=("https://github.com/mkottman/acpi_call/archive/v${pkgver}.tar.gz") md5sums=('f69d40e130b0e5ed17ce8adb19e6dda1') prepare() { cd $pkgbase-$pkgver # Fix build with Linux >= 3.17 sed -i 's|acpi/acpi.h|linux/acpi.h|' acpi_call.c # Fix build with Linux >= 4.12 sed -i 's|asm/uaccess.h|linux/uaccess.h|' acpi_call.c } build() { cd $pkgbase-$pkgver make KVERSION="$(cat /usr/lib/modules/$_extramodules/version)" } package() { cd $pkgbase-$pkgver install -Dt "$pkgdir/usr/lib/modules/$_extramodules" -m644 *.ko find "$pkgdir" -name '*.ko' -exec xz {} + echo acpi_call | install -Dm644 /dev/stdin "$pkgdir/usr/lib/modules-load.d/acpi_call.conf" mkdir -p "$pkgdir/usr/share/acpi_call" cp -t "$pkgdir/usr/share/acpi_call" -dr --no-preserve=ownership examples support }