2 %bcond_without kernel # don't build kernel modules
3 %bcond_without userspace # don't build userspace tools
5 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
6 %{error:kernel and userspace cannot be built at the same time on PLD builders}
11 %define pname acpi_call
12 Summary: A linux kernel module that enables calls to ACPI methods through /proc/acpi/call
13 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
15 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
18 Source0: https://github.com/mkottman/acpi_call/archive/v%{version}/%{pname}-%{version}.tar.gz
19 # Source0-md5: f69d40e130b0e5ed17ce8adb19e6dda1
20 Patch0: %{pname}-build.patch
21 URL: https://github.com/mkottman/acpi_call
22 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
23 BuildRequires: rpmbuild(macros) >= 1.701
24 ExclusiveArch: %{ix86} %{x8664}
25 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
28 A linux kernel module that enables calls to ACPI methods through
31 %package -n %{pname}-scripts
32 Summary: This package contains sample scripts for acpi_call kernel module
33 Group: Applications/System
34 %if "%{_rpmversion}" >= "5"
38 %description -n %{pname}-scripts
39 This package contains sample scripts for acpi_call kernel module.
42 %package -n kernel%{_alt_kernel}-misc-acpi_call\
43 Summary: A linux kernel module that enables calls to ACPI methods through /proc/acpi/call\
44 Release: %{rel}@%{_kernel_ver_str}\
46 Requires(post,postun): /sbin/depmod\
47 %requires_releq_kernel\
48 Requires(postun): %releq_kernel\
50 %description -n kernel%{_alt_kernel}-misc-acpi_call\
51 A linux kernel module that enables calls to ACPI methods through\
53 %files -n kernel%{_alt_kernel}-misc-acpi_call\
54 %defattr(644,root,root,755)\
56 /lib/modules/%{_kernel_ver}/misc/acpi_call.ko*\
58 %post -n kernel%{_alt_kernel}-misc-acpi_call\
59 %depmod %{_kernel_ver}\
61 %postun -n kernel%{_alt_kernel}-misc-acpi_call\
62 %depmod %{_kernel_ver}\
65 %define build_kernel_pkg()\
66 %build_kernel_modules -m acpi_call\
67 %install_kernel_modules -D installed -m acpi_call -d misc\
70 %{?with_kernel:%{expand:%create_kernel_packages}}
73 %setup -q -n %{pname}-%{version}
77 %{?with_kernel:%{expand:%build_kernel_packages}}
80 rm -rf $RPM_BUILD_ROOT
82 install -d $RPM_BUILD_ROOT
85 install -d $RPM_BUILD_ROOT%{_datadir}/acpi_call
86 cp -a examples/* $RPM_BUILD_ROOT%{_datadir}/acpi_call
90 cp -a installed/* $RPM_BUILD_ROOT
94 rm -rf $RPM_BUILD_ROOT
97 %files -n %{pname}-scripts
98 %defattr(644,root,root,755)
99 %attr(755,root,root) %{_datadir}/acpi_call/*.sh