2012-11-19 21:27:09 +08:00
|
|
|
# Maintainer: Neophytos Kolokotronis <tetris4@gmail,com>
|
|
|
|
# Contributors from AUR: M0Rf30
|
|
|
|
# Samsagax <samsagax@gmail.com>
|
|
|
|
|
|
|
|
_PACKAGES=`pacman -Qsq linux`
|
|
|
|
_KERNELS=`pacman -Ql $_PACKAGES | grep /modules.alias.bin | sed 's/.*\/lib\/modules\/\(.*\)\/modules.alias.bin/\1/g'`
|
|
|
|
|
2012-02-05 19:51:46 +08:00
|
|
|
pkgname=bbswitch
|
2012-11-19 21:27:09 +08:00
|
|
|
pkgver=0.5
|
2012-11-19 22:26:36 +08:00
|
|
|
pkgrel=2
|
2012-02-05 19:51:46 +08:00
|
|
|
pkgdesc="kernel module allowing to switch dedicated graphics card on Optimus laptops"
|
2012-11-19 21:27:09 +08:00
|
|
|
arch=('i686' 'x86_64')
|
2012-02-05 19:51:46 +08:00
|
|
|
url=("http://github.com/Bumblebee-Project/bbswitch")
|
|
|
|
license=('GPL')
|
|
|
|
provides=('bbswitch')
|
2012-11-19 21:27:09 +08:00
|
|
|
makedepends=('linux-headers')
|
2012-02-05 19:51:46 +08:00
|
|
|
install=bbswitch.install
|
|
|
|
source=("https://github.com/downloads/Bumblebee-Project/bbswitch/${pkgname}-${pkgver}.tar.gz")
|
2012-11-19 21:27:09 +08:00
|
|
|
md5sums=('5e0e6eb9c5e8c10db56e5b349b43bba7')
|
2012-02-05 19:51:46 +08:00
|
|
|
|
|
|
|
build() {
|
|
|
|
cd ${srcdir}/${pkgname}-${pkgver}
|
2012-11-19 21:27:09 +08:00
|
|
|
sed -i "s|/lib/modules|/usr/lib/modules|g" Makefile
|
|
|
|
|
|
|
|
for _kernver in $_KERNELS; do
|
|
|
|
msg2 "Building module for $_kernver..."
|
|
|
|
|
|
|
|
# KDIR is necessary even when cleaning
|
|
|
|
make KDIR=/usr/src/linux-${_kernver} clean
|
|
|
|
make KDIR=/usr/src/linux-${_kernver}
|
|
|
|
done
|
2012-02-05 19:51:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2012-11-19 21:27:09 +08:00
|
|
|
cd ${srcdir}/${pkgname}-${pkgver}
|
2012-02-05 19:51:46 +08:00
|
|
|
|
2012-11-19 21:27:09 +08:00
|
|
|
# Find all extramodules directories
|
2012-11-19 22:26:36 +08:00
|
|
|
_EXTRAMODULES=`find /lib/modules -name version | sed 's|\/lib\/modules\/||; s|\/version||'`
|
2012-11-19 21:27:09 +08:00
|
|
|
|
|
|
|
# Loop through all detected kernels
|
|
|
|
for _kernver in $_KERNELS; do
|
|
|
|
|
|
|
|
# Loop through all detected extramodules directories
|
|
|
|
for _moduledirs in $_EXTRAMODULES; do
|
|
|
|
# Check which extramodules directory corresponds with the built module
|
2012-11-19 22:26:36 +08:00
|
|
|
if [ `cat "/lib/modules/${_moduledirs}/version"` = $_kernver ]; then
|
|
|
|
mkdir -p "${pkgdir}/lib/modules/${_moduledirs}/"
|
|
|
|
install -m644 bbswitch.ko "${pkgdir}/lib/modules/${_moduledirs}/"
|
|
|
|
gzip "${pkgdir}/lib/modules/${_moduledirs}/bbswitch.ko"
|
2012-11-19 21:27:09 +08:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2012-02-22 18:14:42 +08:00
|
|
|
}
|