core/acpi_call/PKGBUILD
2018-08-25 00:54:22 +02:00

40 lines
1.2 KiB
Bash

pkgname=acpi_call
pkgver=1.1.0
pkgrel=50
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.18.5")
makedepends=("linux-headers=4.18.5")
_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
}