]> git.proxmox.com Git - mirror_kronosnet.git/blob - kronosnet.spec.in
Merge pull request #116 from kronosnet/stable1-proposed
[mirror_kronosnet.git] / kronosnet.spec.in
1 ###############################################################################
2 ###############################################################################
3 ##
4 ## Copyright (C) 2012-2018 Red Hat, Inc. All rights reserved.
5 ##
6 ## This copyrighted material is made available to anyone wishing to use,
7 ## modify, copy, or redistribute it subject to the terms and conditions
8 ## of the GNU General Public License v.2 or higher
9 ##
10 ###############################################################################
11 ###############################################################################
12
13 # keep around ready for later user
14 %global alphatag @alphatag@
15 %global numcomm @numcomm@
16 %global dirty @dirty@
17
18 # set defaults from ./configure invokation
19 %@sctp@ sctp
20 %@nss@ nss
21 %@openssl@ openssl
22 %@zlib@ zlib
23 %@lz4@ lz4
24 %@lzo2@ lzo2
25 %@lzma@ lzma
26 %@bzip2@ bzip2
27 %@kronosnetd@ kronosnetd
28 %@libtap@ libtap
29 %@runautogen@ runautogen
30 %@rpmdebuginfo@ rpmdebuginfo
31 %@overriderpmdebuginfo@ overriderpmdebuginfo
32 %@buildman@ buildman
33
34 %if %{with overriderpmdebuginfo}
35 %undefine _enable_debug_packages
36 %endif
37
38 %if %{with sctp}
39 %global buildsctp 1
40 %endif
41 %if %{with nss}
42 %global buildcryptonss 1
43 %endif
44 %if %{with openssl}
45 %global buildcryptoopenssl 1
46 %endif
47 %if %{with zlib}
48 %global buildcompresszlib 1
49 %endif
50 %if %{with lz4}
51 %global buildcompresslz4 1
52 %endif
53 %if %{with lzo2}
54 %global buildcompresslzo2 1
55 %endif
56 %if %{with lzma}
57 %global buildcompresslzma 1
58 %endif
59 %if %{with bzip2}
60 %global buildcompressbzip2 1
61 %endif
62 %if %{with libtap}
63 %global buildlibtap 1
64 %endif
65 %if %{with kronosnetd}
66 %global buildlibtap 1
67 %global buildkronosnetd 1
68 %endif
69 %if %{with runautogen}
70 %global buildautogen 1
71 %endif
72 %if %{with buildman}
73 %global buildmanpages 1
74 %endif
75
76 # main (empty) package
77 # http://www.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html
78
79 Name: kronosnet
80 Summary: Multipoint-to-Multipoint VPN daemon
81 Version: @version@
82 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
83 License: GPLv2+ and LGPLv2+
84 Group: System Environment/Base
85 URL: https://github.com/kronosnet/kronosnet/
86 Source0: https://github.com/kronosnet/kronosnet/archive/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz
87
88 ## Setup/build bits
89
90 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
91
92 # Build dependencies
93 BuildRequires: gcc
94 # required to build man pages
95 %if %{defined buildmanpages}
96 BuildRequires: libqb-devel libxml2-devel doxygen
97 %endif
98 %if %{defined buildsctp}
99 BuildRequires: lksctp-tools-devel
100 %endif
101 %if %{defined buildcryptonss}
102 BuildRequires: /usr/include/nss3/nss.h /usr/include/nspr4/nspr.h
103 %endif
104 %if %{defined buildcryptoopenssl}
105 BuildRequires: /usr/include/openssl/conf.h
106 %endif
107 %if %{defined buildcompresszlib}
108 BuildRequires: zlib-devel
109 %endif
110 %if %{defined buildcompresslz4}
111 BuildRequires: /usr/include/lz4hc.h
112 %endif
113 %if %{defined buildcompresslzo2}
114 BuildRequires: lzo-devel
115 %endif
116 %if %{defined buildcompresslzma}
117 BuildRequires: xz-devel
118 %endif
119 %if %{defined buildcompressbzip2}
120 BuildRequires: /usr/include/bzlib.h
121 %endif
122 %if %{defined buildkronosnetd}
123 BuildRequires: pam-devel
124 %endif
125 %if %{defined buildautogen}
126 BuildRequires: autoconf
127 BuildRequires: automake
128 BuildRequires: libtool
129 %endif
130
131 %prep
132 %setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
133
134 %build
135 %if %{with runautogen}
136 ./autogen.sh
137 %endif
138
139 %{configure} \
140 %if %{defined buildmanpages}
141 --enable-man \
142 %else
143 --disable-man \
144 %endif
145 %if %{defined buildsctp}
146 --enable-libknet-sctp \
147 %else
148 --disable-libknet-sctp \
149 %endif
150 %if %{defined buildcryptonss}
151 --enable-crypto-nss \
152 %else
153 --disable-crypto-nss \
154 %endif
155 %if %{defined buildcryptoopenssl}
156 --enable-crypto-openssl \
157 %else
158 --disable-crypto-openssl \
159 %endif
160 %if %{defined buildcompresszlib}
161 --enable-compress-zlib \
162 %else
163 --disable-compress-zlib \
164 %endif
165 %if %{defined buildcompresslz4}
166 --enable-compress-lz4 \
167 %else
168 --disable-compress-lz4 \
169 %endif
170 %if %{defined buildcompresslzo2}
171 --enable-compress-lzo2 \
172 %else
173 --disable-compress-lzo2 \
174 %endif
175 %if %{defined buildcompresslzma}
176 --enable-compress-lzma \
177 %else
178 --disable-compress-lzma \
179 %endif
180 %if %{defined buildcompressbzip2}
181 --enable-compress-bzip2 \
182 %else
183 --disable-compress-bzip2 \
184 %endif
185 %if %{defined buildkronosnetd}
186 --enable-kronosnetd \
187 %endif
188 %if %{defined buildlibtap}
189 --enable-libtap \
190 %endif
191 --with-initdefaultdir=%{_sysconfdir}/sysconfig/ \
192 %if %{defined _unitdir}
193 --with-systemddir=%{_unitdir}
194 %else
195 --with-initddir=%{_sysconfdir}/rc.d/init.d/
196 %endif
197
198 make %{_smp_mflags}
199
200 %install
201 rm -rf %{buildroot}
202 make install DESTDIR=%{buildroot}
203
204 # tree cleanup
205 # remove static libraries
206 find %{buildroot} -name "*.a" -exec rm {} \;
207 # remove libtools leftovers
208 find %{buildroot} -name "*.la" -exec rm {} \;
209
210 # handle systemd vs init script
211 %if %{defined _unitdir}
212 # remove init scripts
213 rm -rf %{buildroot}/etc/init.d
214 %else
215 # remove systemd specific bits
216 find %{buildroot} -name "*.service" -exec rm {} \;
217 %endif
218
219 # remove docs
220 rm -rf %{buildroot}/usr/share/doc/kronosnet
221
222 %clean
223 rm -rf %{buildroot}
224
225 # main empty package
226 %description
227 kronosnet source
228
229 %if %{defined buildkronosnetd}
230 ## Runtime and subpackages section
231 %package -n kronosnetd
232 Group: System Environment/Base
233 Summary: Multipoint-to-Multipoint VPN daemon
234 %if %{defined _unitdir}
235 # Needed for systemd unit
236 Requires(post): systemd-sysv
237 Requires(post): systemd-units
238 Requires(preun): systemd-units
239 Requires(postun): systemd-units
240 %else
241 Requires(post): chkconfig
242 Requires(preun): chkconfig, initscripts
243 %endif
244 Requires(post): shadow-utils
245 Requires(preun): shadow-utils
246 Requires: pam, /etc/pam.d/passwd
247
248 %description -n kronosnetd
249 The kronosnet daemon is a bridge between kronosnet switching engine
250 and kernel network tap devices, to create and administer a
251 distributed LAN over multipoint-to-multipoint VPNs.
252 The daemon does a poor attempt to provide a configure UI similar
253 to other known network devices/tools (Cisco, quagga).
254 Beside looking horrific, it allows runtime changes and
255 reconfiguration of the kronosnet(s) without daemon reload
256 or service disruption.
257
258 %post -n kronosnetd
259 %if %{defined _unitdir}
260 %if 0%{?systemd_post:1}
261 %systemd_post kronosnetd.service
262 %else
263 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
264 %endif
265 %else
266 /sbin/chkconfig --add kronosnetd
267 %endif
268 /usr/sbin/groupadd --force --system @defaultadmgroup@
269
270 %preun -n kronosnetd
271 %if %{defined _unitdir}
272 %if 0%{?systemd_preun:1}
273 %systemd_preun kronosnetd.service
274 %else
275 if [ "$1" -eq 0 ]; then
276 /bin/systemctl --no-reload disable kronosnetd.service
277 /bin/systemctl stop kronosnetd.service >/dev/null 2>&1
278 fi
279 %endif
280 %else
281 if [ "$1" = 0 ]; then
282 /sbin/service kronosnetd stop >/dev/null 2>&1
283 /sbin/chkconfig --del kronosnetd
284 fi
285 %endif
286
287 %files -n kronosnetd
288 %defattr(-,root,root,-)
289 %doc COPYING.* COPYRIGHT
290 %dir %{_sysconfdir}/kronosnet
291 %dir %{_sysconfdir}/kronosnet/*
292 %config(noreplace) %{_sysconfdir}/sysconfig/kronosnetd
293 %config(noreplace) %{_sysconfdir}/pam.d/kronosnetd
294 %config(noreplace) %{_sysconfdir}/logrotate.d/kronosnetd
295 %if %{defined _unitdir}
296 %{_unitdir}/kronosnetd.service
297 %else
298 %config(noreplace) %{_sysconfdir}/rc.d/init.d/kronosnetd
299 %endif
300 %{_sbindir}/*
301 %{_mandir}/man8/*
302 %endif
303
304 %if %{defined buildlibtap}
305 %package -n libtap1
306 Group: System Environment/Libraries
307 Summary: Simple userland wrapper around kernel tap devices
308
309 %description -n libtap1
310 This is an over-engineered commodity library to manage a pool
311 of tap devices and provides the basic
312 pre-up.d/up.d/down.d/post-down.d infrastructure.
313
314 %files -n libtap1
315 %defattr(-,root,root,-)
316 %doc COPYING.* COPYRIGHT
317 %{_libdir}/libtap.so.*
318
319 %post -n libtap1 -p /sbin/ldconfig
320
321 %postun -n libtap1 -p /sbin/ldconfig
322
323 %package -n libtap1-devel
324 Group: Development/Libraries
325 Summary: Simple userland wrapper around kernel tap devices (developer files)
326 Requires: libtap1 = %{version}-%{release}
327 Requires: pkgconfig
328
329 %description -n libtap1-devel
330 This is an over-engineered commodity library to manage a pool
331 of tap devices and provides the basic
332 pre-up.d/up.d/down.d/post-down.d infrastructure.
333
334 %files -n libtap1-devel
335 %defattr(-,root,root,-)
336 %doc COPYING.* COPYRIGHT
337 %{_libdir}/libtap.so
338 %{_includedir}/libtap.h
339 %{_libdir}/pkgconfig/libtap.pc
340 %endif
341
342 %package -n libknet1
343 Group: System Environment/Libraries
344 Summary: Kronosnet core switching implementation
345
346 %description -n libknet1
347 The whole kronosnet core is implemented in this library.
348 Please refer to the not-yet-existing documentation for further
349 information.
350
351 %files -n libknet1
352 %defattr(-,root,root,-)
353 %doc COPYING.* COPYRIGHT
354 %{_libdir}/libknet.so.*
355 %dir %{_libdir}/kronosnet
356
357 %post -n libknet1 -p /sbin/ldconfig
358
359 %postun -n libknet1 -p /sbin/ldconfig
360
361 %package -n libknet1-devel
362 Group: Development/Libraries
363 Summary: Kronosnet core switching implementation (developer files)
364 Requires: libknet1 = %{version}-%{release}
365 Requires: pkgconfig
366
367 %description -n libknet1-devel
368 The whole kronosnet core is implemented in this library.
369 Please refer to the not-yet-existing documentation for further
370 information.
371
372 %files -n libknet1-devel
373 %defattr(-,root,root,-)
374 %doc COPYING.* COPYRIGHT
375 %{_libdir}/libknet.so
376 %{_includedir}/libknet.h
377 %{_libdir}/pkgconfig/libknet.pc
378 %if %{defined buildmanpages}
379 %{_mandir}/man3/knet*.3.gz
380 %endif
381
382 %if %{defined buildcryptonss}
383 %package -n libknet1-crypto-nss-plugin
384 Group: System Environment/Libraries
385 Summary: libknet1 nss support
386 Requires: libknet1 = %{version}-%{release}
387
388 %description -n libknet1-crypto-nss-plugin
389 NSS crypto support for libknet1.
390
391 %files -n libknet1-crypto-nss-plugin
392 %defattr(-,root,root,-)
393 %{_libdir}/kronosnet/crypto_nss.so
394 %endif
395
396 %if %{defined buildcryptoopenssl}
397 %package -n libknet1-crypto-openssl-plugin
398 Group: System Environment/Libraries
399 Summary: libknet1 openssl support
400 Requires: libknet1 = %{version}-%{release}
401
402 %description -n libknet1-crypto-openssl-plugin
403 OpenSSL crypto support for libknet1.
404
405 %files -n libknet1-crypto-openssl-plugin
406 %defattr(-,root,root,-)
407 %{_libdir}/kronosnet/crypto_openssl.so
408 %endif
409
410 %if %{defined buildcompresszlib}
411 %package -n libknet1-compress-zlib-plugin
412 Group: System Environment/Libraries
413 Summary: libknet1 zlib support
414 Requires: libknet1 = %{version}-%{release}
415
416 %description -n libknet1-compress-zlib-plugin
417 zlib compression support for libknet1.
418
419 %files -n libknet1-compress-zlib-plugin
420 %defattr(-,root,root,-)
421 %{_libdir}/kronosnet/compress_zlib.so
422 %endif
423 %if %{defined buildcompresslz4}
424 %package -n libknet1-compress-lz4-plugin
425 Group: System Environment/Libraries
426 Summary: libknet1 lz4 and lz4hc support
427 Requires: libknet1 = %{version}-%{release}
428
429 %description -n libknet1-compress-lz4-plugin
430 lz4 and lz4hc compression support for libknet1.
431
432 %files -n libknet1-compress-lz4-plugin
433 %defattr(-,root,root,-)
434 %{_libdir}/kronosnet/compress_lz4.so
435 %{_libdir}/kronosnet/compress_lz4hc.so
436 %endif
437
438 %if %{defined buildcompresslzo2}
439 %package -n libknet1-compress-lzo2-plugin
440 Group: System Environment/Libraries
441 Summary: libknet1 lzo2 support
442 Requires: libknet1 = %{version}-%{release}
443
444 %description -n libknet1-compress-lzo2-plugin
445 lzo2 compression support for libknet1.
446
447 %files -n libknet1-compress-lzo2-plugin
448 %defattr(-,root,root,-)
449 %{_libdir}/kronosnet/compress_lzo2.so
450 %endif
451
452 %if %{defined buildcompresslzma}
453 %package -n libknet1-compress-lzma-plugin
454 Group: System Environment/Libraries
455 Summary: libknet1 lzma support
456 Requires: libknet1 = %{version}-%{release}
457
458 %description -n libknet1-compress-lzma-plugin
459 lzma compression support for libknet1.
460
461 %files -n libknet1-compress-lzma-plugin
462 %defattr(-,root,root,-)
463 %{_libdir}/kronosnet/compress_lzma.so
464 %endif
465
466 %if %{defined buildcompressbzip2}
467 %package -n libknet1-compress-bzip2-plugin
468 Group: System Environment/Libraries
469 Summary: libknet1 bzip2 support
470 Requires: libknet1 = %{version}-%{release}
471
472 %description -n libknet1-compress-bzip2-plugin
473 bzip2 compression support for libknet1.
474
475 %files -n libknet1-compress-bzip2-plugin
476 %defattr(-,root,root,-)
477 %{_libdir}/kronosnet/compress_bzip2.so
478 %endif
479
480 %package -n libknet1-crypto-plugins-all
481 Group: System Environment/Libraries
482 Summary: libknet1 crypto plugins meta package
483 %if %{defined buildcryptonss}
484 Requires: libknet1-crypto-nss-plugin
485 %endif
486 %if %{defined buildcryptoopenssl}
487 Requires: libknet1-crypto-openssl-plugin
488 %endif
489
490 %description -n libknet1-crypto-plugins-all
491 meta package to install all of libknet1 crypto plugins
492
493 %files -n libknet1-crypto-plugins-all
494
495 %package -n libknet1-compress-plugins-all
496 Group: System Environment/Libraries
497 Summary: libknet1 compress plugins meta package
498 %if %{defined buildcompresszlib}
499 Requires: libknet1-compress-zlib-plugin
500 %endif
501 %if %{defined buildcompresslz4}
502 Requires: libknet1-compress-lz4-plugin
503 %endif
504 %if %{defined buildcompresslzo2}
505 Requires: libknet1-compress-lzo2-plugin
506 %endif
507 %if %{defined buildcompresslzma}
508 Requires: libknet1-compress-lzma-plugin
509 %endif
510 %if %{defined buildcompressbzip2}
511 Requires: libknet1-compress-bzip2-plugin
512 %endif
513
514 %description -n libknet1-compress-plugins-all
515 meta package to install all of libknet1 compress plugins
516
517 %files -n libknet1-compress-plugins-all
518
519 %package -n libknet1-plugins-all
520 Group: System Environment/Libraries
521 Summary: libknet1 plugins meta package
522 Requires: libknet1-compress-plugins-all
523 Requires: libknet1-crypto-plugins-all
524
525 %description -n libknet1-plugins-all
526 meta package to install all of libknet1 plugins
527
528 %files -n libknet1-plugins-all
529
530 %if %{with rpmdebuginfo}
531 %debug_package
532 %endif
533
534 %changelog
535 * @date@ Autotools generated version <nobody@nowhere.org> - @version@-1-@numcomm@.@alphatag@.@dirty@
536 - These aren't the droids you're looking for.
537