Add BuildRequire for netlink (libnl2-devel)
[platform/upstream/iproute2.git] / packaging / iproute2.spec
1 Name: iproute2
2 Summary: collection of utilities for controlling TCP/IP networking and traffic control in Linux
3 Version: 3.9.0
4 Release: 1
5 Source: %{name}-%{version}.tar.gz
6 Patch1: act_ipt_fix_xtables.patch
7 Patch2: gcc4_8_build_fix.patch
8 Group: System/Base
9 URL: https://www.kernel.org/pub/linux/utils/net/iproute2/
10 License: GPL-2.0+
11 BuildRequires: kernel-headers
12 BuildRequires: bison
13 BuildRequires: flex
14 BuildRequires: db4-devel
15 BuildRequires: pkgconfig(xtables)
16 BuildRequires: libnl2-devel
17 Conflicts: kernel < 2.4.20
18
19 %description
20 The iproute package contains networking utilities (ip, rtmon, tc etc)
21 which are designed to use the advanced networking capabilities of the Linux
22 2.4.x and 2.6.x kernel. Ip controls IPv4 and IPv6 configuration, tc stands
23 for traffic control. Both prints detailed usage. rtmon monitors the routing.
24 table changes.
25
26 %package devel
27 Summary: development files for iproutes libnetlink
28 Group: System/Base
29 License: GPL-2.0+
30 Requires: %{name} = %{version}-%{release}
31
32 %description devel
33 Header files, library and documentation for libnetlink.
34 A library for accessing the netlink service.
35
36 %prep
37 %setup -q
38 %patch1 -p1
39 %patch2 -p1
40
41 %build
42 ./configure
43 make %{?jobs:-j%jobs}
44
45 %install
46 mkdir -p \
47     %{buildroot}%{_includedir} \
48     %{buildroot}%{_sbindir} \
49     %{buildroot}%{_mandir}/man3 \
50     %{buildroot}%{_mandir}/man7 \
51     %{buildroot}%{_mandir}/man8 \
52     %{buildroot}%{_datadir}/tc \
53     %{buildroot}%{_libdir}/tc \
54     %{buildroot}/usr%{_sysconfdir}/iproute2 \
55     %{buildroot}%{_datadir}/license
56
57 for binary in \
58     bridge/bridge \
59     genl/genl \
60     ip/ifcfg \
61     ip/ip \
62     ip/routef \
63     ip/routel \
64     ip/rtmon \
65     ip/rtpr \
66     misc/arpd \
67     misc/ifstat \
68     misc/lnstat \
69     misc/nstat \
70     misc/rtacct \
71     misc/ss \
72     tc/tc
73     do install -m755 ${binary} %{buildroot}%{_sbindir}
74 done
75
76 cd %{buildroot}%{_sbindir}
77     ln -s lnstat ctstat
78     ln -s lnstat rtstat
79 cd -
80
81 # Libs
82 install -m755 tc/m_xt.so %{buildroot}%{_libdir}/tc
83 cd %{buildroot}%{_libdir}/tc
84     ln -s m_xt.so m_ipt.so
85 cd -
86
87 # libnetlink
88 install -m644 include/libnetlink.h %{buildroot}%{_includedir}
89 install -m644 lib/libnetlink.a %{buildroot}%{_libdir}
90
91 # Manpages
92 iconv -f latin1 -t utf8 man/man8/ss.8 > man/man8/ss.8.utf8 &&
93     mv man/man8/ss.8.utf8 man/man8/ss.8
94 install -m644 man/man3/*.3 %{buildroot}%{_mandir}/man3
95 install -m644 man/man7/*.7 %{buildroot}%{_mandir}/man7
96 install -m644 man/man8/*.8 %{buildroot}%{_mandir}/man8
97
98 # Share files
99 for shared in \
100     netem/normal.dist \
101     netem/pareto.dist \
102     netem/paretonormal.dist
103     do install -m644 ${shared} %{buildroot}%{_datadir}/tc
104 done
105
106 # Config files
107 install -m644 etc/iproute2/* %{buildroot}/usr%{_sysconfdir}/iproute2
108
109 cp COPYING %{buildroot}%{_datadir}/license/iproute2
110 cp COPYING %{buildroot}%{_datadir}/license/iproute2-devel
111
112 %clean
113 rm -rf $RPM_BUILD_ROOT
114
115 %post
116 /sbin/ldconfig
117
118 %postun -p /sbin/ldconfig
119
120 %files
121 %manifest iproute2.manifest
122 %dir /usr%{_sysconfdir}/iproute2
123 %attr(644,root,root) %config(noreplace) /usr%{_sysconfdir}/iproute2/*
124 %defattr(-,root,root)
125 %{_sbindir}/*
126 %dir %{_datadir}/tc
127 %{_datadir}/tc/*
128 %dir %{_libdir}/tc/
129 %{_libdir}/tc/*
130 %dir %{_datadir}/license/
131 %{_datadir}/license/iproute2
132
133 %files devel
134 %defattr(-,root,root)
135 %doc README README.decnet README.iproute2+tc README.distribution README.lnstat
136 %{_mandir}/man7/*
137 %{_mandir}/man8/*
138 %{_mandir}/man3/*
139 %{_libdir}/libnetlink.a
140 %{_includedir}/libnetlink.h
141 %{_datadir}/license/iproute2-devel