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