File libsysactivity.spec of Package libsysactivity

# norootforbuild

Name:               libsysactivity
Version:            0.6.0
%define soname 1
Release:            0
Summary:            Lightweight and Portable Library for System Activity Statistics
Source:             http://prdownloads.sourceforge.net/libsysactivity/libsysactivity-%{version}.tar.gz
Patch1:             %{name}-optflags.patch
URL:                http://sourceforge.net/projects/libsysactivity/
Group:              System/Libraries
License:            GNU General Lesser Public License version 2.1 or later (LGPL v2.1 or later)
BuildRoot:          %{_tmppath}/build-%{name}-%{version}
BuildRequires:      cmake
BuildRequires:      gcc make glibc-devel

%description
A lightweight library that retrieves statistics of the system's activity in a
portable and thread safe way. In each OS that it supports it offers the same
API for retrieving the activity of: hard disks, CPUs, memory, processes and
network interfaces.

%package -n %{name}%{soname}
Summary:            Lightweight and Portable Library for System Activity Statistics
Group:              System/Libraries

%description -n %{name}%{soname}
A lightweight library that retrieves statistics of the system's activity in a
portable and thread safe way. In each OS that it supports it offers the same
API for retrieving the activity of: hard disks, CPUs, memory, processes and
network interfaces.

%package -n %{name}-devel
Summary:            Lightweight and Portable Library for System Activity Statistics
Group:              Development/Libraries/C and C++
Requires:           %{name}%{soname} = %{version}

%description -n %{name}-devel
A lightweight library that retrieves statistics of the system's activity in a
portable and thread safe way. In each OS that it supports it offers the same
API for retrieving the activity of: hard disks, CPUs, memory, processes and
network interfaces.

%prep
%setup -q

%build
%__rm -rf build
%__mkdir build
pushd build
OPTFLAGS="%{optflags}" \
cmake \
    -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
%if "%{_lib}"=="lib64"
    -DLIB_SUFFIX=64 \
%endif
    -DCMAKE_VERBOSE_MAKEFILE=TRUE \
    -DCMAKE_STRIP=/usr/bin/touch \
    -DCMAKE_C_FLAGS="%{optflags}" \
    -DCMAKE_C_FLAGS_RELEASE="%{optflags}" \
    -DCMAKE_BUILD_TYPE=release \
    ..
%__make %{?jobs:-j%{jobs}}
popd #build

%install
pushd build
%makeinstall
popd #build

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

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

%files -n %{name}%{soname}
%defattr(-,root,root)
%doc CHANGELOG COPYING
%{_libdir}/libsysactivity.so.%{soname}
%{_libdir}/libsysactivity.so.%{version}

%files -n %{name}-devel
%defattr(-,root,root)
%{_includedir}/libsysactivity
%{_libdir}/libsysactivity.so
%dir %{_libdir}/cmake
%{_libdir}/cmake/libsysactivity

%changelog
# vim: set sw=4 ts=4 et nu: