%global commit d256c2ae282b70f03629e36900da54905ab4187c %global shortcommit %(c=%{commit}; echo ${c:0:7}) #global gitdate 20221207 %define buildforkernels akmod %global debug_package %{nil} Name: rtw8852cu-kmod Version: 0.0.1 Release: 1%{?dist} Summary: Realtek %{kmod_name} linux wireless driver License: GPLv2 URL: https://github.com/lwfinger/rtw8852cu Source0: %{URL}/archive/%{commit}/rtw8852cu-%{shortcommit}.tar.gz %global AkmodsBuildRequires %{_bindir}/kmodtool xz time elfutils-libelf-devel gcc bc BuildRequires: %{AkmodsBuildRequires} # kmodtool does its magic here %{expand:%(kmodtool --target %{_target_cpu} --repo fedora --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } %description %{summary}. %package -n rtw8852cu Summary: Common package of kernel modules for Realtek rtw8852CU Driver Requires: %{name} = %{version}-%{release} Provides: %{name}-common = %{version}-%{release} %description -n rtw8852cu %{summary}. %prep %{?kmodtool_check} #debug print what kmodtool generated kmodtool --target %{_target_cpu} --repo fedora --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null %setup -q -c -T -a 0 pushd rtw8852cu-%{commit} popd echo "override rtw8852cu * weak-updates/rtw8852cu" > kmod-rtw8852cu.conf for kernel_version in %{?kernel_versions} ; do cp -a rtw8852cu-%{commit} _kmod_build_${kernel_version%%___*} done %build for kernel_version in %{?kernel_versions} ; do pushd _kmod_build_${kernel_version%%___*} make %{?_smp_mflags} \ KSRC=${kernel_version##*___} \ KVERS=${kernel_version%%___*} modules popd done %install %{__install} -d %{buildroot}%{_sysconfdir}/depmod.d/ %{__install} kmod-rtw8852cu.conf %{buildroot}%{_sysconfdir}/depmod.d/ # Set the module(s) to be executable, so that they will be stripped when packaged. find %{buildroot} -type f -name \*.ko -exec %{__chmod} u+x \{\} \; for kernel_version in %{?kernel_versions}; do install -d %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix} install _kmod_build_${kernel_version%%___*}/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix} done %{?akmod_install} %files -n rtw8852cu %license rtw8852cu-%{commit}/LICENSE %doc rtw8852cu-%{commit}/README.md %{_sysconfdir}/depmod.d/kmod-rtw8852cu.conf