# Build only the akmod package and no kernel module packages: %define buildforkernels akmod %global debug_package %{nil} Name: xone-kmod Version: 0.0.git.152.60d92082 Release: 1%{?dist} Summary: Linux kernel driver for Xbox One and Xbox Series X|S accessories License: GPLv2 URL: https://github.com/KyleGospo/xonedo Source: %{url}/archive/refs/heads/master.tar.gz # Get the needed BuildRequires (in parts depending on what we build for): BuildRequires: kmodtool # kmodtool does its magic here %{expand:%(kmodtool --target %{_target_cpu} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } %description Linux kernel driver for Xbox One and Xbox Series X|S accessories. %prep # Error out if there was something wrong with kmodtool: %{?kmodtool_check} # Print kmodtool output for debugging purposes: kmodtool --target %{_target_cpu} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null %autosetup -p1 -n xonedo-master for kernel_version in %{?kernel_versions}; do mkdir _kmod_build_${kernel_version%%___*} cp -fr auth bus driver transport Kbuild _kmod_build_${kernel_version%%___*} done %build for kernel_version in %{?kernel_versions}; do pushd _kmod_build_${kernel_version%%___*}/ %make_build -C "${kernel_version##*___}" M=$(pwd) VERSION="v%{version}" modules popd done %install for kernel_version in %{?kernel_versions}; do mkdir -p %{buildroot}/%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/ install -p -m 0755 _kmod_build_${kernel_version%%___*}/*.ko \ %{buildroot}/%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/ done %{?akmod_install} %changelog