File drbd9.spec of Package drbd-kernel

# spec file for package drbd
# Copyright (c) 2015 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

# needssslcertforbuild

%ifarch x86_64
%define buildrt 0

Name:           drbd
Version:        9.0.1+git.ded61af
Release:        0
Summary:        DRBD driver for Linux
License:        GPL-2.0
Group:          System/Kernel
Source:         %{name}-%{version}.tar.bz2
Source1:        drbd_git_revision
BuildRequires:  kernel-source
BuildRequires:  kernel-syms
BuildRequires:  module-init-tools
Requires:       drbd-utils >= 8.9.6
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%if 0%{?buildrt} == 1
BuildRequires:  kernel-source-rt
BuildRequires:  kernel-syms-rt

Drbd is a distributed replicated block device. It mirrors a block
device over the network to another machine. Think of it as networked
raid 1. It is a building block for setting up clusters.

%package KMP
Summary:        Kernel driver for DRBD
Group:          Productivity/Clustering/HA

%description KMP
This module is the kernel-dependent driver for DRBD.  This is split out so
that multiple kernel driver versions can be installed, one for each
installed kernel.

%setup -q

mkdir source
cp -a drbd/. source/. || :
cp $RPM_SOURCE_DIR/drbd_git_revision source/.drbd_git_revision
# cp source/Makefile-2.6 source/Makefile
# WIP cp -a %_sourcedir/Module.supported source/
mkdir obj

export EXTRA_CFLAGS='-DVERSION=\"%{version}\"'

for flavor in %flavors_to_build; do
	rm -rf $flavor
	cp -r source $flavor
	export DRBDSRC="$PWD/obj/$flavor"
	make -C %{kernel_source $flavor} modules M=$PWD/$flavor

export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
for flavor in %{flavors_to_build}; do
    make -C %{kernel_source $flavor} modules_install \

mkdir -p %{buildroot}/%{_sbindir}
%{__ln_s} -f %{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name}

rm -rf %{buildroot}

%doc ChangeLog