File iscsitarget.spec of Package iscsitarget

#
# spec file for package iscsitarget (Version 0.4.15)
#
# Copyright (c) 2010 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


Name:           iscsitarget
BuildRequires:  kernel-syms module-init-tools openssl-devel
Url:            http://iscsitarget.sourceforge.net
License:        GPL v2 only
Group:          System/Daemons
PreReq:         %fillup_prereq %insserv_prereq /bin/cat /bin/rm
AutoReqProv:    on
Version:        0.4.15
Release:        89.<RELEASE12>
Requires:       iscsitarget-kmp
Summary:        Open Source iSCSI Target with Professional Features
Source:         %{name}-%{version}.tar.gz
Source1:        %{name}.init
Source2:        preamble
Patch1:         %{name}-svn-138.diff
Patch2:         %{name}-svn-174.diff
Patch3:         %{name}-isns-bounds-checking
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%suse_kernel_module_package -n %{name} -p %{S:2} kdump um

%description
The aim of the project is to develop an open source iSCSI target with
professional features that works well in enterprise environment under
real workload and is scalable and versatile enough to meet the
challenge of future storage needs and developments.



Authors:
--------
    iscsitarget-devel@lists.sourceforge.net

%package KMP
Group:          System/Daemons
License:        LGPL v2.1 or later
Summary:        Open Source iSCSI Target with Professional Features

%description KMP
The aim of the project is to develop an open source iSCSI target with
professional features that works well in enterprise environment under
real workload and is scalable and versatile enough to meet the
challenge of future storage needs and developments.



Authors:
--------
    iscsitarget-devel@lists.sourceforge.net

%prep
%setup
%patch1
%patch2
%patch3 -p1

%build
%{__make} CFLAGS="${RPM_OPT_FLAGS} -I../include" bindir=/usr/sbin -C usr
for flavor in %flavors_to_build; do
	rm -rf obj/$flavor
	mkdir -p obj/$flavor
	cp -a kernel/* obj/$flavor
	cp include/iet_u.h obj/$flavor
	make -C /usr/src/linux-obj/%_target_cpu/$flavor modules \
	      M=$PWD/obj/$flavor
done

%install
install -vD usr/ietd ${RPM_BUILD_ROOT}/usr/sbin/ietd
install -vD usr/ietadm ${RPM_BUILD_ROOT}/usr/sbin/ietadm
install -vD -m 600 etc/ietd.conf ${RPM_BUILD_ROOT}/etc/ietd.conf
install -vD -m 755 %{S:1} ${RPM_BUILD_ROOT}/etc/init.d/iscsitarget
install -D -m 644 doc/manpages/ietd.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/ietd.8
install -D -m 644 doc/manpages/ietd.conf.5 ${RPM_BUILD_ROOT}%{_mandir}/man5/ietd.conf.5
ln -sf ../../etc/init.d/iscsitarget $RPM_BUILD_ROOT/usr/sbin/rciscsitarget
# install kernel modules
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
	make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
	      M=$PWD/obj/$flavor
done

%clean
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
rm -f filelist

%post
%{fillup_and_insserv -f iscsitarget}

%preun
%stop_on_removal iscsitarget

%postun
%{insserv_cleanup}

%files
%attr(755,root,root)/usr/sbin/*
%attr(755,root,root)/etc/init.d/*
%defattr(-,root,root)
%config /etc/ietd.conf
%doc COPYING README
%doc %{_mandir}/man5/*
%doc %{_mandir}/man8/*

%changelog