%global commit 1eaa3a45da61bb38fd5cc8dad59db2ea9a843b45 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global gitdate 20240722 %global kmod_name cxadc3 %global git_name cxadc-linux3 %global url https://github.com/happycube/%{git_name} #workaround rpmfusion's kernel build spec %global repo rpmfusion #no debug package %global debug_package %{nil} # (un)define the next line to either build for the newest or all current kernels %define buildforkernels newest #define buildforkernels current #define buildforkernels akmod # name should have a -kmod suffix Name: %{kmod_name}-kmod Version: 3 Release: 1.git%{gitdate}%{?dist} Summary: Kernel module(s) Group: System Environment/Kernel License: GPL-2.0-or-later URL: %{url} Source0: %{url}/archive/%{commit}.tar.gz #Source0: %{git_name}-%{commit}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{_bindir}/kmodtool # Verify that the package build for all architectures. # In most time you should remove the Exclusive/ExcludeArch directives # and fix the code (if needed). # ExclusiveArch: i686 x86_64 ppc64 ppc64le armv7hl aarch64 # ExcludeArch: i686 x86_64 ppc64 ppc64le armv7hl aarch64 # get the proper build-sysbuild package from the repo, which # tracks in all the kernel-devel packages BuildRequires: %{_bindir}/kmodtool %{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} } # kmodtool does its magic here %{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } %description cxadc is an alternative Linux driver for the Conexant CX2388x series of video decoder/encoder chips used on many PCI TV tuner and capture cards. The new driver configures the CX2388x to capture in its raw output mode in 8-bit or 16-bit unsigned samples from the video input ports, allowing these cards to be used as a low-cost 28-54mhz 10bit ADC for SDR and similar applications. %prep # error out if there was something wrong with kmodtool %{?kmodtool_check} # print kmodtool output for debugging purposes: kmodtool --target %{_target_cpu} --repo %{repo} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null %setup -q -c -T -a 0 -n %{git_name} # apply patches and do other stuff here # pushd cxadc-linux-%{version} # #patch0 -p1 -b .suffix # popd for kernel_version in %{?kernel_versions} ; do cp -a cxadc-linux%{version}-%{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 rm -rf ${RPM_BUILD_ROOT} export cpath=$(pwd) for kernel_version in %{?kernel_versions}; do # echo "$(pwd)" cd _kmod_build_${kernel_version%___*} make KDIR="${kernel_version##*___}" INSTALL_MOD_PATH=${RPM_BUILD_ROOT} INSTALL_MOD_DIR=%{kmodinstdir_postfix} modules_install # install -D -m 755 _kmod_build_${kernel_version%%___*}/cxadc-linux/cxadc-linux3.ko ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/cxadc-linux3.ko cd $cpath done %{?akmod_install} cd $cpath install -D -m 755 ${cpath}/%{git_name}-%{commit}/cxadc.rules ${RPM_BUILD_ROOT}/etc/udev/rules.d/cxadc.rules install -D -m 755 ${cpath}/%{git_name}-%{commit}/cxadc.conf ${RPM_BUILD_ROOT}/etc/modprobe.d/cxadc.conf %clean rm -rf $RPM_BUILD_ROOT %files %attr(755,root,root) /etc/udev/rules.d/cxadc.rules %attr(755,root,root) /etc/modprobe.d/cxadc.conf %changelog * Sun Aug 04 2024 thonkdifferent <41342923+thonkdifferent@users.noreply.github.com> - First build