forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
openvswitch-kmod-rhel6.spec.in
78 lines (62 loc) · 2.41 KB
/
openvswitch-kmod-rhel6.spec.in
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
# Spec file for Open vSwitch kernel modules on Red Hat Enterprise
# Linux 6.
# Copyright (C) 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 oname openvswitch
Name: %{oname}-kmod
Version: @VERSION@
Release: 1%{?dist}
Summary: Open vSwitch kernel module
Group: System/Kernel
License: GPLv2
URL: http://openvswitch.org/
Source0: %{oname}-%{version}.tar.gz
Source1: %{oname}-kmod.files
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: %kernel_module_package_buildreqs
# Without this we get an empty openvswitch-debuginfo package (whose name
# conflicts with the openvswitch-debuginfo package for OVS userspace).
%undefine _enable_debug_packages
# Use -D 'kversion 2.6.32-131.6.1.el6.x86_64' to build package
# for specified kernel version.
%{?kversion:%define kernel_version %kversion}
# Use -D 'kflavors default debug kdump' to build packages for
# specified kernel variants.
%{!?kflavors:%define kflavors default}
%kernel_module_package -n %{oname} -f %{SOURCE1} %kflavors
%description
Open vSwitch Linux kernel module.
%prep
%setup -n %{oname}-%{version}
%build
for flavor in %flavors_to_build; do
mkdir _$flavor
(cd _$flavor && ../configure --with-linux="%{kernel_source $flavor}")
%{__make} -C _$flavor/datapath/linux %{?_smp_mflags}
done
%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=extra/%{oname}
for flavor in %flavors_to_build ; do
make -C %{kernel_source $flavor} modules_install \
M="`pwd`"/_$flavor/datapath/linux
# Cleanup unnecessary kernel-generated module dependency files.
find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
done
install -d %{buildroot}%{_sysconfdir}/depmod.d/
for module in %{buildroot}/lib/modules/%{kernel_version}/$INSTALL_MOD_DIR/*.ko;
do
modname="$(basename ${module})"
echo "override ${modname%.ko} * extra/%{oname}" >> %{oname}.conf
echo "override ${modname%.ko} * weak-updates/%{oname}" >> %{oname}.conf
done
install -m 644 %{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d/
%files
%defattr(644,root,root)
/etc/depmod.d/%{oname}.conf
%clean
rm -rf $RPM_BUILD_ROOT