File iproute2.spec of Package iproute2.16580

#
# spec file for package iproute2
#
# Copyright (c) 2019 SUSE LINUX 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 https://bugs.opensuse.org/
#

# ---------------------------------------------------------------------------
# Contents of this package is exported from git repository; please submit
# your changes via https://gitlab.suse.de/mkubecek/iproute2-source or
# gitlab@gitlab.suse.de:mkubecek/iproute2-source.git rather than to IBS.
# ---------------------------------------------------------------------------

Name:           iproute2
Version:        5.3
Release:        0
%define rversion 5.3.0
Summary:        Linux network configuration utilities
License:        GPL-2.0-only
Group:          Productivity/Networking/Routing
URL:            http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
# Using GPL-2.0 instead of GPL-2.0+ because of tc_skbedit.h and tc/q_multiq.c

#DL-URL:	http://kernel.org/pub/linux/utils/net/iproute2/
#Git-Clone:	git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2
Source:         http://kernel.org/pub/linux/utils/net/iproute2/%name-%rversion.tar.xz
Source2:        http://kernel.org/pub/linux/utils/net/iproute2/%name-%rversion.tar.sign
Source3:        patches.tar.xz
Source4:        series.conf
Source5:        guards
Source6:        apply-patches
Source667:      %name.keyring
BuildRequires:  bison
BuildRequires:  db-devel
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  libelf-devel
BuildRequires:  pkgconfig >= 0.21
BuildRequires:  xz
%define with_xt 1
%if 0%{?with_xt}
BuildRequires:  pkgconfig(libmnl)
BuildRequires:  pkgconfig(libselinux)
BuildRequires:  pkgconfig(xtables) >= 1.4.11
%endif
Provides:       iproute = %version-%release
Provides:       %name(xfrm6_raw) = %version-%release
Provides:       %{name}-doc = %{version}-%{release}
Obsoletes:      %{name}-doc < %{version}-%{release}

%description
iproute2 is a collection of user-space utilities to set up networking
under Linux from the command-line. It can inspect and configure,
among other things: interface paramters, IP addresses, routing,
tunnels, bridges, packet transformations (IPsec, etc.), and Quality
of Service.

%package -n libnetlink-devel
Summary:        A Higher Level Interface to the Netlink Service
License:        GPL-2.0+
Group:          Development/Libraries/C and C++
Provides:       libnetlink = %version-%release

%description -n libnetlink-devel
libnetlink provides a higher-level interface to rtnetlink(7).
New programs should use libmnl-devel instead.

%package bash-completion
Summary:        Bash completion for iproute
License:        GPL-2.0+
Group:          System/Shells
Requires:       bash-completion

%description bash-completion
bash command line completion support for iproute.

%package arpd
Summary:        Userspace ARP daemon
License:        GPL-2.0-only
Group:          Productivity/Networking/Routing
Provides:       iproute2:/usr/sbin/arpd

%description arpd
The arpd daemon collects gratuitous ARP information, saving it on
local disk and feeding it to the kernel on demand to avoid redundant
broadcasting due to limited standard size (512..1024 entries,
depending on type) of the kernel ARP cache.

%prep
%setup -qn %name-%rversion -a 3
chmod a+rx %{SOURCE5} %{SOURCE6}
%{SOURCE5} <%{SOURCE4} | %{SOURCE6} && rm -rf patches

%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
# build with -fPIC. For details see
# https://bugzilla.novell.com/show_bug.cgi?id=388021
xt_libdir="$(pkg-config xtables --variable=xtlibdir)"
xt_cflags="$(pkg-config xtables --cflags)"
%make_build CCOPTS="-D_GNU_SOURCE %optflags -Wstrict-prototypes -Wno-error -fPIC -DXT_LIB_DIR=\\\"$xt_libdir\\\" $xt_cflags"

%install
b="%buildroot"
install -d "$b"/{etc/,sbin/,usr/{bin,sbin,share/man/man{3,8}}}
install -d "$b"/{/usr/include,%_libdir,/usr/share}
%make_install \
  MODDESTDIR="$b/%_libdir/tc" \
  DOCDIR="%_docdir/%name"
# We have m_xt
rm -f "$b/%_libdir/tc/m_ipt.so"
install -pm0644 "lib/libnetlink.a" "$b/%_libdir/"
chmod -x "$b/%_libdir/libnetlink.a"
install -pm0644 "include/libnetlink.h" "$b/%_includedir/"
chmod -x "$b/%_includedir/libnetlink.h"
#UsrMerge
ln -s "%_sbindir/ip" "$b/sbin"
mkdir -p "$b/bin"
ln -sf "%_sbindir/ip" "$b/bin/ip"
#EndUsrMerge
for BIN in lnstat nstat routef routel ss; do
	ln -sf "%{_sbindir}/$BIN" "$b%{_bindir}/$BIN"
done
rm "$b/%_sbindir/ifcfg"
cp -an README* "$b/%_docdir/%name/"
%fdupes %{buildroot}/%{_prefix}

%files
%defattr(-,root,root)
%_bindir/lnstat
%_bindir/nstat
%_bindir/routef
%_bindir/routel
%_bindir/ss
%_sbindir/*
%exclude %_sbindir/arpd
#UsrMerge
/sbin/*
/bin/ip
#EndUsrMerge
%_mandir/man7/*
%_mandir/man8/*
%exclude %_mandir/man8/arpd.8*
%dir %_sysconfdir/iproute2
%config(noreplace) %_sysconfdir/iproute2/*
%_libdir/tc/
%_datadir/tc/
%_docdir/%name
%license COPYING

%files -n libnetlink-devel
%defattr(-,root,root)
%_includedir/*
%_mandir/man3/libnetlink*
%_libdir/lib*

%files bash-completion
%defattr(-,root,root)
%_datadir/bash-completion/

%files arpd
%_sbindir/arpd
%_mandir/man8/arpd.8*

%changelog
openSUSE Build Service is sponsored by