File libcap-ng.spec of Package libcap-ng

#
# spec file for package libcap-ng
#
# Copyright (c) 2014 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/
#


%{!?python_sitelib:  %global python_sitelib  %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Summary:        An alternate POSIX capabilities library
License:        LGPL-2.1+
Group:          System/Libraries

Name:           libcap-ng
Version:        0.7.3
Release:        0
%define soname 0
%define rname libcap-ng
Url:            http://people.redhat.com/sgrubb/libcap-ng
Source0:        http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-%{version}.tar.gz
Source1:        pre_checkin.sh
Source2:        baselibs.conf
Source99:       libcap-ng.rpmlintrc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  kernel-headers >= 2.6.11
BuildRequires:  libattr-devel
BuildRequires:  pkg-config
%if "%{name}" == "%{rname}-python"
BuildRequires:  python-base
%endif

%description
Libcap-ng is a library that makes using posix capabilities easier

%if "%{name}" == "%{rname}"

%package -n %{name}%{soname}

Summary:        An alternate POSIX capabilities library
License:        LGPL-2.1+
Group:          System/Libraries

%description -n %{name}%{soname}
Libcap-ng is a library that makes using posix capabilities easier

%package devel

Summary:        Header files for libcap-ng library
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Requires:       %{name}%{soname} = %{version}
Requires:       kernel-headers >= 2.6.11
Requires:       pkgconfig

%description devel
The libcap-ng-devel package contains the files needed for developing
applications that need to use the libcap-ng library.

%package utils

Summary:        Utilities for analysing and setting file capabilities
License:        GPL-2.0+
Group:          System/Base

%description utils
The libcap-ng-utils package contains applications to analyse the
posix capabilities of all the program running on a system. It also
lets you set the file system based capabilities.

%else

%package -n python-capng
Summary:        Python bindings for libcap-ng library
License:        LGPL-2.1+
Group:          Development/Libraries/Python
BuildRequires:  python-devel
BuildRequires:  swig
Requires:       %{rname}%{soname} = %{version}
%py_requires

%description -n python-capng
The libcap-ng-python package contains the bindings so that libcap-ng
and can be used by python applications.

%endif

%prep
%setup -q -n %{rname}-%{version}

%build
%if "%{name}" == "%{rname}-python"
%configure --disable-static --with-pic --with-python=yes
%else
%configure --disable-static --with-pic --with-python=no
%endif
%__make %{?_smp_mflags}

%install
%__make DESTDIR="%{buildroot}" install

# Remove a couple things so they don't get picked up
find %{buildroot} -type f -name "*.la" -print -delete

%if "%{name}" == "%{rname}-python"
%__rm -f %{buildroot}%{_libdir}/lib*.so*
%__rm -f %{buildroot}%{_libdir}/lib*.so*
%__rm -rf %{buildroot}%{_libdir}/pkgconfig
%__rm -rf %{buildroot}%{_bindir}
%__rm -rf %{buildroot}%{_mandir}
%__rm -rf %{buildroot}%{_includedir}
%__rm -rf %{buildroot}%{_datadir}/aclocal
%endif

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

%if "%{name}" == "%{rname}"

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

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

%files -n %{name}%{soname}
%defattr(-,root,root,-)
%doc COPYING.LIB
%attr(0755,root,root) %{_libdir}/%{rname}.so.%{soname}
%attr(0755,root,root) %{_libdir}/%{rname}.so.%{soname}.*

%files devel
%defattr(-,root,root,-)
%attr(0644,root,root) %{_mandir}/man3/*.3%{ext_man}
%attr(0644,root,root) %{_includedir}/cap-ng.h
%attr(0755,root,root) %{_libdir}/%{rname}.so
%attr(0644,root,root) %{_datadir}/aclocal/cap-ng.m4
%{_libdir}/pkgconfig/%{rname}.pc

%files utils
%defattr(-,root,root,-)
%doc COPYING
%attr(0755,root,root) %{_bindir}/captest
%attr(0755,root,root) %{_bindir}/filecap
%attr(0755,root,root) %{_bindir}/netcap
%attr(0755,root,root) %{_bindir}/pscap
%attr(0644,root,root) %{_mandir}/man8/*.8%{ext_man}

%else

%files -n python-capng
%defattr(-,root,root,-)
%attr(755,root,root) %{python_sitearch}/_capng.so
%{python_sitearch}/capng.py*

%endif

%changelog
openSUSE Build Service is sponsored by