1 # Spec file for Open vSwitch kernel modules on Red Hat Enterprise
4 # Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc.
6 # Copying and distribution of this file, with or without modification,
7 # are permitted in any medium without royalty provided the copyright
8 # notice and this notice are preserved. This file is offered as-is,
9 # without warranty of any kind.
11 %define kmod_name openvswitch
12 %{!?kversion: %define kversion 2.6.18-238.12.1.el5}
14 Name: %{kmod_name}-kmod
17 Group: System Environment/Kernel
19 Summary: Open vSwitch kernel modules
20 URL: http://openvswitch.org/
22 BuildRequires: redhat-rpm-config
23 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build-%(%{__id_u} -n)
24 ExclusiveArch: i686 x86_64
27 Source0: %{kmod_name}-%{version}.tar.gz
28 Source10: kmodtool-%{kmod_name}-el5.sh
30 # Define the variants for each architecture.
39 # If kvariants isn't defined on the rpmbuild line, build all variants for this architecture.
40 %{!?kvariants: %define kvariants %{?basevar} %{?xenvar} %{?paevar}}
43 %{expand:%(sh %{SOURCE10} rpmtemplate_kmp %{kmod_name} %{kversion} %{kvariants})}
45 # Disable the building of the debug package(s).
46 %define debug_package %{nil}
49 %define __find_requires sh %{_builddir}/%{buildsubdir}/filter-requires.sh
52 Open vSwitch Linux kernel module.
56 for kvariant in %{kvariants} ; do
57 %{__cp} -a %{kmod_name}-%{version} _kmod_build_$kvariant
59 echo "/usr/lib/rpm/redhat/find-requires | %{__sed} -e '/^ksym.*/d'" > filter-requires.sh
60 echo "override %{kmod_name} * weak-updates/%{kmod_name}" > kmod-%{kmod_name}.conf
63 for kvariant in %{kvariants} ; do
64 KSRC=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu}
65 cd _kmod_build_$kvariant
66 ../openvswitch-%{version}/configure --with-linux="$KSRC"
67 %{__make} -C datapath/linux %{?_smp_mflags}
72 %{__rm} -rf %{buildroot}
73 export INSTALL_MOD_PATH=%{buildroot}
74 export INSTALL_MOD_DIR=extra/%{kmod_name}
75 for kvariant in %{kvariants} ; do
76 KSRC=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu}
77 %{__make} -C "${KSRC}" modules_install M="`pwd`"/_kmod_build_$kvariant/datapath/linux
79 %{__install} -d %{buildroot}%{_sysconfdir}/depmod.d/
80 %{__install} kmod-%{kmod_name}.conf %{buildroot}%{_sysconfdir}/depmod.d/
81 # Set the module(s) to be executable, so that they will be stripped when packaged.
82 find %{buildroot} -type f -name \*.ko -exec %{__chmod} u+x \{\} \;
85 %{__rm} -rf %{buildroot}