-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasterisk.spec
7261 lines (6573 loc) · 310 KB
/
asterisk.spec
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
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#%%global _rc 1
#%%global _beta 3
%global pjsip_version 2.12
%global jansson_version 2.14
%global optflags %{optflags} -Werror-implicit-function-declaration -DLUA_COMPAT_MODULE -fPIC
%ifarch s390 %{arm} aarch64 %{mips}
%global ldflags -Wl,--as-needed,--library-path=%{_libdir} %{__global_ldflags}
%else
%global ldflags -m%{__isa_bits} -Wl,--as-needed,--library-path=%{_libdir} %{__global_ldflags}
%endif
%global astvarrundir /run/asterisk
%global tmpfilesd 1
%global apidoc 0
%global mysql 1
%global odbc 1
%global postgresql 1
%global radius 1
%global snmp 1
%global misdn 0
%global ldap 1
%global gmime 1
%global corosync 1
%if 0%{?fedora} >= 34 || 0%{?rhel} >8
%global imap 0
%else
%global imap 1
%endif
%if 0%{?fedora} >= 21 || 0%{?rhel} >=7
%global jack 0
%else
%global jack 1
%endif
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 7
%global phone 0
%global xmpp 0
%global ices 0
%else
%global phone 1
%global xmpp 1
%global ices 1
%endif
%global meetme 0
%global ooh323 0
%global makeargs DEBUG= OPTIMIZE= DESTDIR=%{buildroot} ASTVARRUNDIR=%{astvarrundir} ASTDATADIR=%{_datadir}/asterisk ASTVARLIBDIR=%{_datadir}/asterisk ASTDBDIR=%{_localstatedir}/spool/asterisk NOISY_BUILD=1
Summary: The Open Source PBX
Name: asterisk
Version: 18.12.1
Release: %{?_rc||?_beta:0.}1%{?_rc:.rc%{_rc}}%{?_beta:.beta%{_beta}}%{?dist}.4
License: GPLv2
URL: http://www.asterisk.org/
Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{version}%{?_rc:-rc%{_rc}}%{?_beta:-beta%{_beta}}.tar.gz
Source1: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{version}%{?_rc:-rc%{_rc}}%{?_beta:-beta%{_beta}}.tar.gz.asc
Source2: asterisk-logrotate
Source3: menuselect.makedeps
Source4: menuselect.makeopts
Source5: asterisk.service
Source6: asterisk-tmpfiles
# GPG keyring with Asterisk developer signatures
# Created by running:
#gpg2 --no-default-keyring --keyring ./asterisk-gpgkeys.gpg \
#--keyserver=hkp://pool.sks-keyservers.net --recv-keys \
#0x21A91EB1F012252993E9BF4A368AB332B59975F3 \
#0x80CEBC345EC9FF529B4B7B808438CBA18D0CAA72 \
#0xCDBEE4CC699E200EB4D46BB79E76E3A42341CE04 \
#0x639D932D5170532F8C200CCD9C59F000777DCC45 \
#0x551F29104B2106080C6C2851073B0C1FC9B2E352 \
#0x57E769BC37906C091E7F641F6CB44E557BD982D8 \
#0x0F77FB5D216A02390B4C51DB7C2C8A8BCB3F61BD \
#0xF2FC93DB7587BD1FB49E045A5D984BE337191CE7
Source7: asterisk-gpgkeys.gpg
# Now building Asterisk with bundled pjproject, because they apply custom patches to it
Source8: https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/%{pjsip_version}/pjproject-%{pjsip_version}.tar.bz2
# Bundling jansson on EL7 and EL8, because the version in CentOS is too old
Source9: http://www.digip.org/jansson/releases/jansson-%{jansson_version}.tar.bz2
%if 0%{?fedora} || 0%{?rhel} >= 8
Patch0: asterisk-mariadb.patch
%endif
%if 0%{?fedora} || 0%{?rhel} >=7
Patch1: asterisk-16.1.0-explicit-python3.patch
%endif
Patch2: asterisk-18.4.0-astmm_ignore_for_console_board.patch
# Removed macros from ilbc library for RFC 3951 compatibility.
Patch3: asterisk-18.12.1-ilbc_macros.patch
# Asterisk now builds against a bundled copy of pjproject, as they apply some patches
# directly to pjproject before the build against it
Provides: bundled(pjproject) = %{pjsip_version}
# Does not build on s390x: https://bugzilla.redhat.com/show_bug.cgi?id=1465162
#ExcludeArch: s390x
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: ncurses
BuildRequires: perl
# core build requirements
BuildRequires: openssl-devel
BuildRequires: newt-devel
BuildRequires: ncurses-devel
BuildRequires: libcap-devel
%if 0%{?gmime}
BuildRequires: gtk2-devel
%endif
BuildRequires: libsrtp-devel
BuildRequires: perl-interpreter
BuildRequires: perl-generators
BuildRequires: popt-devel
%{?systemd_requires}
BuildRequires: systemd
BuildRequires: kernel-headers
# for res_http_post
%if 0%{?gmime}
BuildRequires: pkgconfig(gmime-3.0)
%endif
# for building docs
BuildRequires: doxygen
BuildRequires: graphviz
BuildRequires: libxml2-devel
BuildRequires: latex2html
# for building res_calendar_caldav
BuildRequires: neon-devel
BuildRequires: libical-devel
BuildRequires: libxml2-devel
# for codec_speex
BuildRequires: speex-devel >= 1.2
%if (0%{?fedora} > 21 || 0%{?rhel} > 7)
BuildRequires: speexdsp-devel >= 1.2
%endif
# for format_ogg_vorbis
BuildRequires: libogg-devel
BuildRequires: libvorbis-devel
# codec_gsm
BuildRequires: gsm-devel
# additional dependencies
BuildRequires: SDL-devel
BuildRequires: SDL_image-devel
# cli
BuildRequires: libedit-devel
# codec_ilbc
BuildRequires: ilbc-devel
# res_rtp_asterisk
BuildRequires: libuuid-devel
# res_resolver_unbound
BuildRequires: unbound-devel
%if 0%{?corosync}
BuildRequires: corosynclib-devel
%endif
BuildRequires: alsa-lib-devel
BuildRequires: libcurl-devel
BuildRequires: dahdi-tools-devel >= 2.0.0
BuildRequires: dahdi-tools-libs >= 2.0.0
BuildRequires: libpri-devel >= 1.4.12
BuildRequires: libss7-devel >= 1.0.1
BuildRequires: spandsp-devel >= 0.0.5-0.1.pre4
BuildRequires: libtiff-devel
BuildRequires: libjpeg-turbo-devel
BuildRequires: lua-devel
%if 0%{?jack}
BuildRequires: jack-audio-connection-kit-devel
%endif
BuildRequires: libresample-devel
BuildRequires: bluez-libs-devel
BuildRequires: libtool-ltdl-devel
BuildRequires: portaudio-devel >= 19
BuildRequires: sqlite-devel
BuildRequires: freetds-devel
%if 0%{?misdn}
BuildRequires: mISDN-devel
%endif
%if 0%{?ldap}
BuildRequires: openldap-devel
%endif
%if 0%{?mysql}
%if 0%{?rhel} >= 7
BuildRequires: mariadb-devel
%else
BuildRequires: mariadb-connector-c-devel
%endif
%endif
%if 0%{?odbc}
BuildRequires: libtool-ltdl-devel
BuildRequires: unixODBC-devel
%endif
%if 0%{?postgresql}
%if 0%{?rhel}
BuildRequires: postgresql-devel
%else
BuildRequires: libpq-devel
%endif
%endif
%if 0%{?radius}
%if 0%{?fedora} || 0%{?rhel} < 7
BuildRequires: freeradius-client-devel
%else
BuildRequires: radcli-compat-devel
%endif
%endif
%if 0%{?snmp}
BuildRequires: net-snmp-devel
BuildRequires: lm_sensors-devel
%endif
%if 0%{?imap}
BuildRequires: uw-imap-devel
%endif
%if 0%{?fedora}
BuildRequires: jansson-devel
%else
Provides: bundled(jansson) = 2.11
%endif
# for gpg to be able to verify the signature
BuildRequires: libgcrypt
BuildRequires: make
Requires(pre): %{_sbindir}/useradd
Requires(pre): %{_sbindir}/groupadd
Requires(post): systemd-units
Requires(post): systemd-sysv
Requires(preun): systemd-units
Requires(postun): systemd-units
# chan_phone headers no longer in kernel headers
Obsoletes: asterisk-phone < %{version}
%description
Asterisk is a complete PBX in software. It runs on Linux and provides
all of the features you would expect from a PBX and more. Asterisk
does voice over IP in three protocols, and can interoperate with
almost all standards-based telephony equipment using relatively
inexpensive hardware.
%package ael
Summary: AEL (Asterisk Extension Logic) modules for Asterisk
Requires: asterisk = %{version}-%{release}
%description ael
AEL (Asterisk Extension Logic) mdoules for Asterisk
%package alsa
Summary: Modules for Asterisk that use Alsa sound drivers
Requires: asterisk = %{version}-%{release}
%package alembic
Summary: Alembic scripts for the Asterisk DB (realtime)
Requires: asterisk = %{version}-%{release}
%description alembic
Alembic scripts for the Asterisk DB
%description alsa
Modules for Asterisk that use Alsa sound drivers.
%if 0%{?apidoc}
%package apidoc
Summary: API documentation for Asterisk
Requires: asterisk = %{version}-%{release}
%description apidoc
API documentation for Asterisk.
%endif
%package calendar
Summary: Calendar applications for Asterisk
Requires: asterisk = %{version}-%{release}
%description calendar
Calendar applications for Asterisk.
%if 0%{?corosync}
%package corosync
Summary: Modules for Asterisk that use Corosync
Requires: asterisk = %{version}-%{release}
%description corosync
Modules for Asterisk that use Corosync.
%endif
%package curl
Summary: Modules for Asterisk that use cURL
Requires: asterisk = %{version}-%{release}
%description curl
Modules for Asterisk that use cURL.
%package dahdi
Summary: Modules for Asterisk that use DAHDI
Requires: asterisk = %{version}-%{release}
Requires: dahdi-tools >= 2.0.0
Requires(pre): %{_sbindir}/usermod
Provides: asterisk-zaptel = %{version}-%{release}
%description dahdi
Modules for Asterisk that use DAHDI.
%package devel
Summary: Development files for Asterisk
Requires: asterisk = %{version}-%{release}
%description devel
Development files for Asterisk.
%package fax
Summary: FAX applications for Asterisk
Requires: asterisk = %{version}-%{release}
%description fax
FAX applications for Asterisk
%package festival
Summary: Festival application for Asterisk
Requires: asterisk = %{version}-%{release}
Requires: festival
%description festival
Application for the Asterisk PBX that uses Festival to convert text to speech.
%package iax2
Summary: IAX2 channel driver for Asterisk
Requires: asterisk = %{version}-%{release}
%description iax2
IAX2 channel driver for Asterisk
%package hep
Summary: Modules for capturing SIP traffic using Homer (HEPv3)
Requires: asterisk = %{version}-%{release}
%description hep
Modules for capturing SIP traffic using Homer (HEPv3)
%if 0%{?ices}
%package ices
Summary: Stream audio from Asterisk to an IceCast server
Requires: asterisk = %{version}-%{release}
Requires: ices
%description ices
Stream audio from Asterisk to an IceCast server.
%endif
%if 0%{?jack}
%package jack
Summary: JACK resources for Asterisk
Requires: asterisk = %{version}-%{release}
%description jack
JACK resources for Asterisk.
%endif
%package lua
Summary: Lua resources for Asterisk
Requires: asterisk = %{version}-%{release}
%description lua
Lua resources for Asterisk.
%if 0%{?ldap}
%package ldap
Summary: LDAP resources for Asterisk
Requires: asterisk = %{version}-%{release}
%description ldap
LDAP resources for Asterisk.
%endif
%if 0%{?misdn}
%package misdn
Summary: mISDN channel for Asterisk
Requires: asterisk = %{version}-%{release}
Requires(pre): %{_sbindir}/usermod
%description misdn
mISDN channel for Asterisk.
%endif
%package mgcp
Summary: MGCP channel driver for Asterisk
Requires: asterisk = %{version}-%{release}
%description mgcp
MGCP channel driver for Asterisk
%package mobile
Summary: Mobile (BlueTooth) channel for Asterisk
Requires: asterisk = %{version}-%{release}
Requires(pre): %{_sbindir}/usermod
%description mobile
Mobile (BlueTooth) channel for Asterisk.
%package minivm
Summary: MiniVM applicaton for Asterisk
Requires: asterisk = %{version}-%{release}
%description minivm
MiniVM application for Asterisk.
%package mwi-external
Summary: Support for developing external voicemail applications
Requires: asterisk = %{version}-%{release}
Conflicts: asterisk-voicemail = %{version}-%{release}
Conflicts: asterisk-voicemail-implementation = %{version}-%{release}
%description mwi-external
Support for developing external voicemail applications
%if 0%{?mysql}
%package mysql
Summary: Applications for Asterisk that use MySQL
Requires: asterisk = %{version}-%{release}
%description mysql
Applications for Asterisk that use MySQL.
%endif
%if 0%{?odbc}
%package odbc
Summary: Applications for Asterisk that use ODBC (except voicemail)
Requires: asterisk = %{version}-%{release}
%description odbc
Applications for Asterisk that use ODBC (except voicemail)
%endif
%if 0%{?ooh323}
%package ooh323
Summary: H.323 channel for Asterisk using the Objective Systems Open H.323 for C library
Requires: asterisk = %{version}-%{release}
%description ooh323
H.323 channel for Asterisk using the Objective Systems Open H.323 for C library.
%endif
%package oss
Summary: Modules for Asterisk that use OSS sound drivers
Requires: asterisk = %{version}-%{release}
%description oss
Modules for Asterisk that use OSS sound drivers.
%package phone
Summary: Channel driver for Quicknet Technologies, Inc.'s Telephony cards
Requires: asterisk = %{version}-%{release}
%description phone
Quicknet Technologies, Inc.'s Telephony cards including the Internet
PhoneJACK, Internet PhoneJACK Lite, Internet PhoneJACK PCI, Internet
LineJACK, Internet PhoneCARD and SmartCABLE.
%package pjsip
Summary: SIP channel based upon the PJSIP library
Requires: asterisk = %{version}-%{release}
%description pjsip
SIP channel based upon the PJSIP library
%package portaudio
Summary: Modules for Asterisk that use the portaudio library
Requires: asterisk = %{version}-%{release}
%description portaudio
Modules for Asterisk that use the portaudio library.
%if 0%{?postgresql}
%package postgresql
Summary: Applications for Asterisk that use PostgreSQL
Requires: asterisk = %{version}-%{release}
%description postgresql
Applications for Asterisk that use PostgreSQL.
%endif
%if 0%{?radius}
%package radius
Summary: Applications for Asterisk that use RADIUS
Requires: asterisk = %{version}-%{release}
%description radius
Applications for Asterisk that use RADIUS.
%endif
%package skinny
Summary: Modules for Asterisk that support the SCCP/Skinny protocol
Requires: asterisk = %{version}-%{release}
%description skinny
Modules for Asterisk that support the SCCP/Skinny protocol.
%package sip
Summary: Legacy SIP channel driver for Asterisk
Requires: asterisk = %{version}-%{release}
%description sip
Legacy SIP channel driver for Asterisk
%if 0%{?snmp}
%package snmp
Summary: Module that enables SNMP monitoring of Asterisk
Requires: asterisk = %{version}-%{release}
# This subpackage depends on perl-libs, this Requires tracks versioning.
%description snmp
Module that enables SNMP monitoring of Asterisk.
%endif
%package sqlite
Summary: Sqlite modules for Asterisk
Requires: asterisk = %{version}-%{release}
%description sqlite
Sqlite modules for Asterisk.
%package tds
Summary: Modules for Asterisk that use FreeTDS
Requires: asterisk = %{version}-%{release}
%description tds
Modules for Asterisk that use FreeTDS.
%package unistim
Summary: Unistim channel for Asterisk
Requires: asterisk = %{version}-%{release}
%description unistim
Unistim channel for Asterisk
%package voicemail
Summary: Common Voicemail Modules for Asterisk
Requires: asterisk = %{version}-%{release}
Requires: asterisk-voicemail-implementation = %{version}-%{release}
Requires: /usr/bin/sox
Requires: /usr/sbin/sendmail
Conflicts: asterisk-mwi-external <= %{version}-%{release}
%description voicemail
Common Voicemail Modules for Asterisk.
%if 0%{?imap}
%package voicemail-imap
Summary: Store voicemail on an IMAP server
Requires: asterisk = %{version}-%{release}
Requires: asterisk-voicemail = %{version}-%{release}
Provides: asterisk-voicemail-implementation = %{version}-%{release}
Conflicts: asterisk-voicemail-odbc <= %{version}-%{release}
Conflicts: asterisk-voicemail-plain <= %{version}-%{release}
%description voicemail-imap
Voicemail implementation for Asterisk that stores voicemail on an IMAP
server.
%endif
%package voicemail-odbc
Summary: Store voicemail in a database using ODBC
Requires: asterisk = %{version}-%{release}
Requires: asterisk-voicemail = %{version}-%{release}
Provides: asterisk-voicemail-implementation = %{version}-%{release}
Conflicts: asterisk-voicemail-imap <= %{version}-%{release}
Conflicts: asterisk-voicemail-plain <= %{version}-%{release}
%description voicemail-odbc
Voicemail implementation for Asterisk that uses ODBC to store
voicemail in a database.
%package voicemail-plain
Summary: Store voicemail on the local filesystem
Requires: asterisk = %{version}-%{release}
Requires: asterisk-voicemail = %{version}-%{release}
Provides: asterisk-voicemail-implementation = %{version}-%{release}
Conflicts: asterisk-voicemail-imap <= %{version}-%{release}
Conflicts: asterisk-voicemail-odbc <= %{version}-%{release}
%description voicemail-plain
Voicemail implementation for Asterisk that stores voicemail on the
local filesystem.
%if 0%{?xmpp}
%package xmpp
Summary: Jabber/XMPP resources for Asterisk
Requires: asterisk = %{version}-%{release}
%description xmpp
Jabber/XMPP resources for Asterisk.
%endif
%prep
%if 0%{?fedora} || 0%{?rhel} >=8
# only verifying on Fedora and RHEL >=8 due to version of gpg
rpm -q libgcrypt
gpgv2 --keyring %{SOURCE7} %{SOURCE1} %{SOURCE0}
%endif
%setup -q -n asterisk-%{version}%{?_rc:-rc%{_rc}}%{?_beta:-beta%{_beta}}
# copy the pjproject tarball to the cache/ directory
mkdir cache
cp %{SOURCE8} cache/
%if 0%{?rhel} >= 7
cp %{SOURCE9} cache/
%endif
echo '*************************************************************************'
ls -altr cache/
pwd
echo '*************************************************************************'
%if 0%{?fedora} || 0%{?rhel} >=8
%patch0 -p1
%endif
%if 0%{?fedora} || 0%{?rhel} >=7
%patch1 -p1
%endif
%patch2 -p1
%patch3 -p1
cp %{S:3} menuselect.makedeps
cp %{S:4} menuselect.makeopts
# Fixup makefile so sound archives aren't downloaded/installed
%{__perl} -pi -e 's/^all:.*$/all:/' sounds/Makefile
%{__perl} -pi -e 's/^install:.*$/install:/' sounds/Makefile
# convert comments in one file to UTF-8
mv main/fskmodem.c main/fskmodem.c.old
iconv -f iso-8859-1 -t utf-8 -o main/fskmodem.c main/fskmodem.c.old
touch -r main/fskmodem.c.old main/fskmodem.c
rm main/fskmodem.c.old
chmod -x contrib/scripts/dbsep.cgi
%if ! 0%{?corosync}
%{__perl} -pi -e 's/^MENUSELECT_RES=(.*)$/MENUSELECT_RES=\1 res_corosync/g' menuselect.makeopts
%endif
%if ! 0%{?mysql}
%{__perl} -pi -e 's/^MENUSELECT_ADDONS=(.*)$/MENUSELECT_ADDONS=\1 res_config_mysql app_mysql cdr_mysql/g' menuselect.makeopts
%endif
%if ! 0%{?postgresql}
%{__perl} -pi -e 's/^MENUSELECT_RES=(.*)$/MENUSELECT_RES=\1 res_config_pgsql/g' menuselect.makeopts
%{__perl} -pi -e 's/^MENUSELECT_CDR=(.*)$/MENUSELECT_CDR=\1 cdr_pgsql/g' menuselect.makeopts
%{__perl} -pi -e 's/^MENUSELECT_CEL=(.*)$/MENUSELECT_CEL=\1 cel_pgsql/g' menuselect.makeopts
%endif
%if ! 0%{?radius}
%{__perl} -pi -e 's/^MENUSELECT_CDR=(.*)$/MENUSELECT_CDR=\1 cdr_radius/g' menuselect.makeopts
%{__perl} -pi -e 's/^MENUSELECT_CEL=(.*)$/MENUSELECT_CEL=\1 cel_radius/g' menuselect.makeopts
%endif
%if ! 0%{?snmp}
%{__perl} -pi -e 's/^MENUSELECT_RES=(.*)$/MENUSELECT_RES=\1 res_snmp/g' menuselect.makeopts
%endif
%if ! 0%{?misdn}
%{__perl} -pi -e 's/^MENUSELECT_CHANNELS=(.*)$/MENUSELECT_CHANNELS=\1 chan_misdn/g' menuselect.makeopts
%endif
%if ! 0%{?ices}
%{__perl} -pi -e 's/^MENUSELECT_APPS=(.*)$/MENUSELECT_APPS=\1 app_ices/g' menuselect.makeopts
%endif
%if ! 0%{?jack}
%{__perl} -pi -e 's/^MENUSELECT_APPS=(.*)$/MENUSELECT_APPS=\1 app_jack/g' menuselect.makeopts
%endif
%if ! 0%{?ldap}
%{__perl} -pi -e 's/^MENUSELECT_RES=(.*)$/MENUSELECT_RES=\1 res_config_ldap/g' menuselect.makeopts
%endif
%if ! 0%{?gmime}
%{__perl} -pi -e 's/^MENUSELECT_RES=(.*)$/MENUSELECT_RES=\1 res_http_post/g' menuselect.makeopts
%endif
%if ! 0%{xmpp}
%{__perl} -pi -e 's/^MENUSELECT_RES=(.*)$/MENUSELECT_RES=\1 res_xmpp/g' menuselect.makeopts
%{__perl} -pi -e 's/^MENUSELECT_CHANNELS=(.*)$/MENUSELECT_CHANNELS=\1 chan_motif/g' menuselect.makeopts
%endif
%if ! 0%{meetme}
%{__perl} -pi -e 's/^MENUSELECT_APPS=(.*)$/MENUSELECT_APPS=\1 app_meetme/g' menuselect.makeopts
%endif
%if ! 0%{ooh323}
%{__perl} -pi -e 's/^MENUSELECT_ADDONS=(.*)$/MENUSELECT_ADDONS=\1 chan_ooh323/g' menuselect.makeopts
%endif
%if ! 0%{imap}
%{__perl} -pi -e 's/^MENUSELECT_APPS=(.*)$/MENUSELECT_APPS=\1 app_voicemail_imap/g' menuselect.makeopts
%endif
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
export FFLAGS="%{optflags}"
export LDFLAGS="%{ldflags}"
export ASTCFLAGS=" "
sed -i '1s/env python/python3/' contrib/scripts/refcounter.py
#aclocal -I autoconf --force
#autoconf --force
#autoheader --force
./bootstrap.sh
pushd menuselect
%configure
popd
%if 0%{?fedora}
%if 0%{?imap}
%configure --with-imap=system --with-gsm=/usr --with-ilbc=/usr --with-libedit=yes --with-srtp --with-pjproject-bundled --with-externals-cache=%{_builddir}/asterisk-%{version}%{?_rc:-rc%{_rc}}%{?_beta:-beta%{_beta}}/cache LDFLAGS="%{ldflags}" NOISY_BUILD=1 CPPFLAGS="-fPIC"
%else
%configure --without-imap --with-gsm=/usr --with-ilbc=/usr --with-libedit=yes --with-srtp --with-pjproject-bundled --with-externals-cache=%{_builddir}/asterisk-%{version}%{?_rc:-rc%{_rc}}%{?_beta:-beta%{_beta}}/cache LDFLAGS="%{ldflags}" NOISY_BUILD=1 CPPFLAGS="-fPIC"
%endif
%else
%if 0%{?imap}
%configure --with-imap=system --with-gsm=/usr --with-ilbc=/usr --with-libedit=yes --with-srtp --with-jansson-bundled --with-pjproject-bundled --with-externals-cache=%{_builddir}/asterisk-%{version}%{?_rc:-rc%{_rc}}%{?_beta:-beta%{_beta}}/cache LDFLAGS="%{ldflags}" NOISY_BUILD=1 CPPFLAGS="-fPIC"
%else
%configure --without-imap --with-gsm=/usr --with-ilbc=/usr --with-libedit=yes --with-srtp --with-jansson-bundled --with-pjproject-bundled --with-externals-cache=%{_builddir}/asterisk-%{version}%{?_rc:-rc%{_rc}}%{?_beta:-beta%{_beta}}/cache LDFLAGS="%{ldflags}" NOISY_BUILD=1 CPPFLAGS="-fPIC"
%endif
%endif
%make_build menuselect-tree NOISY_BUILD=1
%{__perl} -n -i -e 'print unless /openr2/i' menuselect-tree
# Build with plain voicemail and directory
echo "### Building with plain voicemail and directory"
%make_build %{makeargs}
rm apps/app_voicemail.o apps/app_directory.o
mv apps/app_voicemail.so apps/app_voicemail_plain.so
mv apps/app_directory.so apps/app_directory_plain.so
%if 0%{?imap}
# Now build with IMAP storage for voicemail and directory
sed -i -e 's/^MENUSELECT_OPTS_app_voicemail=.*$/MENUSELECT_OPTS_app_voicemail=IMAP_STORAGE/' menuselect.makeopts
echo "### Building with IMAP voicemail and directory"
%make_build %{makeargs}
rm apps/app_voicemail.o apps/app_directory.o
mv apps/app_voicemail.so apps/app_voicemail_imap.so
mv apps/app_directory.so apps/app_directory_imap.so
%endif
# Now build with ODBC storage for voicemail and directory
sed -i -e 's/^MENUSELECT_OPTS_app_voicemail=.*$/MENUSELECT_OPTS_app_voicemail=ODBC_STORAGE/' menuselect.makeopts
echo "### Building with ODBC voicemail and directory"
%make_build %{makeargs}
rm apps/app_voicemail.o apps/app_directory.o
mv apps/app_voicemail.so apps/app_voicemail_odbc.so
mv apps/app_directory.so apps/app_directory_odbc.so
# so that these modules don't get built again
touch apps/app_voicemail.o apps/app_directory.o
touch apps/app_voicemail.so apps/app_directory.so
sed -i -e 's/^MENUSELECT_RES=\(.*\)\bres_mwi_external\b\(.*\)$/MENUSELECT_RES=\1 \2/g' menuselect.makeopts
sed -i -e 's/^MENUSELECT_RES=\(.*\)\bres_mwi_external_ami\b\(.*\)$/MENUSELECT_RES=\1 \2/g' menuselect.makeopts
sed -i -e 's/^MENUSELECT_RES=\(.*\)\bres_stasis_mailbox\b\(.*\)$/MENUSELECT_RES=\1 \2/g' menuselect.makeopts
sed -i -e 's/^MENUSELECT_RES=\(.*\)\bres_ari_mailboxes\b\(.*\)$/MENUSELECT_RES=\1 \2/g' menuselect.makeopts
sed -i -e 's/^MENUSELECT_APP=\(.*\)$/MENUSELECT_RES=\1 app_voicemail/g' menuselect.makeopts
%make_build %{makeargs}
%if 0%{?apidoc}
%make_build progdocs %{makeargs}
# fix dates so that we don't get multilib conflicts
find doc/api/html -type f -print0 | xargs --null touch -r ChangeLog
%endif
%install
rm -rf %{buildroot}
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
export FFLAGS="%{optflags}"
export LDFLAGS="%{ldflags}"
export ASTCFLAGS="%{optflags}"
make install %{makeargs}
make samples %{makeargs}
make install-headers %{makeargs}
install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/asterisk.service
rm -f %{buildroot}%{_sbindir}/safe_asterisk
install -D -p -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/logrotate.d/asterisk
rm %{buildroot}%{_libdir}/asterisk/modules/app_directory.so
rm %{buildroot}%{_libdir}/asterisk/modules/app_voicemail.so
%if 0%{?imap}
install -D -p -m 0755 apps/app_directory_imap.so %{buildroot}%{_libdir}/asterisk/modules/app_directory_imap.so
install -D -p -m 0755 apps/app_voicemail_imap.so %{buildroot}%{_libdir}/asterisk/modules/app_voicemail_imap.so
%endif
install -D -p -m 0755 apps/app_directory_odbc.so %{buildroot}%{_libdir}/asterisk/modules/app_directory_odbc.so
install -D -p -m 0755 apps/app_voicemail_odbc.so %{buildroot}%{_libdir}/asterisk/modules/app_voicemail_odbc.so
install -D -p -m 0755 apps/app_directory_plain.so %{buildroot}%{_libdir}/asterisk/modules/app_directory_plain.so
install -D -p -m 0755 apps/app_voicemail_plain.so %{buildroot}%{_libdir}/asterisk/modules/app_voicemail_plain.so
# create some directories that need to be packaged
mkdir -p %{buildroot}%{_datadir}/asterisk/moh
mkdir -p %{buildroot}%{_datadir}/asterisk/sounds
mkdir -p %{buildroot}%{_datadir}/asterisk/ast-db-manage
mkdir -p %{buildroot}%{_localstatedir}/lib/asterisk
mkdir -p %{buildroot}%{_localstatedir}/log/asterisk/cdr-custom
mkdir -p %{buildroot}%{_localstatedir}/spool/asterisk/festival
mkdir -p %{buildroot}%{_localstatedir}/spool/asterisk/monitor
mkdir -p %{buildroot}%{_localstatedir}/spool/asterisk/outgoing
mkdir -p %{buildroot}%{_localstatedir}/spool/asterisk/uploads
# We're not going to package any of the sample AGI scripts
rm -f %{buildroot}%{_datadir}/asterisk/agi-bin/*
# Don't package the sample voicemail user
rm -rf %{buildroot}%{_localstatedir}/spool/asterisk/voicemail/default
# Don't package example phone provision configs
rm -rf %{buildroot}%{_datadir}/asterisk/phoneprov/*
# these are compiled with -O0 and thus include unfortified code.
rm -rf %{buildroot}%{_sbindir}/hashtest
rm -rf %{buildroot}%{_sbindir}/hashtest2
#
rm -rf %{buildroot}%{_sysconfdir}/asterisk/app_skel.conf
rm -rf %{buildroot}%{_sysconfdir}/asterisk/config_test.conf
rm -rf %{buildroot}%{_sysconfdir}/asterisk/test_sorcery.conf
rm -rf %{buildroot}%{_libdir}/libasteriskssl.so
ln -s libasterisk.so.1 %{buildroot}%{_libdir}/libasteriskssl.so
%if 0%{?apidoc}
find doc/api/html -name \*.map -size 0 -delete
%endif
# copy the alembic scripts
cp -rp contrib/ast-db-manage %{buildroot}%{_datadir}/asterisk/ast-db-manage
%if %{tmpfilesd}
install -D -p -m 0644 %{SOURCE6} %{buildroot}/usr/lib/tmpfiles.d/asterisk.conf
mkdir -p %{buildroot}%{astvarrundir}
%endif
%if ! 0%{?mysql}
rm -f %{buildroot}%{_sysconfdir}/asterisk/*_mysql.conf
%endif
%if ! 0%{?postgresql}
rm -f %{buildroot}%{_sysconfdir}/asterisk/*_pgsql.conf
%endif
%if ! 0%{?misdn}
rm -f %{buildroot}%{_sysconfdir}/asterisk/misdn.conf
%endif
%if ! 0%{?snmp}
rm -f %{buildroot}%{_sysconfdir}/asterisk/res_snmp.conf
%endif
%if ! 0%{?ldap}
rm -f %{buildroot}%{_sysconfdir}/asterisk/res_ldap.conf
%endif
%if ! 0%{?corosync}
rm -f %{buildroot}%{_sysconfdir}/asterisk/res_corosync.conf
%endif
%if ! 0%{?phone}
rm -f %{buildroot}%{_sysconfdir}/asterisk/phone.conf
%endif
%if ! 0%{xmpp}
rm -f %{buildroot}%{_sysconfdir}/asterisk/xmpp.conf
rm -f %{buildroot}%{_sysconfdir}/asterisk/motif.conf
%endif
%if ! 0%{ooh323}
rm -f %{buildroot}%{_sysconfdir}/asterisk/ooh323.conf
%endif
%pre
%{_sbindir}/groupadd -r asterisk &>/dev/null || :
%{_sbindir}/useradd -r -s /sbin/nologin -d /var/lib/asterisk -M \
-c 'Asterisk User' -g asterisk asterisk &>/dev/null || :
%post
if [ $1 -eq 1 ] ; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
if [ "$1" -eq "0" ]; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable asterisk.service > /dev/null 2>&1 || :
/bin/systemctl stop asterisk.service > /dev/null 2>&1 || :
fi
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart asterisk.service >/dev/null 2>&1 || :
fi
%triggerun -- asterisk < 1.8.2.4-2
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply asterisk
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save asterisk >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del asterisk >/dev/null 2>&1 || :
/bin/systemctl try-restart asterisk.service >/dev/null 2>&1 || :
%pre dahdi
%{_sbindir}/usermod -a -G dahdi asterisk
%if 0%{?misdn}
%pre misdn
%{_sbindir}/usermod -a -G misdn asterisk
%endif
%files
%doc *.txt ChangeLog BUGS CREDITS configs
%license LICENSE
%doc doc/asterisk.sgml
%{_unitdir}/asterisk.service
%{_libdir}/libasteriskssl.so.1
%{_libdir}/libasteriskpj.so
%{_libdir}/libasteriskpj.so.2
%dir %{_libdir}/asterisk
%dir %{_libdir}/asterisk/modules
%{_libdir}/asterisk/modules/app_agent_pool.so
%{_libdir}/asterisk/modules/app_adsiprog.so
%{_libdir}/asterisk/modules/app_alarmreceiver.so
%{_libdir}/asterisk/modules/app_amd.so
%{_libdir}/asterisk/modules/app_attended_transfer.so
%{_libdir}/asterisk/modules/app_audiosocket.so
%{_libdir}/asterisk/modules/app_authenticate.so
%{_libdir}/asterisk/modules/app_blind_transfer.so