File libstatgrab.spec of Package libstatgrab

#
# spec file for package libstatgrab
#
# Copyright (c) 2012 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/
#


%define soname		6

Name:           libstatgrab
Version:        0.17
Release:        0
Summary:        Interface to System Statistics
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
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
Source3:        baselibs.conf
Patch1:         libstatgrab-os-linux.diff
Patch2:         libstatgrab-link-ncurses.diff
Patch3:         libstatgrab-fix-include-ncurses.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gcc
BuildRequires:  glibc-devel
BuildRequires:  libtool
BuildRequires:  make
BuildRequires:  ncurses-devel
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig

%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 %{name}%{soname}
Summary:        Library for %{name}
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++

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

%package devel
Summary:        Development Environment for %{name}
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Requires:       %{name}%{soname} = %{version}-%{release}

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

%package -n statgrab
Summary:        Portable System Statistics Tools
License:        GPL-2.0+
Group:          System/Monitoring
Requires:       %{name}%{soname} = %{version}-%{release}

%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
License:        GPL-2.0+
Group:          System/Monitoring
Requires:       %{name}%{soname} = %{version}-%{release}

%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 %{?_smp_mflags}

%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}/"

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

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

%files -n %{name}%{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
openSUSE Build Service is sponsored by