File libnl3.spec of Package libnl

%define realname libnl
%define realver  3.7.0
%define srcext   tar.gz

%define git_tag  libnl3_7_0

%define gen      3
%define so_ver   200

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}%{gen}%{?so_ver:-%{so_ver}}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?dist}
License:       LGPL-2.1
Group:         System/Libraries
URL:           http://www.infradead.org/~tgr/libnl/
Summary:       Netlink Protocol Library Suite

# Install-time parameters
Provides:      %{realname}%{gen}

# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: pkgconfig bison flex
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://github.com/thom311/libnl/archive/refs/tags/%{git_tag}.%{srcext}#/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
The libnl suite is a collection of libraries providing APIs to netlink protocol
based Linux kernel interfaces.

Netlink is a IPC mechanism primarly between the kernel and user space processes.
It was designed to be a more flexible successor to ioctl to provide mainly
networking related kernel configuration and monitoring interfaces.

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

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

%package -n libnl-tools
Group:         Productivity/Networking/System
Summary:       Utilities using netlink protocol

%description -n libnl-tools
Utilities using netlink protocol.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{git_tag}
if [ ! -x configure ]; then
    autoreconf -i
fi

%build
_CFLAGS='%{optflags} %{?gcc_lto}'
#_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%configure \
 --disable-static \
 --disable-debug \
 CFLAGS="$_CFLAGS" \
 CXXFLAGS="$_CFLAGS" \
 LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}

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

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

%files
%defattr(-,root,root)
%license COPYING
%dir %{_sysconfdir}/%{realname}
%config(noreplace) %{_sysconfdir}/%{realname}/*
%{_libdir}/*-%{gen}.so.%{?so_ver}*
%dir %{_libdir}/%{realname}/cli/cls
%dir %{_libdir}/%{realname}/cli/qdisc
%dir %{_libdir}/%{realname}/cli
%dir %{_libdir}/%{realname}
%{_libdir}/%{realname}/cli/cls/*.so
%{_libdir}/%{realname}/cli/qdisc/*.so
%exclude %{_libdir}/%{realname}/cli/cls/*.la
%exclude %{_libdir}/%{realname}/cli/qdisc/*.la

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

# Tools
%files -n libnl-tools
%defattr(-,root,root)
%{_bindir}/*
%doc %{_mandir}/man8/*

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

%changelog
openSUSE Build Service is sponsored by