blob: ae73ea6ce8fbb78c763bae0b76a70754a89df269 (
plain)
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
84
85
|
# Spec file for Open vSwitch kernel modules on Red Hat Enterprise
# Linux 5.
# Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without warranty of any kind.
%define kmod_name openvswitch
%{!?kversion: %define kversion 2.6.18-238.12.1.el5}
Name: %{kmod_name}-kmod
Version: @VERSION@
Release: 1%{?dist}
Group: System Environment/Kernel
License: GPLv2
Summary: Open vSwitch kernel modules
URL: http://openvswitch.org/
BuildRequires: redhat-rpm-config
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build-%(%{__id_u} -n)
ExclusiveArch: i686 x86_64
# Sources.
Source0: %{kmod_name}-%{version}.tar.gz
Source10: kmodtool-%{kmod_name}-el5.sh
# Define the variants for each architecture.
%define basevar ""
%ifarch i686
%define paevar PAE
%endif
%ifarch i686 x86_64
%define xenvar xen
%endif
# If kvariants isn't defined on the rpmbuild line, build all variants for this architecture.
%{!?kvariants: %define kvariants %{?basevar} %{?xenvar} %{?paevar}}
# Magic hidden here.
%{expand:%(sh %{SOURCE10} rpmtemplate_kmp %{kmod_name} %{kversion} %{kvariants})}
# Disable the building of the debug package(s).
%define debug_package %{nil}
# Define the filter.
%define __find_requires sh %{_builddir}/%{buildsubdir}/filter-requires.sh
%description
Open vSwitch Linux kernel module.
%prep
%setup -q -c -T -a 0
for kvariant in %{kvariants} ; do
%{__cp} -a %{kmod_name}-%{version} _kmod_build_$kvariant
done
echo "/usr/lib/rpm/redhat/find-requires | %{__sed} -e '/^ksym.*/d'" > filter-requires.sh
echo "override %{kmod_name} * weak-updates/%{kmod_name}" > kmod-%{kmod_name}.conf
%build
for kvariant in %{kvariants} ; do
KSRC=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu}
cd _kmod_build_$kvariant
../openvswitch-%{version}/configure --with-linux="$KSRC"
%{__make} -C datapath/linux %{?_smp_mflags}
cd ..
done
%install
%{__rm} -rf %{buildroot}
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=extra/%{kmod_name}
for kvariant in %{kvariants} ; do
KSRC=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu}
%{__make} -C "${KSRC}" modules_install M="`pwd`"/_kmod_build_$kvariant/datapath/linux
done
%{__install} -d %{buildroot}%{_sysconfdir}/depmod.d/
%{__install} kmod-%{kmod_name}.conf %{buildroot}%{_sysconfdir}/depmod.d/
# Set the module(s) to be executable, so that they will be stripped when packaged.
find %{buildroot} -type f -name \*.ko -exec %{__chmod} u+x \{\} \;
%clean
%{__rm} -rf %{buildroot}
|