File libcgroup1.spec of Package libcgroup1

#
# spec file for package libcgroup1
#
# Copyright (c) 2011 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:           libcgroup1
Version:        0.37.1
Release:        4
License:        LGPLv2.1
Group:          System/Management
AutoReqProv:    on
Summary:        Control groups management tools
Url:            http://sourceforge.net/projects/libcg/
Source:         http://sourceforge.net/projects/libcg/files/libcgroup/v%{version}/libcgroup-%{version}.tar.bz2
Source3:        sysconfig.cgred
Source99:       baselibs.conf
Patch5:         initd_cgconfig.patch
Patch6:         initd_cgred.patch
Patch7:         libcgroup-man_pages.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bison flex gcc-c++ pam-devel pkg-config
Requires:       insserv pam

%description
Control groups, a new kernel feature in Linux 2.6.24 provides a file
system interface to manipulate and control the details on task grouping
including creation of new task groups (control groups), permission
handling and task assignment.



Authors:
--------
    Balbir Singh <balbir_singh@users.sourceforge.net>
    Dhaval Giani <dhaval_giani@users.sourceforge.net>

%package -n libcgroup-devel
License:        LGPLv2.1
Summary:        Control groups management tools devel package
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%description -n libcgroup-devel
Control groups, a new kernel feature in Linux 2.6.24 provides a file
system interface to manipulate and control the details on task grouping
including creation of new task groups (control groups), permission
handling and task assignment.



Authors:
--------
    Balbir Singh <balbir_singh@users.sourceforge.net>
    Dhaval Giani <dhaval_giani@users.sourceforge.net>

%prep
%setup -n libcgroup-%{version}
%patch5 -p1
%patch6 -p1
%patch7

%build
# only for GIT builds
%if 0
aclocal
libtoolize -c
autoconf
autoheader
automake --foreign --add-missing --copy
%endif
# ==============

%configure --enable-pam-module-dir=/%{_lib}/security --enable-initscript-install
export V=1
make %{?_smp_mflags}

%install
%makeinstall INITSCRIPTDIR=%{buildroot}/%{_sysconfdir}/init.d/
find $RPM_BUILD_ROOT -type f -name '*.la' -exec rm -f {} ';'
rm -f $RPM_BUILD_ROOT/%{_lib}/security/*.so.* 
mkdir -p %{buildroot}/%{_localstatedir}/adm/fillup-templates/
install -m 644 %{SOURCE3} %{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.cgred

# remove setuid
chmod u-s $RPM_BUILD_ROOT/%{_bindir}/cgexec

# move lib to rootfs
libcgso=$(basename $RPM_BUILD_ROOT/%{_libdir}/libcgroup.so.*.*.*)
mkdir -p $RPM_BUILD_ROOT/%{_lib}
mv -f $RPM_BUILD_ROOT/%{_libdir}/libcgroup.so.*.*.* $RPM_BUILD_ROOT/%{_lib}
rm -f $RPM_BUILD_ROOT/%{_libdir}/libcgroup.so.1
ln -sf $libcgso $RPM_BUILD_ROOT/%{_lib}/libcgroup.so.1
ln -sf ../../%{_lib}/$libcgso $RPM_BUILD_ROOT/%{_libdir}/libcgroup.so

%clean
rm -rf %{buildroot}

%preun
%{stop_on_removal cgred}
%{stop_on_removal cgconfig}

%post
%{fillup_and_insserv -f cgconfig}
%{fillup_and_insserv -n cgred}
%{run_ldconfig}

%postun
%{insserv_cleanup}
%{run_ldconfig}

%files
%defattr(-,root,root)
%doc COPYING
%doc README
%doc README_daemon
%doc INSTALL
%doc samples/cgconfig.conf
%doc samples/cgrules.conf
%{_sysconfdir}/init.d/cgconfig
%{_sysconfdir}/init.d/cgred
%{_bindir}/cg*
%{_bindir}/ls*
%{_sbindir}/cg*
/%{_lib}/libcgroup.so.*
/%{_lib}/security/pam_cgroup.so
%{_localstatedir}/adm/fillup-templates/sysconfig.cgred
%{_mandir}/man[^3]/*

%files -n libcgroup-devel
%defattr(-,root,root)
%{_libdir}/libcgroup.so
%{_includedir}/libcgroup.h
%dir %{_includedir}/libcgroup
%{_includedir}/libcgroup/*.h
%{_libdir}/pkgconfig/libcgroup.pc

%changelog
openSUSE Build Service is sponsored by