Registration is now invite-only. Any user can make an invite, you need to create it here and give resulting link to someone to register.

About project

Avahi is a system which facilitates service discovery on a local
network -- this means that you can plug your laptop or computer into a
network and instantly be able to view other people who you can chat
with, find printers to print to or find files being shared. This kind
of technology is already found in MacOS X (branded 'Rendezvous',
'Bonjour' and sometimes 'ZeroConf') and is very convenient.

Last commit

avatar
mikhailnov has added b1428918db
Fix path to socket (RB#14051)

It was /run/run/avahi-daemon/<...>

https://bugzilla.rosalinux.ru/show_bug.cgi?id=14051

Files in

100644 | 653 lines (530 sloc) | 19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
%define commit 35bb1bae902ae9ff2da809fb5f577ba873c43359
%define commit_short %(echo %{commit} | head -c6)

# CVE-2021-26720 specific to Debian
# Fixed in git after v0.8:
# CVE-2023-38469
# CVE-2023-38473
# CVE-2023-38470 (https://github.com/lathiat/avahi/commit/94cb6489)
# CVE-2023-38471
# CVE-2023-38472

%define client_name %{name}-client
%define common_name %{name}-common
%define core_name %{name}-core
%define dns_sd_name %{name}-compat-libdns_sd
%define glib_name %{name}-glib
%define gobject_name %{name}-gobject
%define howl_name %{name}-compat-howl
%define libevent_name %{name}-libevent
%define qt5_name %{name}-qt5
%define ui_name %{name}-ui
%define ui_gtk3_name %{name}-ui-gtk3

%define client_major 3
%define common_major 3
%define core_major 7
%define dns_sd_major 1
%define glib_major 1
%define gobject_major 0
%define howl_major 0
%define libevent_major 1
%define qt5_major 1
%define ui_major 0
%define ui_gtk3_major 0

%define lib_client_name %mklibname %{client_name} %{client_major}
%define develnameclient %mklibname %{client_name} -d
%define lib_common_name %mklibname %{common_name} %{common_major}
%define develnamecommon %mklibname %{common_name} -d
%define lib_core_name %mklibname %{core_name} %{core_major}
%define develnamecore %mklibname %{core_name} -d
%define lib_dns_sd_name %mklibname %{dns_sd_name} %{dns_sd_major}
%define develnamedns_sd %mklibname %{dns_sd_name} -d
%define lib_glib_name %mklibname %{glib_name} %{glib_major}
%define develnameglib %mklibname %{glib_name} -d
%define lib_gobject_name %mklibname %{gobject_name} %{gobject_major}
%define develnamegobject %mklibname %{gobject_name} -d
%define lib_howl_name %mklibname %{howl_name} %{howl_major}
%define develnamehowl %mklibname %{howl_name} -d
%define lib_libevent_name %mklibname %{libevent_name}_ %{libevent_major}
%define develnamelibevent %mklibname %{libevent_name} -d
%define lib_qt5_name %mklibname %{qt5_name}_ %{qt5_major}
%define develnameqt5 %mklibname %{qt5_name} -d
%define lib_ui_name %mklibname %{ui_name} %{ui_major}
%define develnameui %mklibname %{ui_name} -d
%define lib_ui_gtk3_name %mklibname %{ui_gtk3_name}_ %{ui_gtk3_major}
%define develnameui_gtk3 %mklibname %{ui_gtk3_name} -d

%{?build_qt5}%{?!build_qt5:%bcond_without qt5}
%{?build_gtk3}%{?!build_gtk3:%bcond_without gtk3}

%bcond_with mono
%bcond_without qt5
%bcond_without gtk3
%bcond_without python

Summary:	Avahi service discovery (mDNS/DNS-SD) suite
Name:		avahi
Version:	0.8
Release:	12.git%{commit_short}.2
License:	LGPLv2+
Group:		System/Servers
Url:		http://avahi.org/
#Source0:	http://avahi.org/download/%{name}-%{version}.tar.gz
Source0:	https://github.com/lathiat/avahi/archive/%{commit}.tar.gz?/%{name}-%{commit}.tar.gz
Source1:	avahi-hostname.sh
Source2:	sysusers.avahi.conf
Source100:	%{name}.rpmlintrc
Patch0:		avahi-0.6.31-gtk-is-broken-beyond-repair-gtk-die-die-die.patch
Patch1:		avahi-0.6.31.workaround.patch
BuildRequires:	intltool
BuildRequires:	cap-devel
BuildRequires:	expat-devel >= 2.0.1
BuildRequires:	gdbm-devel
BuildRequires:	%{_bindir}/xmltoman
BuildRequires:	pkgconfig(dbus-1)
BuildRequires:	pkgconfig(libevent)
%if %{with python}
BuildRequires:	python3egg(dbus-python)
BuildRequires:	pkgconfig(pygobject-3.0)
%endif
BuildRequires:	pkgconfig(libdaemon)
BuildRequires:	pkgconfig(libglade-2.0)
%if %{with qt5}
BuildRequires:	pkgconfig(Qt5Core)
%endif
%if %{with gtk3}
BuildRequires:	pkgconfig(gtk+-3.0)
%endif
BuildRequires:	systemd-units
Recommends:	nss_mdns
Requires(pre):	%{_bindir}/systemd-sysusers

%description
Avahi is a system which facilitates service discovery on a local
network -- this means that you can plug your laptop or computer into a
network and instantly be able to view other people who you can chat
with, find printers to print to or find files being shared. This kind
of technology is already found in MacOS X (branded 'Rendezvous',
'Bonjour' and sometimes 'ZeroConf') and is very convenient.

%files -f avahi.lang
%dir %{_sysconfdir}/%{name}/
%dir %{_sysconfdir}/%{name}/services/
%config(noreplace) %{_sysconfdir}/%{name}/hosts
%config(noreplace) %{_sysconfdir}/%{name}/%{name}-daemon.conf
%config(noreplace) %{_sysconfdir}/%{name}/avahi-autoipd.action
%config(noreplace) %{_datadir}/dbus-1/system.d/%{name}-dbus.conf
%attr(0755,avahi,avahi) %dir %{_localstatedir}/avahi
%{_sysconfdir}/sysconfig/network-scripts/hostname.d/avahi
%{_bindir}/%{name}-browse
%{_bindir}/%{name}-browse-domains
%{_bindir}/%{name}-publish
%{_bindir}/%{name}-publish-address
%{_bindir}/%{name}-publish-service
%{_bindir}/%{name}-resolve
%{_bindir}/%{name}-resolve-address
%{_bindir}/%{name}-resolve-host-name
%{_bindir}/%{name}-set-host-name
%{_sbindir}/%{name}-daemon
%{_sbindir}/avahi-autoipd
%{_datadir}/%{name}/%{name}-service.dtd
%{_datadir}/dbus-1/interfaces/*.xml
%{_mandir}/man1/%{name}-browse-domains.1*
%{_mandir}/man1/%{name}-browse.1*
%{_mandir}/man1/%{name}-discover.1*
%{_mandir}/man1/%{name}-publish.1*
%{_mandir}/man1/%{name}-publish-address.1*
%{_mandir}/man1/%{name}-publish-service.1*
%{_mandir}/man1/%{name}-resolve.1*
%{_mandir}/man1/%{name}-resolve-address.1*
%{_mandir}/man1/%{name}-resolve-host-name.1*
%{_mandir}/man1/%{name}-set-host-name.1*
%{_mandir}/man5/%{name}-daemon.conf.5*
%{_mandir}/man5/%{name}.hosts.5*
%{_mandir}/man5/%{name}.service.5*
%{_mandir}/man8/%{name}-daemon.8*
%{_mandir}/man8/avahi-autoipd*
%dir %{_libdir}/avahi
%if %{with python}
%{_libdir}/avahi/service-types.db
%endif
%{_sysusersdir}/%{name}.conf
%{_prefix}/lib/systemd/system/avahi-daemon.service
%{_prefix}/lib/systemd/system/avahi-daemon.socket
%{_datadir}/dbus-1/system-services/org.freedesktop.Avahi.service

%pre
%sysusers_create_package %{name} %{SOURCE2}

%post
%systemd_post %{name}-daemon.service

%preun
%systemd_preun %{name}-daemon.service

#----------------------------------------------------------------------------

%package dnsconfd
Summary:	Avahi DNS configuration server
Group:		System/Servers
Requires:	%{name} = %{EVRD}

%description dnsconfd
avahi-dnsconfd is a small daemon which may be used to configure
conventional DNS servers using mDNS in a DHCP-like fashion.
Especially useful on IPv6.

%files dnsconfd
%{_sysconfdir}/%{name}/%{name}-dnsconfd.action
%{_prefix}/lib/systemd/system/avahi-dnsconfd.service
%{_sbindir}/%{name}-dnsconfd
%{_mandir}/man8/%{name}-dnsconfd.8*
%{_mandir}/man8/%{name}-dnsconfd.action.8*

%post dnsconfd
%systemd_post %{name}-dnsconfd.service

%preun dnsconfd
%systemd_preun %{name}-dnsconfd.service

#----------------------------------------------------------------------------
%package x11
Summary:	Graphical tools for Avahi
Group:		System/Servers
Requires:	%{name} = %{EVRD}

%description x11
Graphical tools for Avahi.
It includes avahi-discover-standalone.

%files x11
%if %{with gtk3}
%{_bindir}/%{name}-discover-standalone
%{_bindir}/bshell
%{_bindir}/bssh
%{_bindir}/bvnc
%{_datadir}/applications/bssh.desktop
%{_datadir}/applications/bvnc.desktop
%{_datadir}/%{name}/interfaces/%{name}-discover.ui
%{_mandir}/man1/bshell.1*
%{_mandir}/man1/bssh.1*
%{_mandir}/man1/bvnc.1*
%endif
%if %{with python}
%{_datadir}/applications/%{name}-discover.desktop
%endif
#----------------------------------------------------------------------------

%if %{with python}
%package python3
Summary:	Python bindings and utilities for Avahi
Group:		System/Libraries
Requires:	python3egg(twisted)
Requires:	python3egg(dbus-python)
Requires:	%{name}
Requires:	%{name}-x11

%description python3
Python bindings and utilities for Avahi.
It includes avahi-bookmarks and avahi-discover.

%files python3
%{_bindir}/%{name}-bookmarks
%{_bindir}/%{name}-discover
%{py3_puresitedir}/%{name}/*.py*
%{py3_puresitedir}/%{name}/__pycache__
%{_mandir}/man1/%{name}-bookmarks.1*
%endif

#----------------------------------------------------------------------------

%if %{with mono}
%package sharp
Summary:	Mono bindings for Avahi
Group:		System/Libraries
BuildRequires:	mono-tools
BuildRequires:	mono-devel
BuildRequires:	pkgconfig(gtk-sharp-2.0)
#gw this is needed by mono-find-requires:
#BuildRequires:	avahi-ui-devel
Requires:	%{lib_client_name} = %{EVRD}
Requires:	%{lib_common_name} = %{EVRD}
Requires:	%{lib_glib_name} = %{EVRD}

%description sharp
Mono bindings for Avahi.

%files sharp
%{_prefix}/lib/mono/%{name}-sharp/%{name}-sharp.dll
%{_prefix}/lib/mono/gac/%{name}-sharp/
%{_libdir}/pkgconfig/%{name}-sharp.pc
%{_libdir}/pkgconfig/%{name}-ui-sharp.pc
#----------------------------------------------------------------------------

%package sharp-doc
Summary:	Development documentation for avahi-sharp
Group:		Development/Other
Requires(post,postun):	mono-tools

%description sharp-doc
This package contains the API documentation for the avahi-sharp in
Monodoc format.

%files sharp-doc
%{_usr}/lib/monodoc/sources/%{name}-sharp-docs.source
%{_usr}/lib/monodoc/sources/%{name}-sharp-docs.tree
%{_usr}/lib/monodoc/sources/%{name}-sharp-docs.zip

%post sharp-doc
%{_bindir}/monodoc --make-index > /dev/null

%postun sharp-doc
if [ "$1" = "0" -a -x %{_bindir}/monodoc ]; then %{_bindir}/monodoc --make-index > /dev/null
fi
%endif

#----------------------------------------------------------------------------

%package -n %{lib_client_name}
Summary:	Library for avahi-client
Group:		System/Libraries

%description -n %{lib_client_name}
Library for avahi-client.

%files -n %{lib_client_name}
%{_libdir}/lib%{name}-client.so.%{client_major}*

#----------------------------------------------------------------------------

%package -n %{develnameclient}
Summary:	Devel library for avahi-client
Group:		Development/C
Requires:	%{lib_client_name} = %{EVRD}
Provides:	%{client_name}-devel = %{EVRD}

%description -n %{develnameclient}
Devel library for avahi-client.

%files -n %{develnameclient}
%{_includedir}/%{name}-client
%{_libdir}/lib%{name}-client.so
%{_libdir}/pkgconfig/%{name}-client.pc

#----------------------------------------------------------------------------

%package -n %{lib_common_name}
Summary:	Library for avahi-common
Group:		System/Libraries

%description -n %{lib_common_name}
Library for avahi-common.

%files -n %{lib_common_name}
%{_libdir}/lib%{name}-common.so.%{common_major}*

#----------------------------------------------------------------------------

%package -n %{develnamecommon}
Summary:	Devel library for avahi-common
Group:		Development/C
Requires:	%{lib_common_name} = %{EVRD}
Provides:	%{common_name}-devel = %{EVRD}

%description -n %{develnamecommon}
Devel library for avahi-common.

%files -n %{develnamecommon}
%{_includedir}/%{name}-common
%{_libdir}/lib%{name}-common.so

#----------------------------------------------------------------------------

%package -n %{lib_core_name}
Summary:	Library for avahi-core
Group:		System/Libraries

%description -n %{lib_core_name}
Library for avahi-core.

%files -n %{lib_core_name}
%{_libdir}/lib%{name}-core.so.%{core_major}*

#----------------------------------------------------------------------------

%package -n %{develnamecore}
Summary:	Devel library for avahi-core
Group:		Development/C
Requires:	%{lib_core_name} = %{EVRD}
Provides:	%{core_name}-devel = %{EVRD}

%description -n %{develnamecore}
Devel library for avahi-core.

%files -n %{develnamecore}
%{_includedir}/%{name}-core
%{_libdir}/lib%{name}-core.so
%{_libdir}/pkgconfig/%{name}-core.pc

#----------------------------------------------------------------------------

%package -n %{lib_dns_sd_name}
Summary:	Avahi compatibility library for libdns_sd
Group:		System/Libraries

%description -n %{lib_dns_sd_name}
Avahi compatibility library for libdns_sd.

%files -n %{lib_dns_sd_name}
%{_libdir}/libdns_sd.so.%{dns_sd_major}*

#----------------------------------------------------------------------------

%package -n %{develnamedns_sd}
Summary:	Avahi devel compatibility library for libdns_sd
Group:		Development/C
Requires:	%{lib_dns_sd_name} = %{EVRD}
Provides:	%{dns_sd_name}-devel = %{EVRD}

%description -n %{develnamedns_sd}
Avahi devel compatibility library for libdns_sd.

%files -n %{develnamedns_sd}
%{_includedir}/%{name}-compat-libdns_sd
%{_libdir}/libdns_sd.so
%{_libdir}/pkgconfig/%{name}-compat-libdns_sd.pc

#----------------------------------------------------------------------------

%package -n %{lib_glib_name}
Summary:	Library for avahi-glib
Group:		System/Libraries

%description -n %{lib_glib_name}
Library for avahi-glib.

%files -n %{lib_glib_name}
%{_libdir}/lib%{name}-glib.so.%{glib_major}*

#----------------------------------------------------------------------------

%package -n %{develnameglib}
Summary:	Devel library for avahi-glib
Group:		Development/C
Requires:	%{lib_glib_name} = %{EVRD}
Provides:	%{glib_name}-devel = %{EVRD}

%description -n %{develnameglib}
Devel library for avahi-glib.

%files -n %{develnameglib}
%{_includedir}/%{name}-glib
%{_libdir}/lib%{name}-glib.so
%{_libdir}/pkgconfig/%{name}-glib.pc

#----------------------------------------------------------------------------

%package -n %{lib_gobject_name}
Summary:	Library for avahi-gobject
Group:		System/Libraries

%description -n %{lib_gobject_name}
Library for avahi-gobject.

%files -n %{lib_gobject_name}
%{_libdir}/lib%{name}-gobject.so.%{gobject_major}*

#----------------------------------------------------------------------------

%package -n %{develnamegobject}
Summary:	Devel library for avahi-gobject
Group:		Development/C
Requires:	%{lib_gobject_name} = %{EVRD}
Provides:	%{gobject_name}-devel = %{EVRD}

%description -n %{develnamegobject}
Devel library for avahi-gobject.

%files -n %{develnamegobject}
%{_includedir}/%{name}-gobject
%{_libdir}/lib%{name}-gobject.so
%{_libdir}/pkgconfig/%{name}-gobject.pc

#----------------------------------------------------------------------------

%package -n %{lib_howl_name}
Summary:	Avahi compatibility library for howl
Group:		System/Libraries

%description -n %{lib_howl_name}
Avahi compatibility library for howl.

%files -n %{lib_howl_name}
%{_libdir}/libhowl.so.%{howl_major}*

#----------------------------------------------------------------------------

%package -n %{develnamehowl}
Summary:	Avahi devel compatibility library for libdns_sd for howl
Group:		Development/C
Requires:	%{lib_howl_name} = %{EVRD}
Provides:	%{howl_name}-devel = %{EVRD}

%description -n %{develnamehowl}
Avahi devel compatibility library for libdns_sd for howl.

%files -n %{develnamehowl}
%{_includedir}/%{name}-compat-howl
%{_libdir}/libhowl.so
%{_libdir}/pkgconfig/%{name}-compat-howl.pc
%{_libdir}/pkgconfig/howl.pc

#----------------------------------------------------------------------------
%package -n %{lib_libevent_name}
Summary:	Library for avahi-libevent
Group:		System/Libraries

%description -n %{lib_libevent_name}
Library for avahi-libevent.

%files -n %{lib_libevent_name}
%{_libdir}/lib%{name}-libevent.so.%{libevent_major}*

%package -n %{develnamelibevent}
Summary:	Devel library for avahi-libevent
Group:		Development/C
Provides:	%{libevent_name}-devel = %{EVRD}
Requires:	%{lib_libevent_name} = %{EVRD}
Requires:	%{develnamecore} = %{EVRD}

%description -n %{develnamelibevent}
Devel library for avahi-libevent.

%files -n %{develnamelibevent}
%{_includedir}/%{name}-libevent
%{_libdir}/lib%{name}-libevent.so
%{_libdir}/pkgconfig/%{name}-libevent.pc
#----------------------------------------------------------------------------

%if %{with qt5}
%package -n %{lib_qt5_name}
Summary:	Library for avahi-qt5
Group:		System/Libraries

%description -n %{lib_qt5_name}
Library for avahi-qt5.

%files -n %{lib_qt5_name}
%{_libdir}/lib%{name}-qt5.so.%{qt5_major}*

#----------------------------------------------------------------------------
%package -n %{develnameqt5}
Summary:	Devel library for avahi-qt5
Group:		Development/C
Provides:	%{qt5_name}-devel = %{EVRD}
Requires:	%{lib_qt5_name} = %{EVRD}

%description -n %{develnameqt5}
Devel library for avahi-qt5.

%files -n %{develnameqt5}
%{_includedir}/%{name}-qt5
%{_libdir}/lib%{name}-qt5.so
%{_libdir}/pkgconfig/%{name}-qt5.pc
%endif

#----------------------------------------------------------------------------

%if %{with gtk3}
%package -n %{lib_ui_gtk3_name}
Summary:	Library for avahi-gtk3
Group:		System/Libraries

%description -n %{lib_ui_gtk3_name}
Library for avahi-gtk3.

%files -n %{lib_ui_gtk3_name}
%{_libdir}/lib%{name}-ui-gtk3.so.%{ui_gtk3_major}*
%endif

#----------------------------------------------------------------------------

%if %{with gtk3}
%package -n %{develnameui_gtk3}
Summary:	Devel library for avahi-gtk3
Group:		Development/C
Requires:	%{lib_ui_gtk3_name} = %{EVRD}
Provides:	%{ui_gtk3_name}-devel = %{EVRD}

%description -n %{develnameui_gtk3}
Devel library for avahi-gtk3.

%files -n %{develnameui_gtk3}
%{_libdir}/libavahi-ui-gtk3.so
%{_libdir}/pkgconfig/avahi-ui-gtk3.pc
%{_includedir}/avahi-ui/avahi-ui.h
%endif

#----------------------------------------------------------------------------

%prep
%autosetup -p1 -n %{name}-%{commit}

cp %{SOURCE1} avahi-hostname.sh
find . -name "Makefile*" -o -name "*.in" -o -name "*.ac" |sort |uniq |xargs sed -i -e 's,localstatedir\@/run,localstatedir\@,g;s,localstatedir}/run,localstatedir},g'
for f in config.guess config.sub ; do
        test -f /usr/share/libtool/config/$f || continue
        find . -type f -name $f -exec cp /usr/share/libtool/config/$f \{\} \;
done

%build
autoreconf -ifv
export PYTHON=%{__python3}
%configure \
	--disable-static \
%if %{without mono}
	--disable-mono \
%endif
	--disable-qt3 \
%if %{without qt5}
	--disable-qt5 \
%else
	--enable-qt5 \
%endif
%if %{without python}
	--disable-python \
%endif
	--localstatedir=%{_localstatedir} \
	--runstatedir=%{_rundir} \
	--with-avahi-priv-access-group="avahi" \
	--enable-compat-libdns_sd \
	--enable-compat-howl \
	--with-distro=mandriva \
	--enable-introspection=no \
	--with-systemdsystemunitdir=%{_prefix}/lib/systemd/system \
%if %{without gtk3}
	--disable-gtk3
%else
	--enable-gtk3
%endif

%make_build

%install
%make_install

mkdir -p %{buildroot}%{_localstatedir}/avahi

# https://bugzilla.rosalinux.ru/show_bug.cgi?id=9855
# https://wiki.archlinux.org/index.php/Avahi#Troubleshooting
sed -i -e 's,^publish-workstation=no,publish-workstation=yes,g' \
	-e 's,^use-ipv6=yes,use-ipv6=no,g' \
	%{buildroot}/%{_sysconfdir}/%{name}/avahi-daemon.conf
# validate
grep -q '^publish-workstation=yes' \
	%{buildroot}/%{_sysconfdir}/%{name}/avahi-daemon.conf || exit 1
grep -q '^use-ipv6=no' \
	%{buildroot}/%{_sysconfdir}/%{name}/avahi-daemon.conf || exit 1

# We have a seperate Avahi service in openssh package
rm -f %{buildroot}/%{_sysconfdir}/%{name}/services/ssh.service
rm -f %{buildroot}/%{_sysconfdir}/%{name}/services/sftp-ssh.service
ln -s avahi-compat-howl.pc %{buildroot}%{_libdir}/pkgconfig/howl.pc
%if "%{_lib}" != "lib" && %{with mono}
mkdir -p %{buildroot}%{_prefix}/lib
mv %{buildroot}%{_libdir}/mono %{buildroot}%{_prefix}/lib
perl -pi -e "s/%{_lib}/lib/" %{buildroot}%{_libdir}/pkgconfig/avahi-{,ui-}sharp.pc
%endif

# install hostname.d hook
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/hostname.d/
install -m755 avahi-hostname.sh %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/hostname.d/avahi

rm -rf %{buildroot}%{_initrddir}/%{name}-daemon
rm -rf %{buildroot}%{_initrddir}/%{name}-dnsconfd

rm -f %{buildroot}%{_sysconfdir}/avahi/services/sftp-ssh.service

mkdir -p %{buildroot}%{_sysusersdir}
install -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf

%find_lang %{name}