File libnfnetlink.spec of Package libnfnetlink

%define realname libnfnetlink
%define realver  1.0.1
%define srcext   tar.bz2

%define so_ver   0

# Common info
Name:          %{realname}%{?so_ver}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1
License:       GPL-2.0+
Group:         System/Libraries
URL:           https://www.netfilter.org/projects/libnfnetlink/
Summary:       Low-level library for netfilter related kernel/userspace communication

# Install-time parameters
Provides:      %{realname}

# Build-time parameters
BuildRequires: pkgconfig
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://www.netfilter.org/projects/libnfnetlink/files/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
libnfnetlink is the low-level library for netfilter related kernel/userspace
communication. It provides a generic messaging infrastructure for in-kernel
netfilter subsystems (such as nfnetlink_log, nfnetlink_queue,
nfnetlink_conntrack) and their respective users and/or management tools
in userspace.

%package -n %{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}-%{release}

%description -n %{realname}-devel
Development files for %{name}

libnfnetlink is the low-level library for netfilter related kernel/userspace
communication. It provides a generic messaging infrastructure for in-kernel
netfilter subsystems (such as nfnetlink_log, nfnetlink_queue,
nfnetlink_conntrack) and their respective users and/or management tools
in userspace.

This library is not meant as a public API for application developers. It is only
used by other netfilter.org projects, such as libnetfilter_log,
libnetfilter_queue or libnetfilter_conntrack.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

%build
%configure \
 --disable-static \
 CFLAGS="%{optflags} %{?gcc_lto}" \
 CXXFLAGS="%{optflags} %{?gcc_lto}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}"
%{__make} %{?_smp_mflags}

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

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING README
%{_libdir}/*.so.%{?so_ver}*

# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/%{realname}.pc
%{_includedir}/%{realname}/
%{_libdir}/*.so
%exclude %{_libdir}/*.la

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog