File libstatgrab.spec of Package libstatgrab

#
# spec file for package libstatgrab
#
# 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

%define soname		6

Name:           libstatgrab
Version:        0.16
Release:        2
Summary:        Interface to System Statistics
Url:            http://www.i-scream.org/libstatgrab/
Source:         ftp://ftp.i-scream.org/pub/i-scream/libstatgrab/libstatgrab-%{version}.tar.gz
Source1:        statgrab.desktop
Source2:        saidar.desktop
Patch1:         libstatgrab-os-linux.diff
Patch2:         libstatgrab-link-ncurses.diff
Patch3:         libstatgrab-fix-include-ncurses.patch
Group:          Development/Libraries/C and C++
License:        GNU Library General Public License (LGPL)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gcc glibc-devel make ncurses-devel
BuildRequires:  autoconf automake libtool update-desktop-files

%description
The libstatgrab library provides an easy-to-use interface for accessing system
statistics and information.
Available statistics include CPU, Load, Memory, Swap, Disk I/O, and Network
I/O. It was developed to work on Linux, FreeBSD, and Solaris.

The package also includes two tools: saidar provides a curses-based interface
for viewing live system statistics, and statgrab is a sysctl-like interface to
the statistics.

%package -n libstatgrab%{soname}


Summary:        Library for %{name}
Group:          Development/Libraries/C and C++
License:        GNU Library General Public License (LGPL)

%description -n libstatgrab%{soname}
Library for package %{name}.

%package devel
Summary:        Development Environment for %{name}
Requires:       libstatgrab%{soname} = %{version}-%{release}
Group:          Development/Libraries/C and C++
License:        GNU Library General Public License (LGPL)

%description devel
Development environment for %{name} (headers, library links, static library).

%package -n statgrab
Summary:        Portable System Statistics Tools
Requires:       libstatgrab%{soname} = %{version}-%{release}
Group:          System/Monitoring
License:        GNU General Public License (GPL)

%description -n statgrab
This package includes a couple of useful tools that use the %{name} library.
- statgrab: gives a sysctl-style interface to the statistics gathered by libstatgrab
This extends the use of libstatgrab to people writing scripts or anything else
that can't easily make C function calls.
Included with this package is a script to generate an MRTG configuration file
to use statgrab.

%package -n saidar
Summary:        Portable System Statistics Tools
Requires:       libstatgrab%{soname} = %{version}-%{release}
Group:          System/Monitoring
License:        GNU General Public License (GPL)

%description -n saidar
This package includes a couple of useful tools that use the %{name} library.
- saidar: provides a curses-based interface to viewing the current state of the system
This extends the use of libstatgrab to people writing scripts or anything else
that can't easily make C function calls.

%prep
%setup -q -n "libstatgrab-%{version}"
%patch1
%patch2
%patch3

%build
autoreconf -fiv

%configure \
        --disable-static \
	--with-ncurses \
	--disable-setuid-binaries \
	--disable-setgid-binaries \
	--disable-examples \
	--enable-statgrab \
	--enable-saidar \
	--enable-manpages

%__make %{?jobs:-j%{jobs}}

%install
%makeinstall
%{__rm} %{buildroot}%{_libdir}/libstatgrab.la

%__install -d  "%{buildroot}%{_datadir}/applications"
%__install -m 0644 "%{SOURCE1}" "%{buildroot}%{_datadir}/applications/"
%__install -m 0644 "%{SOURCE2}" "%{buildroot}%{_datadir}/applications/"
%suse_update_desktop_file -r saidar System Monitor
%suse_update_desktop_file -r statgrab System Monitor

# prepare doc files
%__install -d "%{buildroot}%{_docdir}/%{name}"
for f in AUTHORS ChangeLog COPYING* README NEWS PLATFORMS; do
	%__install -m0644 "$f" "%{buildroot}%{_docdir}/%{name}/"
done

%__rm -rf examples/Makefile* examples/.deps
%__mv examples "%{buildroot}%{_docdir}/%{name}/"

%clean
%__rm -rf "%{buildroot}"

%post -n libstatgrab%{soname} -p /sbin/ldconfig

%postun -n libstatgrab%{soname} -p /sbin/ldconfig

%files -n libstatgrab%{soname}
%defattr(-,root,root)
%{_libdir}/libstatgrab.so.*

%files devel
%defattr(-,root,root)
%doc %{_docdir}/%{name}
%{_includedir}/statgrab.h
%{_includedir}/statgrab_deprecated.h
%{_libdir}/pkgconfig/libstatgrab.pc
%{_libdir}/libstatgrab.so
%doc %{_mandir}/man3/sg_*.3*
%doc %{_mandir}/man3/statgrab.3*

%files -n statgrab
%defattr(-,root,root)
%doc COPYING
%{_bindir}/statgrab
%{_bindir}/statgrab-make-mrtg-config
%{_bindir}/statgrab-make-mrtg-index
%doc %{_mandir}/man1/statgrab.1*
%doc %{_mandir}/man1/statgrab-make-mrtg-config.1*
%doc %{_mandir}/man1/statgrab-make-mrtg-index.1*
%{_datadir}/applications/statgrab.desktop

%files -n saidar
%defattr(-,root,root)
%doc COPYING
%{_bindir}/saidar
%doc %{_mandir}/man1/saidar.1*
%{_datadir}/applications/saidar.desktop

# Local Variables:
# mode: rpm-spec
# tab-width: 3
# End:

%changelog