iproute2/iproute2.spec

175 lines
5.0 KiB
RPMSpec

#
# spec file for package iproute2
#
# Copyright (c) 2012 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 http://bugs.opensuse.org/
#
Name: iproute2
Version: 3.7.0
Release: 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: %name-%version.tar.xz
Source2: %name-%version.tar.sign
Patch1: iproute2-dirs.diff
Patch2: iproute2-HZ.diff
Patch3: revert-pdf-creation.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: bison
BuildRequires: db-devel
BuildRequires: flex
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: pkgconfig >= 0.21
BuildRequires: xorg-x11-devel
BuildRequires: xz
%if 0%{?suse_version}
BuildRequires: ghostscript-x11
BuildRequires: sgmltool
%endif
BuildRequires: texlive
BuildRequires: texlive-latex
%if 0%{?suse_version} > 1220
BuildRequires: texlive-amsfonts
BuildRequires: texlive-cm-super
BuildRequires: texlive-dvips
BuildRequires: texlive-ec
%endif
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: ghostscript
BuildRequires: linuxdoc-tools
BuildRequires: sgml-common
BuildRequires: tetex-dvips
BuildRequires: tetex-latex
%endif
%define with_xt 1
%if 0%{?with_xt}
%if 0%{?suse_version} >= 1140
BuildRequires: pkgconfig(xtables) >= 1.4.11
%else
BuildRequires: libxtables-devel >= 1.4.11
%endif
%endif
Provides: iproute = %version-%release
%description
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
8.0.
%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
%if 0%{?suse_version} >= 1130
BuildArch: noarch
%endif
%description doc
This package contains the PDF documentation from iproute2,
as well as examples and other outdated files.
%prep
%if 0%{?__xz:1}
%setup -qn iproute-%version
%else
tar -xf "%{S:0}" --use=xz;
%setup -DTqn iproute-%version
%endif
%patch -P 1 -P 2 -p1
%if 0%{?sles_version} == 11 || (0%{?suse_version} && 0%{?suse_version} <= 1220)
%patch -P 3 -p1
%endif
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 -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 doc/*.pdf ip/{ifcfg,routef,routel} \
"$b/%_docdir/%name/";
%files
%defattr(-,root,root)
%dir %_docdir/%name
%_docdir/%name/README*
%_docdir/%name/COPYING
%_sbindir/*
#UsrMerge
/sbin/*
/bin/ip
#EndUsrMerge
%_mandir/man8/*
%dir %_sysconfdir/iproute2
%config(noreplace) %_sysconfdir/iproute2/*
%_libdir/tc
%dir %_datadir/tc
%attr(644,root,root)%_datadir/tc/*
%files doc
%defattr(-,root,root)
%_docdir/iproute2
%exclude %_docdir/iproute2/README*
%exclude %_docdir/iproute2/COPYING
%files -n libnetlink-devel
%defattr(-,root,root)
%_includedir/*
%_mandir/man3/libnetlink*
%_libdir/lib*
%changelog