File iproute2.spec of Package iproute2

# spec file for package iproute2
# 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

Name:           iproute2
Version:        3.12
Release:        0
%define rversion	3.12.0
Summary:        Linux network configuration utilities
License:        GPL-2.0
Group:          Productivity/Networking/Routing
# Using GPL-2.0 instead of GPL-2.0+ because of tc_skbedit.h and tc/q_multiq.c

#Git-Clone:	git://
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:         update-kernel-headers-for-bonding-support.patch
Patch7:         iplink-add-support-for-bonding-netlink.patch
Patch8:         iproute2-finish-support-for-bonding-attributes.patch
Patch9:         iplink_bond-fix-arp_all_targets-parameter-name-in-ou.patch
Patch10:        introduce-support-for-slave-info-data.patch
Patch11:        iplink-add-support-for-bonding-slave.patch
Patch12:        iplink_bond-fix-parameter-value-matching.patch
Patch13:        iplink_bond_slave-show-mii_status-only-once.patch
Patch14:        veth-fix-uninitialized-arguments.patch
Patch15:        Handle-netdev-group-for-veth-peer-too.patch
Patch16:        iproute-Fix-Netid-value-for-multi-families-output.patch
Patch17:        bridge-fix-reporting-of-IPv6-addresses.patch
Patch18:        veth-Handle-flags-correctry.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bison
BuildRequires:  db-devel
BuildRequires:  flex
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
#BuildRequires:  linux-glibc-devel >= 2.6.15
BuildRequires:  ghostscript-x11
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:  xorg-x11-devel
BuildRequires:  xz
BuildRequires:  tex(english.ldf)
%define with_xt 1
%if 0%{?with_xt}
BuildRequires:  pkgconfig(xtables) >= 1.4.11
Provides:       iproute = %version-%release

This package provides the tools ip, tc, and rtmon needed to use the new
and advanced routing options of the Linux kernel. The SUSE Linux
distribution has used this package for network setup since SuSE Linux

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

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

%{?gpg_verify: xz -dfk "%{S:0}"; %gpg_verify %{S:2}}
%if 0%{?__xz:1}
%setup -qn %name-%rversion
tar -xf "%{S:0}" --use=xz;
%setup -DTqn %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
find . -name *.orig -delete

# build with -fPIC. For details see
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 -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/";
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";
ln -s "%_sbindir/ip" "$b/sbin";
mkdir -p "$b/bin";
ln -sf "%_sbindir/ip" "$b/bin/ip";
rm "$b/%_sbindir/ifcfg";

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

%dir %_docdir/%name
%dir %_sysconfdir/iproute2
%config(noreplace) %_sysconfdir/iproute2/*
%dir %_datadir/tc

%files doc
%exclude %_docdir/iproute2/README*
%exclude %_docdir/iproute2/COPYING

%files -n libnetlink-devel