File iproute2.spec of Package iproute2

# spec file for package iproute2
# Copyright (c) 2015 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

Name:           iproute2
Version:        4.3
Release:        0
%define rversion 4.3.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://
Source667:      %name.keyring
Patch1:         iproute2-dirs.diff
Patch2:         iproute2-HZ.diff
Patch3:         revert-pdf-creation.diff
Patch4:         revert-bison-fix.diff
Patch5:         kernel_xfrm6_raw.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bison
BuildRequires:  db-devel
BuildRequires:  flex
BuildRequires:  pkgconfig >= 0.21
BuildRequires:  xz
%define with_xt 1
%if 0%{?with_xt}
#BuildRequires:  pkgconfig(libmnl)
BuildRequires: libmnl-devel
#BuildRequires:  pkgconfig(libselinux)
BuildRequires: libselinux-devel
#BuildRequires:  pkgconfig(xtables) >= 1.4.11
BuildRequires: iptables-devel
Provides:       iproute = %version-%release
Provides:       %name(xfrm6_raw) = %version-%release

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.

%setup -qn %name-%rversion
%patch -P 1 -P 2 -p1
%if 0%{?sles_version} == 11 || (0%{?suse_version} && 0%{?suse_version} <= 1220)
%patch -P 3 -p1
%if 0%{?sles_version} == 11
%patch -P 4 -p1
%patch -P 5 -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"

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";
# packaged in iproute2-doc:
rm -rf $b/%_docdir/%name/*
cp -an README* COPYING "$b/%_docdir/%name/"

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

%files -n libnetlink-devel