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