%if 0%{?fedora} %global buildforkernels akmod %else %global buildforkernels current %endif %global debug_package %{nil} %global prjname zenpower3 Name: %{prjname}-kmod Version: 0.2.0^1.gitc176fdb0d5 Release: 2%{?dist} Summary: Kernel module (kmod) for %{prjname} License: GPLv2 URL: https://git.exozy.me/a/%{prjname} Source0: https://git.exozy.me/a/%{prjname}/archive/c176fdb0d5bcba6ba2aba99ea36812e40f47751f.tar.gz BuildRequires: gcc BuildRequires: make BuildRequires: kmodtool %{?el8:BuildRequires: elfutils-libelf-devel} %if 0%{?rhel} %{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} } %endif # kmodtool does its magic here %{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{prjname} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } %description Zenpower3 is a Linux kernel driver for reading temperature, voltage(SVI2), current(SVI2) and power(SVI2) for AMD Zen family CPUs, now with Zen 3 support! This package contains the kmod module for %{prjname}. %prep %setup -q -n %{prjname} # Error out if there was something wrong with kmodtool. %{?kmodtool_check} # Print kmodtool output for debugging purposes: kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{prjname} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null mkdir src cp -a Makefile zenpower.c src/ for kernel_version in %{?kernel_versions} ; do cp -a src _kmod_build_${kernel_version%%___*} done echo %{version} > VERSION %build for kernel_version in %{?kernel_versions} ; do make V=1 %{?_smp_mflags} -C ${kernel_version##*___} M=${PWD}/_kmod_build_${kernel_version%%___*} modules done %install for kernel_version in %{?kernel_versions}; do mkdir -p %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/ install -Dpm 0755 _kmod_build_${kernel_version%%___*}/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/ chmod a+x %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/*.ko done %{?akmod_install} %changelog * Sat Sep 28 2024 Andrey Brusnik - 0.2.0^1.gitc176fdb0d5-2 - fix: Build kmod instead of akmod for EL * Tue Nov 07 2023 Andrey Brusnik - 0.2.0^1.gitc176fdb0d5-1 - Initial package