File iproute2-doc.spec of Package iproute2

# spec file for package iproute2-doc
# 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-doc
Version:        4.3
Release:        0
%define rversion 4.3.0
Summary:        Documentation to iproute2
License:        GPL-2.0+
Group:          Documentation/Other

Patch1:         iproute2-3.16.0-fix-bashisms.patch
BuildArch:      noarch
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:  tex(english.ldf)
%define with_xt 1
%if 0%{?with_xt}
#BuildRequires:  pkgconfig(libmnl)
BuildRequires: libmnl-devel
#BuildRequires:  pkgconfig(xtables) >= 1.4.11
BuildRequires: iptables-devel

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

%setup -qn iproute2-%rversion
%patch1 -p1

# 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

make install DESTDIR="%buildroot" LIBDIR="%_libdir" \
    MODDESTDIR="$b/%_libdir/tc" DOCDIR="%_docdir/iproute2"

mkdir -p "%buildroot/%_docdir/iproute2";
cp -an ip/{ifcfg,routef,routel} doc/*.pdf "%buildroot/%_docdir/iproute2/"

mkdir "$t"
mv "%buildroot/%_docdir" "$t/"
rm -rf "%buildroot"/*
mkdir -p "%buildroot/%_docdir"
mv "$t/packages"/* "%buildroot/%_docdir"
rm -rf "$t"