pkgname=tp_smapi pkgver=0.44 pkgrel=25 _extramodules=/lib/modules/extramodules-6.10 pkgdesc="Modules for ThinkPad's SMAPI functionality" arch=('x86_64') url='https://github.com/evgeni/tp_smapi' license=('GPL') depends=('linux>=6.10.9' 'linux<6.11') makedepends=('linux-headers' 'elfutils') install="${pkgname}.install" source=("https://github.com/evgeni/tp_smapi/releases/download/tp-smapi%2F${pkgver}/${pkgname}-${pkgver}.tgz" "https://github.com/evgeni/tp_smapi/commit/76c5120f7be4880cf2c6801f872327e4e70c449f.diff") md5sums=('e74404020e402b2fa871bcc3833632c7' 'feca3d1a2646d68d80ada2bd8e749e55') build() { cd "${srcdir}/${pkgname}-${pkgver}" #patch -p1 -i ${srcdir}/76c5120f7be4880cf2c6801f872327e4e70c449f.diff _kernver=$(< "${_extramodules}/version") sed -i -e 's|$(shell uname -r)|6.10.12-1|' Makefile make HDAPS=1 } package() { _kernver=$(< "${_extramodules}/version") make -C "${_extramodules%/*}/${_kernver}/build" \ INSTALL_MOD_PATH="${pkgdir}/${_extramodules%%/lib/*}" \ M="${srcdir}/${pkgname}-${pkgver}" modules_install cd "${pkgdir}/${_extramodules%/*}" mv "${_kernver}/updates" "${_extramodules##*/}" rmdir "${_kernver}" # compress kernel modules find "${pkgdir}" -name "*.ko" -exec gzip -9 {} + # load module on startup echo tp_smapi > "${srcdir}/${pkgname}.conf" install -Dm644 "${srcdir}/${pkgname}.conf" "${pkgdir}/lib/modules-load.d/${pkgname}.conf" # update kernel version in install file sed -ri "s#^(extramodules=).*\$#\1${_extramodules}#" "${startdir}/${pkgname}.install" }