File gfs2.spec of Package gfs2

#
# spec file for package ocfs2
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

%ifarch x86_64
%define buildrt 0
%endif

Url:            http://oss.oracle.com/projects/ocfs2/

Name:           gfs2
BuildRequires:  kernel-syms module-init-tools
BuildRequires:	kernel-source
%if 0%{?buildrt} == 1
BuildRequires:  kernel-syms-rt
%endif
Group:          System/Kernel
AutoReqProv:    on
Summary:        Global File System 2 kernel modules
Version:        3.1.6
Release:        0.<RELEASE16>
License:        GPL-2.0
Source1:        Module.supported
Source2:        COPYING
Source3:        Makefile
Source4:        preamble

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%kernel_module_package -p %_sourcedir/preamble

%description
GFS2 is Global File System, a shared disk filesystem for clusters.

This package contains the GFS2 kernel modules.



%prep
%setup -cTn %{name}-%{version}

#
# standard kernel and -rt kernels have seperate source roots, copy
# from each one seperately.
#
kern_src=/usr/src/linux
src_root=gfs2/fs/

mkdir -p $src_root
cp -a $kern_src/fs/gfs2/ $src_root

%if 0%{?buildrt} == 1
rt_kern_src=/usr/src/linux-rt
rt_src_root=gfs2-rt/fs/

mkdir -p $rt_src_root
cp -a $rt_kern_src/fs/gfs2/ $rt_src_root
%endif

#
# Likewise, we have to apply patches seperately to each copied source
# tree. The majority of patches should come through git anyway. This
# is here mostly to make debug patches easier to test.
#

cd gfs2
# Place %patchN directives on the lines immediately following this comment.
cd ..

%if 0%{?buildrt} == 1
cd gfs2-rt
# Place %patchN directives for -rt kernel on the lines immediately following this comment.
cd ..
%endif

%build
for flavor in %flavors_to_build; do
    mkdir -p $flavor

    src=gfs2
    rt=`echo $flavor | cut -b -2`
    if [ $rt != "rt" ] ; then
	src=gfs2;
    else
	src=gfs2-rt;
    fi

    cp -a $src/fs/gfs2/ $flavor/
    cp -a $RPM_SOURCE_DIR/Module.supported $RPM_SOURCE_DIR/Makefile $flavor/
    make -C %{kernel_source $flavor} modules M=$PWD/$flavor
done

%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates/%name
for flavor in %flavors_to_build; do
    make -C %{kernel_source $flavor} modules_install \
	 M=$PWD/$flavor
done

%changelog
openSUSE Build Service is sponsored by