-
Notifications
You must be signed in to change notification settings - Fork 0
/
xpadneo-kmod.spec
83 lines (66 loc) · 3.08 KB
/
xpadneo-kmod.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# buildforkernels macro hint: when you build a new version or a new release
# that contains bugfixes or other improvements then you must disable the
# "buildforkernels newest" macro for just that build; immediately after
# queuing that build enable the macro again for subsequent builds; that way
# a new akmod package will only get build when a new one is actually needed
%define buildforkernels akmod
%global debug_package %{nil}
%global mok_algo sha512
%global mok_key /usr/src/akmods/mok.key
%global mok_der /usr/src/akmods/mok.der
%define __spec_install_post \
%{__arch_install_post}\
%{__os_install_post}\
%{__mod_install_post}
%define __mod_install_post \
if [ $kernel_version ]; then \
find %{buildroot} -type f -name '*.ko' | xargs %{__strip} --strip-debug; \
if [ -f /usr/src/akmods/mok.key ] && [ -f /usr/src/akmods/mok.der ]; then \
find %{buildroot} -type f -name '*.ko' | xargs -L1 /usr/lib/modules/${kernel_version%%___*}/build/scripts/sign-file %{mok_algo} %{mok_key} %{mok_der}; \
fi \
find %{buildroot} -type f -name '*.ko' | xargs xz; \
fi
Name: xpadneo-kmod
Version: 0.9.1
Release: 3%{?dist}
Summary: Advanced Linux Driver for Xbox One Wireless Gamepad
License: GPLv3
URL: https://atar-axis.github.io/xpadneo
Source0: https://github.com/atar-axis/xpadneo/archive/refs/tags/v%{version}.tar.gz#/xpadneo-%{version}.tar.gz
# get the needed BuildRequires (in parts depending on what we build for)
BuildRequires: kmodtool
# kmodtool does its magic here
%{expand:%(kmodtool --target %{_target_cpu} --repo negativo17.org --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
Advanced Linux Driver for Xbox One Wireless Gamepad.
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo negativo17.org --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
%autosetup -p0 -n xpadneo-%{version}
for kernel_version in %{?kernel_versions}; do
mkdir _kmod_build_${kernel_version%%___*}
cp -fr hid-xpadneo/src/* _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions}; do
pushd _kmod_build_${kernel_version%%___*}/
%make_build -C "${kernel_version##*___}" M=$(pwd) VERSION="v%{version}" modules
popd
done
%install
for kernel_version in %{?kernel_versions}; do
mkdir -p %{buildroot}/%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
install -p -m 0755 _kmod_build_${kernel_version%%___*}/*.ko \
%{buildroot}/%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
done
%{?akmod_install}
%changelog
* Tue Sep 14 2021 Simone Caronni <negativo17@gmail.com> - 0.9.1-3
- Add automatic signing workaround.
* Wed Aug 18 2021 Simone Caronni <negativo17@gmail.com> - 0.9.1-2
- Add module stripping.
- Fix module compression.
* Mon Aug 16 2021 Simone Caronni <negativo17@gmail.com> - 0.9.1-1
- First build.