]> git.ipfire.org Git - thirdparty/lldpd.git/blob - redhat/lldpd.spec
osx: update lldpd to 0.9.3
[thirdparty/lldpd.git] / redhat / lldpd.spec
1 # This .spec file is targeted for SuSE OBS. It relies on macro that
2 # are not available on regular distributions. If you use directly
3 # rpmbuild, be sure to use something like `--define 'rhel_version
4 # 700'`.
5
6 # Conditional build options, disable with "--without xxx"
7 %bcond_without xml
8 %bcond_without cdp
9 %bcond_without edp
10 %bcond_without sonmp
11 %bcond_without fdp
12 %bcond_without lldpmed
13 %bcond_without dot1
14 %bcond_without dot3
15 %bcond_without custom
16 %bcond_without snmp
17 %bcond_with json
18
19 # On RHEL <= 6, compile with oldies
20 # For SuSE, SLE11 with a recent SP comes with 3.0. SLE12 comes with 3.12.
21 %if (0%{?rhel_version} > 0 && 0%{?rhel_version} < 700) || (0%{?centos_version} > 0 && 0%{?centos_version} < 700)
22 %bcond_without oldies
23 %else
24 %bcond_with oldies
25 %endif
26
27 # On RHEL < 7, disable systemd
28 # On SuSE < 12, disable systemd
29 %if (0%{?rhel_version} > 0 && 0%{?rhel_version} < 700) || (0%{?centos_version} > 0 && 0%{?centos_version} < 700) || (0%{?suse_version} > 0 && 0%{?suse_version} < 1210)
30 %bcond_with systemd
31 %else
32 %bcond_without systemd
33 %endif
34
35 # On RHEL < 7, use embedded libevent
36 %if (0%{?rhel_version} > 0) || (0%{?centos_version} > 0 && 0%{?centos_version} < 700) || (0%{?suse_version} > 0 && 0%{?suse_version} < 1200)
37 %bcond_with system_libevent
38 %else
39 %bcond_without system_libevent
40 %endif
41
42 %define lldpd_user _lldpd
43 %define lldpd_group _lldpd
44 %define lldpd_chroot /var/run/lldpd
45
46 Summary: Implementation of IEEE 802.1ab (LLDP)
47 Name: lldpd
48 Version: 0.9.3
49 Release: 1%{?dist}
50 License: MIT
51 Group: System/Management
52 URL: http://vincentbernat.github.com/lldpd/
53 Source0: http://media.luffy.cx/files/lldpd/%{name}-%{version}.tar.gz
54 Source1: lldpd.init%{?suse_version:.suse}
55 Source2: lldpd.sysconfig
56
57 BuildRequires: pkgconfig
58 %if %{with system_libevent}
59 BuildRequires: libevent-devel
60 %endif
61 BuildRequires: readline-devel
62 %if %{with snmp}
63 BuildRequires: net-snmp-devel
64 BuildRequires: openssl-devel
65 %{!?suse_version:BuildRequires: lm_sensors-devel}
66 %endif
67 %if %{with xml}
68 BuildRequires: libxml2-devel
69 %endif
70 %if %{with json}
71 BuildRequires: json-c-devel
72 %endif
73 %if %{with systemd}
74 %if 0%{?suse_version}
75 BuildRequires: systemd-rpm-macros
76 %{?systemd_requires}
77 %else
78 Requires(post): systemd
79 Requires(preun): systemd
80 Requires(postun): systemd
81 BuildRequires: systemd-units
82 %endif
83 %endif
84 %if 0%{?suse_version}
85 PreReq: %fillup_prereq %insserv_prereq pwdutils
86 %else
87 Requires(pre): /usr/sbin/groupadd /usr/sbin/useradd
88 Requires(post): chkconfig
89 Requires(preun): chkconfig
90 Requires(preun): initscripts
91 Requires(postun): initscripts
92 %endif
93
94 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
95
96 %description
97 This implementation provides LLDP sending and reception, supports VLAN
98 and includes an SNMP subagent that can interface to an SNMP agent
99 through AgentX protocol.
100
101 LLDP is an industry standard protocol designed to supplant proprietary
102 Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
103 and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
104 inter-vendor compatible mechanism to deliver Link-Layer notifications
105 to adjacent network devices.
106
107 This daemon is also able to deal with CDP, FDP, SONMP and EDP
108 protocol. It also handles LLDP-MED extension.
109
110 %package devel
111 Summary: Implementation of IEEE 802.1ab - Tools and header files for developers
112 Group: Development/Libraries/C
113 BuildRequires: pkgconfig
114 Requires: lldpd = %{version}-%{release}
115
116 %description devel
117 This package is required to develop alternate clients for lldpd.
118
119 LLDP is an industry standard protocol designed to supplant proprietary
120 Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
121 and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
122 inter-vendor compatible mechanism to deliver Link-Layer notifications
123 to adjacent network devices.
124
125 %prep
126 %setup -q
127 %build
128 %configure \
129 %if %{with snmp}
130 --with-snmp \
131 %endif
132 %if %{with xml}
133 --with-xml \
134 %endif
135 %if %{with cdp}
136 --enable-cdp \
137 %else
138 --disable-cdp \
139 %endif
140 %if %{with edp}
141 --enable-edp \
142 %else
143 --disable-edp \
144 %endif
145 %if %{with sonmp}
146 --enable-sonmp \
147 %else
148 --disable-sonmp \
149 %endif
150 %if %{with fdp}
151 --enable-fdp \
152 %else
153 --disable-fdp \
154 %endif
155 %if %{with lldpmed}
156 --enable-lldpmed \
157 %else
158 --disable-lldpmed \
159 %endif
160 %if %{with dot1}
161 --enable-dot1 \
162 %else
163 --disable-dot1 \
164 %endif
165 %if %{with dot3}
166 --enable-dot3 \
167 %else
168 --disable-dot3 \
169 %endif
170 %if %{with custom}
171 --enable-custom \
172 %else
173 --disable-custom \
174 %endif
175 %if %{with oldies}
176 --enable-oldies \
177 %else
178 --disable-oldies \
179 %endif
180 --with-privsep-user=%lldpd_user \
181 --with-privsep-group=%lldpd_group \
182 --with-privsep-chroot=%lldpd_chroot \
183 %if %{without systemd}
184 --with-systemdsystemunitdir=no \
185 %else
186 --with-systemdsystemunitdir=%{_unitdir} \
187 %endif
188 --with-sysusersdir=no \
189 --prefix=%{_usr} \
190 --localstatedir=%{_localstatedir} \
191 --sysconfdir=%{_sysconfdir} \
192 --libdir=%{_libdir} \
193 --docdir=%{_docdir}/lldpd \
194 --enable-pie
195
196 [ -f %{_includedir}/net-snmp/agent/struct.h ] || touch src/struct.h
197 make %{?_smp_mflags}
198
199 %install
200 make install DESTDIR=$RPM_BUILD_ROOT
201 %if %{without systemd}
202 install -d $RPM_BUILD_ROOT/%{_initrddir}
203 install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/lldpd
204 %endif
205 %if 0%{?suse_version}
206 mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates
207 install -m700 %{SOURCE2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.lldpd
208 %else
209 install -d $RPM_BUILD_ROOT/etc/sysconfig
210 install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/lldpd
211 %endif
212
213 %pre
214 # Create lldpd user/group
215 if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \
216 %{_sbindir}/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi
217 if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
218 %{_sbindir}/useradd -g %lldpd_group -M -r -s /sbin/nologin \
219 -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \
220 || exit 1 ; fi
221 %if 0%{?suse_version} >= 1210 && %{with systemd}
222 %service_add_pre lldpd.service
223 %endif
224
225 %if 0%{?suse_version}
226 # Service management for SuSE
227
228 %if 0%{?suse_version} >= 1210 && %{with systemd}
229 %post
230 %service_add_post lldpd.service
231 %preun
232 %service_del_preun lldpd.service
233 %postun
234 %service_del_postun lldpd.service
235 %else
236 %post
237 /sbin/ldconfig
238 %{fillup_and_insserv lldpd}
239 %postun
240 /sbin/ldconfig
241 %restart_on_update lldpd
242 %insserv_cleanup
243 %preun
244 %stop_on_removal lldpd
245 %endif
246
247 %else
248 %if %{without systemd}
249 # Service management for Redhat/CentOS without systemd
250
251 %post
252 /sbin/ldconfig
253 /sbin/chkconfig --add lldpd
254 %postun
255 /sbin/ldconfig
256 if [ "$1" -ge "1" ]; then
257 /sbin/service lldpd condrestart >/dev/null 2>&1 || :
258 fi
259 %preun
260 if [ "$1" = "0" ]; then
261 /sbin/service lldpd stop > /dev/null 2>&1
262 /sbin/chkconfig --del lldpd
263 fi
264
265 %else
266 # Service management for Redhat/CentOS with systemd
267
268 %post
269 /sbin/ldconfig
270 %systemd_post lldpd.service
271
272 %preun
273 %systemd_preun lldpd.service
274
275 %postun
276 %systemd_postun_with_restart lldpd.service
277 /sbin/ldconfig
278
279 %endif
280 %endif
281
282 %clean
283 rm -rf $RPM_BUILD_ROOT
284
285 %files
286 %defattr(-,root,root,-)
287 %dir %{_docdir}/lldpd
288 %doc %{_docdir}/lldpd/NEWS
289 %doc %{_docdir}/lldpd/ChangeLog
290 %doc %{_docdir}/lldpd/README.md
291 %doc %{_docdir}/lldpd/CONTRIBUTE.md
292 %{_sbindir}/lldpd
293 %{_sbindir}/lldpctl
294 %{_sbindir}/lldpcli
295 %{_libdir}/liblldpctl.so.*
296 %{_datadir}/zsh
297 %{_datadir}/bash-completion
298 %doc %{_mandir}/man8/lldp*
299 %config %{_sysconfdir}/lldpd.d
300 %if %{without systemd}
301 %config %attr(755,root,root) %{_initrddir}/lldpd
302 %else
303 %{_unitdir}/lldpd.service
304 %endif
305 %if 0%{?suse_version}
306 %attr(644,root,root) %{_var}/adm/fillup-templates/sysconfig.lldpd
307 %else
308 %config(noreplace) %{_sysconfdir}/sysconfig/lldpd
309 %endif
310
311 %files devel
312 %defattr(-,root,root)
313 %{_libdir}/liblldpctl.so
314 %{_libdir}/liblldpctl.a
315 %{_libdir}/liblldpctl.la
316 %{_libdir}/pkgconfig/lldpctl.pc
317 %{_includedir}/lldpctl.h
318 %{_includedir}/lldp-const.h
319
320 %changelog
321 * Sat May 21 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.3-1
322 - New upstream version.
323
324 * Sat Mar 19 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.2-1
325 - New upstream version.
326
327 * Sat Feb 20 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.1-1
328 - New upstream version.
329
330 * Fri Jan 01 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.0-1
331 - New upstream version.
332 - Do not rely on libnl3.
333
334 * Sun Dec 27 2015 Vincent Bernat <bernat@luffy.cx> - 0.8.0-1
335 - New upstream version.
336 - Use system libnl3 when possible.
337 - Use system libevent when possible.
338
339 * Wed Sep 09 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.17-1
340 - New upstream version.
341
342 * Fri Aug 07 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.16-1
343 - New upstream version.
344
345 * Wed May 20 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.15-1
346 - New upstream version.
347
348 * Sat Apr 04 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.14-1
349 - New upstream version.
350
351 * Tue Dec 30 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.13-1
352 - New upstream version.
353
354 * Sat Nov 22 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.12-1
355 - New upstream version.
356 - Completion for bash and zsh.
357
358 * Wed Oct 08 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.11-1
359 - New upstream version.
360 - Completion for bash and zsh.
361
362 * Mon Jul 21 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.10-1
363 - New upstream version.
364
365 * Wed May 28 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.9-1
366 - New upstream version.
367
368 * Sun Apr 13 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.8-1
369 - New upstream version.
370
371 * Sun Nov 10 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.7-1
372 - New upstream version.
373
374 * Fri Jul 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.6-1
375 - New upstream version.
376
377 * Sat Jun 22 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.5-1
378 - New upstream version.
379
380 * Sun May 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.3-1
381 - New upstream version.
382
383 * Fri Apr 19 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.2-1
384 - New upstream version.
385
386 * Sat Jan 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.1-1
387 - New upstream version.
388
389 * Sun Jan 06 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.0-1
390 - New upstream version.
391 - Requires readline-devel.
392 - Ships lldpcli.
393
394 * Thu Sep 27 2012 Vincent Bernat <bernat@luffy.cx> - 0.6.1-1
395 - New upstream version
396 - Do not require libevent, use embedded copy.
397 - Provide a -devel package.
398
399 * Fri Jun 11 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.1-1
400 - New upstream version
401 - Define bcond_without and with macros if not defined to be compatible
402 with RHEL
403 - Requires useradd and groupadd
404 - Adapt to make it work with SuSE
405 - Provide an init script targetted at SuSE
406 - Build require lm_sensors-devel on RHEL
407
408 * Fri Mar 12 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.0-1
409 - New upstream version
410 - Add XML support
411
412 * Tue May 19 2009 Vincent Bernat <bernat@luffy.cx> - 0.4.0-1
413 - Add variables
414 - Enable SNMP support
415 - Add _lldpd user creation
416 - Add initscript
417 - New upstream version
418
419 * Mon May 18 2009 Dean Hamstead <dean.hamstead@optusnet.com.au> - 0.3.3-1
420 - Initial attempt