diff options
Diffstat (limited to 'rhel/openvswitch-kmod-rhel5.spec.in')
-rw-r--r-- | rhel/openvswitch-kmod-rhel5.spec.in | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/rhel/openvswitch-kmod-rhel5.spec.in b/rhel/openvswitch-kmod-rhel5.spec.in new file mode 100644 index 00000000..f1bc02ef --- /dev/null +++ b/rhel/openvswitch-kmod-rhel5.spec.in @@ -0,0 +1,85 @@ +# Spec file for Open vSwitch kernel modules on Red Hat Enterprise +# Linux 5. + +# Copyright (C) 2009, 2010, 2011 Nicira Networks, 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-l26="$KSRC" + %{__make} -C datapath/linux-2.6 %{?_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-2.6 +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} |