|
| 1 | +# buildforkernels macro hint: when you build a new version or a new release |
| 2 | +# that contains bugfixes or other improvements then you must disable the |
| 3 | +# "buildforkernels newest" macro for just that build; immediately after |
| 4 | +# queuing that build enable the macro again for subsequent builds; that way |
| 5 | +# a new akmod package will only get build when a new one is actually needed |
| 6 | +%global buildforkernels current |
| 7 | + |
| 8 | +Name: mba6x_bl |
| 9 | +Version: 20150428.f1482dd |
| 10 | +Release: 1%{?dist} |
| 11 | +Summary: Kernel module for MacBook Air backlight driver |
| 12 | +Group: System Environment/Kernel |
| 13 | +License: GPL |
| 14 | +URL: https://github.com/patjak/mba6x_bl |
| 15 | +Source0: https://raw.githubusercontent.com/patjak/mba6x_bl/master/mba6x_bl.c |
| 16 | +Source1: https://raw.githubusercontent.com/patjak/mba6x_bl/master/Makefile |
| 17 | +Source2: https://raw.githubusercontent.com/patjak/mba6x_bl/master/README.md |
| 18 | +Source3: https://raw.githubusercontent.com/patjak/mba6x_bl/master/LICENSE |
| 19 | +Source4: https://raw.githubusercontent.com/patjak/mba6x_bl/master/98-mba_bl.conf |
| 20 | + |
| 21 | +BuildRequires: %{_bindir}/kmodtool |
| 22 | + |
| 23 | +ExclusiveArch: i686 x86_64 |
| 24 | + |
| 25 | + |
| 26 | +%{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} } |
| 27 | + |
| 28 | +# kmodtool does its magic here |
| 29 | +%{expand:%(kmodtool --noakmod --target %{_target_cpu} --repo rpmfusion --kmodname %{name} --filterfile %{SOURCE0} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } |
| 30 | + |
| 31 | +%description |
| 32 | +MacBook Air backlight driver |
| 33 | + |
| 34 | +%prep |
| 35 | +rm -rf ${RPM_BUILD_ROOT} |
| 36 | +# error out if there was something wrong with kmodtool |
| 37 | +%{?kmodtool_check} |
| 38 | + |
| 39 | +# print kmodtool output for debugging purposes: |
| 40 | +kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} --filterfile %{SOURCE0} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null |
| 41 | + |
| 42 | +for kernel_version in %{?kernel_versions} ; do |
| 43 | + mkdir -p _kmod_build_${kernel_version%%___*} |
| 44 | + cp %{SOURCE0} _kmod_build_${kernel_version%%___*} |
| 45 | + cp %{SOURCE1} _kmod_build_${kernel_version%%___*} |
| 46 | +done |
| 47 | + |
| 48 | +%build |
| 49 | +for kernel_version in %{?kernel_versions}; do |
| 50 | + pushd _kmod_build_${kernel_version%%___*} |
| 51 | + make -C ${kernel_version##*___} M=`pwd` modules |
| 52 | + popd |
| 53 | +done |
| 54 | + |
| 55 | +%install |
| 56 | +rm -rf ${RPM_BUILD_ROOT} |
| 57 | + |
| 58 | +rm -rf ${RPM_BUILD_ROOT} |
| 59 | +mkdir -p %{buildroot}/%{_docdir}/%{name}-%{version} |
| 60 | +install -m 0644 %{SOURCE2} %{buildroot}/%{_docdir}/%{name}-%{version} |
| 61 | +install -m 0644 %{SOURCE3} %{buildroot}/%{_docdir}/%{name}-%{version} |
| 62 | + |
| 63 | +mkdir -p %{buildroot}/%{_sysconfdir}/X11/xorg.conf.d/ |
| 64 | +install -m 0644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/X11/xorg.conf.d/ |
| 65 | + |
| 66 | +for kernel_version in %{?kernel_versions}; do |
| 67 | + pushd _kmod_build_${kernel_version%%___*} |
| 68 | + mkdir -p ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}${kernel_version%%___*}%{kmodinstdir_postfix} |
| 69 | + install -m 0755 *.ko ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}${kernel_version%%___*}%{kmodinstdir_postfix} |
| 70 | + popd |
| 71 | +done |
| 72 | + |
| 73 | +chmod 0755 $RPM_BUILD_ROOT%{kmodinstdir_prefix}*%{kmodinstdir_postfix}/* || : |
| 74 | +%{?akmod_install} |
| 75 | + |
| 76 | + |
| 77 | +# We need to define a userland package as described at |
| 78 | +# http://rpmfusion.org/Packaging/KernelModules/Kmods2#userland_package |
| 79 | + |
| 80 | +%package common |
| 81 | +Summary: Documentation and RPM provides for mba6x_bl driver |
| 82 | +Provides: %{name}-kmod-common = %{?epoch:%{epoch}:}%{version} |
| 83 | + |
| 84 | +%description common |
| 85 | +Documentation and RPM provides for mba6x_bl driver. |
| 86 | + |
| 87 | +%files common |
| 88 | +%defattr(-,root,root,-) |
| 89 | +%doc %{_docdir}/%{name}-%{version}/* |
| 90 | +%config(noreplace) %{_sysconfdir}/X11/xorg.conf.d/98-mba_bl.conf |
| 91 | + |
| 92 | + |
| 93 | +%changelog |
| 94 | +* Tue Apr 28 2015 Alexander Todorov <[email protected]> - 20150428.f1482dd-1 |
| 95 | +- Initial build |
0 commit comments