File iproute2.spec of Package iproute2.7171

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


Name:           iproute2
Version:        4.4
Release:        0
%define rversion 4.4.0
Summary:        Linux network configuration utilities
License:        GPL-2.0
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
Source666:      pre_checkin.sh
Source667:      %name.keyring
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bison
BuildRequires:  db-devel
BuildRequires:  flex
BuildRequires:  pkgconfig >= 0.21
BuildRequires:  sgmltool
BuildRequires:  texlive
BuildRequires:  texlive-amsfonts
BuildRequires:  texlive-cm-super
BuildRequires:  texlive-dvips
BuildRequires:  texlive-ec
BuildRequires:  texlive-latex
BuildRequires:  xz
BuildRequires:  tex(english.ldf)
%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

Patch1:         adjust-installation-directories-for-SLE.patch
Patch2:         use-sysconf-_SC_CLK_TCK-if-HZ-undefined.patch
Patch3:         add-explicit-typecast-to-avoid-gcc-warning.patch
Patch4:         avoid-unused-return-value-gcc-warnings.patch
Patch5:         fix-build-with-D_FORTIFY_SOURCE-2.patch
Patch6:         xfrm-support-displaying-transformations-used-for-Mob.patch
Patch7:         man-fix-documentation-references-in-manual-pages.patch
Patch8:         examples-fix-bashisms-in-example-script.patch
Patch9:         routel-fix-infinite-loop-in-line-parser.patch
Patch10:        iproute-fix-documentation-for-ip-rule-scan-order.patch
Patch11:        iproute-fix-documentation-for-ip-rule-scan-order-2.patch
Patch12:        man-ip-rule.8-Further-clarify-how-to-interpret-prior.patch
Patch13:        man-ip-route.8-Mention-that-lower-metric-means-highe.patch
Patch14:        libnetlink-Double-the-dump-buffer-size.patch
Patch15:        iplink-check-for-message-truncation-in-iplink_get.patch
Patch16:        iplink-double-the-buffer-size-also-in-iplink_get.patch
Patch17:        iplink-bond_slave-fix-ad_actor-partner_oper_port_sta.patch
Patch18:        sync-copies-of-kernel-UAPI-headers-with-SLE12-SP3.patch
Patch19:        iplink-support-setting-addrgenmode-stable_secret.patch
Patch20:        man-iplink-document-new-addrgenmodes.patch
Patch21:        iplink-Support-VF-Trust.patch
Patch22:        man-ip-link.8-Fix-and-improve-synopsis.patch
Patch23:        man-ip-link-Document-query_rss-option.patch
Patch24:        Add-support-for-configuring-Infiniband-GUIDs.patch
Patch25:        ip-link-Add-support-to-configure-SR-IOV-VF-to-vlan-p.patch
Patch26:        iplink-Update-usage-in-help-message.patch

%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 doc
Summary:        Documentation to iproute2
License:        GPL-2.0+
Group:          Documentation/Other
BuildArch:      noarch

%description doc
This package contains the PDF documentation from iproute2,
as well as examples and other outdated files.

%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.

%prep
%setup -qn %name-%rversion
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
find . -name *.orig -delete

%build
# 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 %{?_smp_mflags} LIBDIR="%_libdir" CCOPTS="-D_GNU_SOURCE %optflags -Wstrict-prototypes -Wno-error -fPIC -DXT_LIB_DIR=\\\"$xt_libdir\\\" $xt_cflags"
cd doc
make pdf

%install
b="%buildroot";
install -d "$b"/{etc/,sbin/,usr/{sbin,share/man/man{3,8}}}
install -d "$b"/{/usr/include,%_libdir,/usr/share}
make install DESTDIR="$b" LIBDIR="%_libdir" \
	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
rm "$b/%_sbindir/ifcfg";

mkdir -p "$b/%_docdir/%name";
cp -an README* COPYING ip/{ifcfg,routef,routel} doc/*.pdf "$b/%_docdir/%name/"

%files
%defattr(-,root,root)
%dir %_docdir/%name
%_docdir/%name/README*
%_docdir/%name/COPYING
%_sbindir/*
#UsrMerge
/sbin/*
/bin/ip
#EndUsrMerge
%_mandir/man7/*
%_mandir/man8/*
%dir %_sysconfdir/iproute2
%config(noreplace) %_sysconfdir/iproute2/*
%_libdir/tc/
%_datadir/tc/

%files doc
%defattr(-,root,root)
%_docdir/iproute2
%exclude %_docdir/%name/README*
%exclude %_docdir/%name/COPYING

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

%changelog
openSUSE Build Service is sponsored by