1 |
# define driver name, version and release |
2 |
%define drvname virtualbox |
3 |
%define drvver 4.1.24 |
4 |
%define drvrel 1.mga2 |
5 |
|
6 |
# define core kernel version we build against |
7 |
%define kernver 3.4.24 |
8 |
%define kernrel 3.mga2 |
9 |
|
10 |
# where to build |
11 |
%define topdir ${RPM_BUILD_DIR}/%{name}-%{_arch} |
12 |
|
13 |
# source package |
14 |
Name: kmod-%{drvname} |
15 |
Version: %{drvver} |
16 |
Release: %mkrel 2 |
17 |
Summary: Prebuilt %{drvname} modules for kernel-%{kernver}-%{kernrel} |
18 |
License: GPLv2 |
19 |
URL: http://www.virtualbox.org/ |
20 |
Group: System/Kernel and hardware |
21 |
ExclusiveArch: %{ix86} x86_64 |
22 |
|
23 |
BuildRequires: dkms-%{drvname} = %{drvver}-%{drvrel} |
24 |
%ifarch %{ix86} |
25 |
BuildRequires: kernel-desktop586-devel-%{kernver}-%{kernrel} |
26 |
%endif |
27 |
BuildRequires: kernel-desktop-devel-%{kernver}-%{kernrel} |
28 |
BuildRequires: kernel-netbook-devel-%{kernver}-%{kernrel} |
29 |
BuildRequires: kernel-server-devel-%{kernver}-%{kernrel} |
30 |
|
31 |
%description |
32 |
This package creates prebuilt %{drvname} kernel modules for core kernel. |
33 |
|
34 |
|
35 |
|
36 |
##### mkflavour() ala core kernel ##### |
37 |
%define mkflavour() \ |
38 |
%package -n %{drvname}-kernel-%{kernver}-%{1}-%{kernrel} \ |
39 |
Summary: %{drvname} driver for kernel-%{1}-%{kernver}-%{kernrel} \ |
40 |
License: GPLv1 \ |
41 |
URL: http://www.virtualbox.org/ \ |
42 |
Group: System/Kernel and hardware \ |
43 |
Requires(post): dkms-minimal \ |
44 |
Requires(preun): dkms-minimal \ |
45 |
Requires: kernel-%{1}-%{kernver}-%{kernrel} \ |
46 |
Requires(post): kernel-%{1}-%{kernver}-%{kernrel} \ |
47 |
Requires(preun): kernel-%{1}-%{kernver}-%{kernrel} \ |
48 |
Suggests: %{drvname}-kernel-%{1}-latest \ |
49 |
%ifarch %{ix86} \ |
50 |
Conflicts: arch(x86_64) \ |
51 |
%endif \ |
52 |
\ |
53 |
%description -n %{drvname}-kernel-%{kernver}-%{1}-%{kernrel} \ |
54 |
Prebuilt dkms binary kernel modules for the %{drvname} driver version %{drvver} \ |
55 |
built for kernel-%{1}-%{kernver}-%{kernrel}. \ |
56 |
\ |
57 |
%files -n %{drvname}-kernel-%{kernver}-%{1}-%{kernrel} \ |
58 |
%dir /var/lib/dkms-binary/%{drvname}/%{drvver}-%{drvrel}/%{kernver}-%{1}-%{kernrel} \ |
59 |
/var/lib/dkms-binary/%{drvname}/%{drvver}-%{drvrel}/%{kernver}-%{1}-%{kernrel}/* \ |
60 |
\ |
61 |
%post -n %{drvname}-kernel-%{kernver}-%{1}-%{kernrel} \ |
62 |
%{_sbindir}/dkms install --binary -m %{drvname} -v %{drvver}-%{drvrel} -k %{kernver}-%{1}-%{kernrel} --rpm_safe_upgrade \ |
63 |
%{_sbindir}/dkms status -m %{drvname} -v %{drvver}-%{drvrel} \ |
64 |
\ |
65 |
%preun -n %{drvname}-kernel-%{kernver}-%{1}-%{kernrel} \ |
66 |
%{_sbindir}/dkms uninstall --binary -m %{drvname} -v %{drvver}-%{drvrel} -k %{kernver}-%{1}-%{kernrel} --rpm_safe_upgrade \ |
67 |
\ |
68 |
\ |
69 |
%package -n %{drvname}-kernel-%{1}-latest \ |
70 |
Summary: Virtual rpm for latest %{drvname}-kernel-%{1} driver \ |
71 |
License: GPLv2 \ |
72 |
URL: http://www.virtualbox.org/ \ |
73 |
Group: System/Kernel and hardware \ |
74 |
Requires: %{drvname}-kernel-%{kernver}-%{1}-%{kernrel} = %{version}-%{release} \ |
75 |
%ifarch %{ix86} \ |
76 |
Conflicts: arch(x86_64) \ |
77 |
%endif \ |
78 |
\ |
79 |
%description -n %{drvname}-kernel-%{1}-latest \ |
80 |
This package is a virtual rpm that aims to make sure you always have the \ |
81 |
latest prebuilt %{drvname} driver for kernel-%{1}. \ |
82 |
\ |
83 |
%files -n %{drvname}-kernel-%{1}-latest |
84 |
|
85 |
%ifarch %{ix86} |
86 |
%mkflavour desktop586 |
87 |
%endif |
88 |
|
89 |
%mkflavour desktop |
90 |
%mkflavour netbook |
91 |
%mkflavour server |
92 |
|
93 |
|
94 |
%prep |
95 |
rm -rf %{topdir} |
96 |
|
97 |
%build |
98 |
%{_sbindir}/dkms add -m %{drvname} -v %{drvver}-%{drvrel} --dkmstree %{topdir}/var/lib/dkms-binary |
99 |
%ifarch %{ix86} |
100 |
%{_sbindir}/dkms build --no-prepare-kernel --no-clean-kernel -m %{drvname} -v %{drvver}-%{drvrel} \ |
101 |
-k %{kernver}-desktop586-%{kernrel} --kernelsourcedir /usr/src/linux-%{kernver}-desktop586-%{kernrel} \ |
102 |
--dkmstree %{topdir}/var/lib/dkms-binary |
103 |
%endif |
104 |
for flavour in desktop netbook server; do |
105 |
%{_sbindir}/dkms build --no-prepare-kernel --no-clean-kernel -m %{drvname} -v %{drvver}-%{drvrel} \ |
106 |
-k %{kernver}-$flavour-%{kernrel} --kernelsourcedir /usr/src/linux-%{kernver}-$flavour-%{kernrel} \ |
107 |
--dkmstree %{topdir}/var/lib/dkms-binary |
108 |
done |
109 |
|
110 |
%install |
111 |
mkdir -p %{buildroot}/var/lib/dkms-binary/%{drvname}/%{drvver}-%{drvrel} |
112 |
cp -a %{topdir}/var/lib/dkms-binary/%{drvname}/%{drvver}-%{drvrel}/%{kernver}-*-%{kernrel} \ |
113 |
%{buildroot}/var/lib/dkms-binary/%{drvname}/%{drvver}-%{drvrel}/ |
114 |
for dir in %{buildroot}/var/lib/dkms-binary/%{drvname}/%{drvver}-%{drvrel}/%{kernver}-*-%{kernrel}; do |
115 |
cp -a /usr/src/%{drvname}-%{drvver}-%{drvrel}/dkms.conf $dir/ |
116 |
xz -6e $dir/*/module/vbox*.ko |
117 |
done |