%global commit 23891174a80ea79c7720bcc7048a5c2bfcde5cd9 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %define buildforkernels akmod %define debug_package %{nil} Name: bbswitch-kmod Version: 0.8 Release: 8.git%{shortcommit}%{?dist} Summary: Kernel module for powering off discrete GPU on Optimus laptops License: GPLv2+ URL: https://github.com/Bumblebee-Project/bbswitch Source0: https://github.com/Bumblebee-Project/bbswitch/archive/%{commit}/bbswitch-%{shortcommit}.tar.gz Patch0: 0001-Disable-the-PCIe-upstream-port.patch Patch1: 0002-kernel-5.7.patch Patch2: 0003-kernel-5.18.patch Patch3: 0004-Added-support-for-integrated-AMD-GPUs.patch BuildRequires: kmodtool %{expand:%(kmodtool --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } %description bbswitch is a kernel module for powering off the discrete GPU on NVIDIA Optimus-enabled laptops. This package contains the bbswitch kernel module for kernel %{kversion}. %package common Summary: Common files for bbswitch kernel module Requires: %{name} = %{version}-%{release} BuildArch: noarch %description common This package contains the common files (license, documentation, etc.) for the bbswitch kernel module. %prep %setup -q -T -c tar xf %{SOURCE0} %patch0 -p1 -d bbswitch-%{commit} %patch1 -p1 -d bbswitch-%{commit} %patch2 -p1 -d bbswitch-%{commit} %patch3 -p1 -d bbswitch-%{commit} # For common package cp bbswitch-%{commit}/{COPYING,NEWS,README.md} . %{?kmodtool_check} kmodtool --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null for kernel_version in %{?kernel_versions}; do cp -al bbswitch-%{commit} _kmod_build_${kernel_version%%___*} done %build for kernel_version in %{?kernel_versions}; do make %{?_smp_mflags} \ -C "${kernel_version##*___}" \ M=${PWD}/_kmod_build_${kernel_version%%___*} \ modules done %install for kernel_version in %{?kernel_versions}; do install -D -m 0755 _kmod_build_${kernel_version%%___*}/bbswitch.ko \ %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/bbswitch.ko done %{?akmod_install} %files common %doc NEWS README.md %license COPYING %changelog * Sun Mar 19 2023 Pavel Artsishevsky - 0.8-8 - Add patch for support integrated AMD GPU's * Mon Aug 01 2022 Pavel Artsishevsky - 0.8-6 - Add Arch Linux patch for compatbility with kernel >=5.18.0 * Fri Jul 10 2020 Andrew Gunnerson - 0.8-5 - Add Arch Linux patch for compatbility with kernel >=5.7.0 * Fri Apr 17 2020 Andrew Gunnerson - 0.8-4 - Add Arch Linux patch for compatbility with kernel >=5.6.0 * Tue Jan 07 2020 Andrew Gunnerson - 0.8-3 - Change deprecated SUBDIRS= to M= - https://github.com/chenxiaolong/fedora-packages/issues/9 * Mon May 20 2019 Andrew Gunnerson - 0.8-2 - Rebuild against new kmodtool * Mon Dec 25 2017 Andrew Gunnerson - 0.8-1 - Initial release