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