summaryrefslogtreecommitdiff
path: root/net/freeswitch/Makefile
blob: 9eb21fa1fe5a7b9e882122255a9d2212b3a98988 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
#
# Copyright (C) 2009-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
#
include $(TOPDIR)/rules.mk


PKG_NAME:=freeswitch
PKG_SOURCE_PROTO:=git
PKG_DISTNAME:=$(PKG_NAME)_$(PKG_SOURCE_PROTO)
PKG_VERSION:=1.5.14


#
# The latest FS git hash in PKG_SOURCE_VERSION can be obtained from
# http://fisheye.freeswitch.org
#
FS_WITH_DEFAULT_HEAD:=6eb59c711989774fb797d1c447e3d63aac84826b
PKG_SOURCE_URL:=https://stash.$(PKG_NAME).org/scm/fs/$(PKG_NAME).git
PKG_SOURCE_VERSION:=$(if $(CONFIG_FS_WITH_LATEST_HEAD),$(shell git ls-remote $(PKG_SOURCE_URL) HEAD|cut -f1),$(FS_WITH_DEFAULT_HEAD))
FS_WITH_DEFAULT_HEAD_SHORT:=$(shell echo $(FS_WITH_DEFAULT_HEAD)|cut -b -7)
PKG_SOURCE_VERSION_SHORT:=$(shell echo $(PKG_SOURCE_VERSION)|cut -b -7)
PKG_RELEASE:=$(PKG_SOURCE_VERSION_SHORT)
PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(if $(CONFIG_FS_WITH_LOCAL_SOURCE),$(FS_WITH_DEFAULT_HEAD_SHORT).tar.xz,$(PKG_SOURCE_VERSION_SHORT).tar.bz2)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)


PKG_FIXUP:=libtool autoreconf
PKG_BUILD_PARALLEL:=0

PKG_LICENSE:=MPL-1.1
PKG_LICENSE_FILES:=COPYING

ifeq ($(CONFIG_DEVEL),y)
	export QUILT=1
endif


PKG_BUILD_DEPENDS:= \
	FS_WITH_CORE_LIBEDIT_SUPPORT:libedit \
	FS_WITH_MYSQL:libmysqlclient \
	FS_WITH_POSTGRESQL:libpq \
	FS_WITH_SQLITE3:libsqlite3 \
	FS_WITH_APR_SCTP:sctp \


TAR_OPTIONS+= --strip-components=1 -C $(PKG_BUILD_DIR)


FS_MOD_AVAILABLE:= \
	abstraction \
	alsa \
	amr \
	amrwb \
	avmd \
	basic \
	bert \
	blacklist \
	bv \
	callcenter \
	cdr-csv \
	cdr-mongodb \
	cdr-pg-csv \
	cdr-sqlite \
	celt \
	cepstral \
	cidlookup \
	cluechoo \
	codec2 \
	commands \
	conference \
	console \
	curl \
	dahdi-codec \
	db \
	dialplan-asterisk \
	dialplan-directory \
	dialplan-xml \
	dingaling \
	directory \
	distributor \
	dptools \
	easyroute \
	enum \
	erlang-event \
	esf \
	event-multicast \
	event-socket \
	event-zmq \
	expr \
	fifo \
	file-string \
	flite \
	format-cdr \
	freetdm \
	fsk \
	fsv \
	g723-1 \
	g729 \
	gsmopen \
	h26x \
	h323 \
	hash \
	html5 \
	httapi \
	http-cache \
	ilbc \
	isac \
	java \
	json-cdr \
	lcr \
	ldap \
	local-stream \
	logfile \
	loopback \
	lua \
	managed \
	memcache \
	mongo \
	mp4 \
	mp4v \
	native-file \
	nibblebill \
	opus \
	oreka \
	perl \
	portaudio \
	portaudio-stream \
	posix-timer \
	python \
	radius-cdr \
	rayo \
	redis \
	rss \
	rtc \
	rtmp \
	sangoma-codec \
	say-de \
	say-en \
	say-es \
	say-fa \
	say-fr \
	say-hu \
	say-it \
	say-nl \
	say-pt \
	say-ru \
	say-th \
	say-zh \
	shell-stream \
	silk \
	siren \
	skel \
	skinny \
	skypopen \
	sms \
	snapshot \
	snipe-hunt \
	sndfile \
	snmp \
	snom \
	sofia \
	sonar \
	spandsp \
	spidermonkey \
	spidermonkey-core-db \
	spidermonkey-curl \
	spidermonkey-odbc \
	spidermonkey-socket \
	spidermonkey-teletone \
	spy \
	ssml \
	stress \
	syslog \
	timerfd \
	tone-stream \
	tts-commandline \
	unimrcp \
	valet-parking \
	verto \
	vmd \
	voicemail \
	voicemail-ivr \
	vp8 \
	xml-cdr \
	xml-curl \
	xml-ldap \
	xml-rpc \
	xml-radius \
	xml-scgi \
	yaml \


PKG_CONFIG_DEPENDS:= \
	CONFIG_FS_WITH_ALSA \
	CONFIG_FS_WITH_APR_CONFIG_SWITCHES \
	CONFIG_FS_WITH_APR_IPV6 \
	CONFIG_FS_WITH_APR_SCTP \
	CONFIG_FS_WITH_APR_THREADS \
	CONFIG_FS_WITH_BUILTIN_ZRTP \
	CONFIG_FS_WITH_CORE_LIBEDIT_SUPPORT \
	CONFIG_FS_WITH_DEFAULT_HEAD \
	CONFIG_FS_WITH_ERLANG \
	CONFIG_FS_WITH_FHS \
	CONFIG_FS_WITH_FIXED_POINT \
	CONFIG_FS_WITH_LATEST_HEAD \
	CONFIG_FS_WITH_LOCAL_SOURCE \
	CONFIG_FS_WITH_LZMA \
	CONFIG_FS_WITH_MYSQL \
	CONFIG_FS_WITH_ODBC \
	CONFIG_FS_WITH_OGG \
	CONFIG_FS_WITH_OPENSSL \
	CONFIG_FS_WITH_OPENWRT_SOURCE \
	CONFIG_FS_WITH_OPT \
	CONFIG_FS_WITH_POSTGRESQL \
	CONFIG_FS_WITH_PYTHON \
	CONFIG_FS_WITH_SILENT_RULES \
	CONFIG_FS_WITH_SQLITE3 \
	CONFIG_FS_WITH_SRTP \
	CONFIG_FS_WITH_SRTP_GENERIC_AESICM \
	CONFIG_FS_WITH_SRTP_KERNEL_LINUX \
	CONFIG_FS_WITH_SRTP_OPENSSL \
	CONFIG_FS_WITH_STUN \
	CONFIG_FS_WITH_VISIBILITY \
	$(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-mod-%,$(FS_MOD_AVAILABLE)) \


include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk


ifneq ($(CONFIG_CCACHE),)
TARGET_CC=$(TARGET_CC_NOCACHE)
TARGET_CXX=$(TARGET_CXX_NOCACHE)
endif


ifneq ($(CONFIG_CCACHE),)
TARGET_CC=$(TARGET_CC_NOCACHE)
TARGET_CXX=$(TARGET_CXX_NOCACHE)
endif


define Package/$(PKG_NAME)/Default
  SECTION:=net
  CATEGORY:=Network
  SUBMENU:=Telephony
  URL:=http://www.$(PKG_NAME).org/
  MAINTAINER:=Mazi Lo <openwrt.mazilo@recursor.net>
endef


define Package/$(PKG_NAME)
$(call Package/$(PKG_NAME)/Default)
  MENU:=1
  TITLE:=FreeSWITCH open source telephony platform ($(PKG_SOURCE_VERSION_SHORT))
  DEPENDS:=+FS_WITH_CORE_LIBEDIT_SUPPORT:libedit +FS_WITH_OPENSSL:libopenssl +libcurl +libdb47 +libgdbm $(ICONV_DEPENDS) $(INTL_DEPENDS) +libjpeg +libncurses +libopenldap +libpcre +libpthread +librt +libspeex +libspeexdsp +FS_WITH_SQLITE3:libsqlite3 +FS_WITH_SRTP:libsrtp_git +SSP_SUPPORT:libssp +libstdcpp +libuuid +PACKAGE_$(PKG_NAME)-mod-perl:perl
endef


define Package/$(PKG_NAME)/description
  FreeSWITCH is an open source telephony platform designed to
  facilitate the creation of voice and chat driven products 
  scaling from a soft-phone up to a soft-switch.
endef


define Package/$(PKG_NAME)/config
  source "$(SOURCE)/Config.in"
endef


define Package/$(PKG_NAME)-mod-spandsp/config
    config FS_WITH_FIXED_POINT
    depends on PACKAGE_$(PKG_NAME)-mod-spandsp
    bool "Enable fixed point support for spandsp (may degrade performance)"
    default n
    help
	Compile spandsp package with a fixed point support. ONLY enabled this
	option when necessary, i.e. CPU doesn't support floating computation.
endef


define Package/$(PKG_NAME)-example-config
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH example config (commented)
  DEPENDS:= $(PKG_NAME)
endef


define Package/$(PKG_NAME)-example-config/description
  The default configuration included with FreeSWITCH. It is not intended to be
  a final product, and is thus moved to /usr/share/$(PKG_NAME)/examples/conf to
  be an example of how FreeSWITCH can be configured.
endef


define Package/$(PKG_NAME)-config-upstream-defaults
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH upstream config
  DEPENDS:= $(PKG_NAME)
endef


define Package/$(PKG_NAME)-config-upstream-defaults/description
  The default configuration included with FreeSWITCH. It is not intended to be
  a final product, and but is included for those who don't want to use the
  OpenWRT configuration and/or want to try things as prepared by upstream.
endef


define Package/$(PKG_NAME)-config-minimal
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH minimal config
  DEPENDS:= $(PKG_NAME)
endef


define Package/$(PKG_NAME)-config-minimal/description
  A minimal configuration of FreeSWITCH for OpenWRT devices. Is what the UCI
  configuration began with.
endef


define Package/$(PKG_NAME)-collection-upstream-defaults
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FS upstream def sample conf
  DEPENDS:= $(PKG_NAME) \
		+$(PKG_NAME)-config-upstream-defaults \
		+$(PKG_NAME)-mod-callcenter \
		+$(PKG_NAME)-mod-codec2 \
		+$(PKG_NAME)-mod-commands \
		+$(PKG_NAME)-mod-conference \
		+$(PKG_NAME)-mod-curl \
		+$(PKG_NAME)-mod-dialplan-xml \
		+$(PKG_NAME)-mod-dingaling \
		+$(PKG_NAME)-mod-dptools \
		+$(PKG_NAME)-mod-event-socket \
		+$(PKG_NAME)-mod-g723-1 \
		+$(PKG_NAME)-mod-g729 \
		+$(PKG_NAME)-mod-hash \
		+$(PKG_NAME)-mod-http-cache \
		+$(PKG_NAME)-mod-ilbc \
		+$(PKG_NAME)-mod-local-stream \
		+$(PKG_NAME)-mod-lua \
		+$(PKG_NAME)-mod-native-file \
		+$(PKG_NAME)-mod-say-en \
		+$(PKG_NAME)-mod-sndfile \
		+$(PKG_NAME)-mod-sofia \
		+$(PKG_NAME)-mod-syslog \
		+$(PKG_NAME)-mod-tone-stream \
		+$(PKG_NAME)-mod-xml-curl \
		+$(PKG_NAME)-mod-xml-rpc \
		+$(PKG_NAME)-tools
endef


define Package/$(PKG_NAME)-collection-minimal
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH minimal package collection
  DEFAULT:=y
  DEPENDS:= $(PKG_NAME) \
		+$(PKG_NAME)-config-minimal \
		+$(PKG_NAME)-mod-codec2 \
		+$(PKG_NAME)-mod-commands \
		+$(PKG_NAME)-mod-dialplan-xml \
		+$(PKG_NAME)-mod-dptools \
		+$(PKG_NAME)-mod-event-socket \
		+$(PKG_NAME)-mod-hash \
		+$(PKG_NAME)-mod-local-stream \
		+$(PKG_NAME)-mod-sndfile \
		+$(PKG_NAME)-mod-sofia \
		+$(PKG_NAME)-mod-syslog \
		+$(PKG_NAME)-mod-tone-stream \
		+$(PKG_NAME)-tools
endef


define Package/$(PKG_NAME)-sounds-en-08KHz
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH 8KHz english sounds
  DEPENDS:= $(PKG_NAME)
endef


define Package/$(PKG_NAME)-sounds-en-16KHz
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH 16KHz english sounds
  DEPENDS:= +$(PKG_NAME)-sounds-en-08KHz
endef


define Package/$(PKG_NAME)-sounds-en-32KHz
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH 32KHz english sounds
  DEPENDS:= +$(PKG_NAME)-sounds-en-16KHz
endef


define Package/$(PKG_NAME)-sounds-en-48KHz
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH 48KHz english sounds
  DEPENDS:= +$(PKG_NAME)-sounds-en-32KHz
endef


define Package/$(PKG_NAME)-sounds-moh-08KHz
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH 8KHz music-on-hold sounds
  DEPENDS:= $(PKG_NAME)
endef


define Package/$(PKG_NAME)-sounds-moh-16KHz
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH 16KHz music-on-hold sounds
  DEPENDS:= +$(PKG_NAME)-sounds-moh-08KHz
endef


define Package/$(PKG_NAME)-sounds-moh-32KHz
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH 32KHz music-on-hold sounds
  DEPENDS:= +$(PKG_NAME)-sounds-moh-16KHz
endef


define Package/$(PKG_NAME)-sounds-moh-48KHz
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH 48KHz music-on-hold sounds
  DEPENDS:= +$(PKG_NAME)-sounds-moh-32KHz
endef


define Package/$(PKG_NAME)-tools
$(call Package/$(PKG_NAME)/Default)
  TITLE:=FreeSWITCH control tools
  DEPENDS:= $(PKG_NAME)
endef


define Download/files
 define Download/$(1)
  FILE:=$(2)
  URL:=$(if $(4),$(4),http://files.$(PKG_NAME).org)/$(5)
  MD5SUM:=$(3)
 endef
 define Prepare/$(1)
  $(LN) $(DL_DIR)/$(2) $(PKG_BUILD_DIR)/$(6)
 endef
 $$(eval $$(call Download,$(1)))
endef


MAKE_INSTALL_TARGETS:=install


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-celt),)
 $(eval $(call Download/files,celt,celt-0.10.0.tar.gz,a656f6176e9be84027c0e51ceedd710f,,downloads/libs/,libs/))
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-curl),)
 $(eval $(call Download/files,json-cdr,json-c-0.9.tar.gz,4653b3b9c568bb9c782178abfaac128d,,downloads/libs/,libs/))
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-event-zmq),)
 $(eval $(call Download/files,event-zmq,zeromq-2.1.9.tar.gz,94c5e0262a79c5f82bc0b178c1f8a33d,http://download.zeromq.org http://download.zeromq.org/historic,,libs/))
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-flite),)
 $(eval $(call Download/files,flite,flite-2.0.0-release.tar.bz2,645db96ffc296cbb6d37f231cc1cc6b2,,downloads/libs/,libs/))
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-mongo),)
 $(eval $(call Download/files,mongo,mongo-c-driver-0.92.2.tar.gz,afab25a33abd3f1e0ba79c5a9da92651,,downloads/libs/,libs/))
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-opus),)
 $(eval $(call Download/files,opus,opus-1.1-p2.tar.gz,5da7cb39925bfb7dd60ea2e810f71357,,downloads/libs/,libs/))
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-ldap)|$(CONFIG_PACKAGE_$(PKG_NAME)-mod-xml-ldap),)
 $(eval $(call Download/files,ldap,openldap-2.4.19.tar.gz,4a6dab2711fcf141f19bb680bc335887,,downloads/libs/,libs/))
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en-08KHz),)
 $(eval $(call Download/files,sounds-en-08KHz,$(PKG_NAME)-sounds-en-us-callie-8000-1.0.50.tar.gz,14cccba7b5c56f027fea391f1e0ee2d6,,,))
	MAKE_INSTALL_TARGETS+= sounds-install
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en-16KHz),)
 $(eval $(call Download/files,sounds-en-16KHz,$(PKG_NAME)-sounds-en-us-callie-16000-1.0.50.tar.gz,261f42e310baa97cc4dcfdc51971aff8,,,))
	MAKE_INSTALL_TARGETS+= hd-sounds-install
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en-32KHz),)
 $(eval $(call Download/files,sounds-en-32KHz,$(PKG_NAME)-sounds-en-us-callie-32000-1.0.50.tar.gz,f204512fadc49a3267ff4a5e899b77a5,,,))
	MAKE_INSTALL_TARGETS+= uhd-sounds-install
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en-48KHz),)
 $(eval $(call Download/files,sounds-en-48KHz,$(PKG_NAME)-sounds-en-us-callie-48000-1.0.50.tar.gz,8622a77a5d6dcf5e47bdf30d6a33e27c,,,))
	MAKE_INSTALL_TARGETS+= cd-sounds-install
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh-08KHz),)
 $(eval $(call Download/files,sounds-moh-08KHz,$(PKG_NAME)-sounds-music-8000-1.0.50.tar.gz,c1f62dc26360f39f8eb442d5efd0a3aa,,,))
	MAKE_INSTALL_TARGETS+= moh-install
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh-16KHz),)
 $(eval $(call Download/files,sounds-moh-16KHz,$(PKG_NAME)-sounds-music-16000-1.0.50.tar.gz,d253e26baa85e0e2e727a1cb1cca898e,,,))
	MAKE_INSTALL_TARGETS+= hd-moh-install
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh-32KHz),)
 $(eval $(call Download/files,sounds-moh-32KHz,$(PKG_NAME)-sounds-music-32000-1.0.50.tar.gz,0e3ee69cb4ba2813ed0d3f7811332b63,,,))
	MAKE_INSTALL_TARGETS+= uhd-moh-install
endif


ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh-48KHz),)
 $(eval $(call Download/files,sounds-moh-48KHz,$(PKG_NAME)-sounds-music-48000-1.0.50.tar.gz,873a62df1ab3be4191eb2488156ec2c2,,,))
	MAKE_INSTALL_TARGETS+= cd-moh-install
endif


#
# XXX: -fgnu89-inline is not supported on all compiler versions, so only enable it on avr32 where it solves build issues
#
ifneq ($(CONFIG_avr32),)
  TARGET_CFLAGS += -fgnu89-inline
  TARGET_CXXFLAGS += -fgnu89-inline
endif


ifneq ($(CONFIG_USE_EGLIBC),)
  ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
    TARGET_CFLAGS += -DNO_GETLOGIN
  endif
endif


FS_TARGET_CFLAGS:= $(TARGET_CFLAGS) -DLUA_USE_LINUX $(FPIC) -std=gnu99 -Wno-format -Wno-unused-variable -Wno-unused-but-set-variable -Wno-implicit-function-declaration
FS_TARGET_CXXFLAGS:= $(TARGET_CXXFLAGS)
FS_TARGET_CPPFLAGS:= -I. -I./lua $(TARGET_CPPFLAGS) $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-json-cdr),-Wno-error) -I`ls -d $(PKG_BUILD_DIR)/libs/*|grep tiff`/libtiff -I$(PKG_BUILD_DIR)/libs/spandsp/src


#MAKE_FLAGS += \
#	OPT_FLAGS+="$(TARGET_CFLAGS)"


MAKE_VARS += \
	AR="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)ar" \
	CC="$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)" \
	CXX="$(TOOLCHAIN_DIR)/bin/$(TARGET_CXX)" \
	RANLIB="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)ranlib" \
	CC_FOR_BUILD="$(HOSTCC)" \


CONFIGURE_ARGS+= \
	--host=$(GNU_TARGET_NAME) \
	--build=$(GNU_HOST_NAME) \
	--prefix="/usr/share/$(PKG_NAME)" \
	--bindir="/usr/bin" \
	--libdir="/usr/lib" \
	--srcdir="$(PKG_BUILD_DIR)" \
	--sysconfdir="/etc/$(PKG_NAME)" \
	--with-modinstdir="/usr/lib/$(PKG_NAME)" \
	--with-random="/dev/urandom" \
	$(call autoconf_bool,CONFIG_FS_WITH_BUILTIN_ZRTP,zrtp) \
	$(call autoconf_bool,CONFIG_FS_WITH_CORE_LIBEDIT_SUPPORT,core-libedit-support) \
	$(call autoconf_bool,CONFIG_FS_WITH_FHS,fhs) \
	$(call autoconf_bool,CONFIG_FS_WITH_APR_IPV6,ipv6) \
	$(call autoconf_bool,CONFIG_FS_WITH_LZMA,lzma) \
	$(call autoconf_bool,CONFIG_FS_WITH_ODBC,core-odbc-support) \
	$(call autoconf_bool,CONFIG_FS_WITH_OPT,optimization) \
	$(call autoconf_bool,CONFIG_FS_WITH_POSTGRESQL,core-pgsql-pkgconfig) \
	$(call autoconf_bool,CONFIG_FS_WITH_POSTGRESQL,core-pgsql-support) \
	$(call autoconf_bool,CONFIG_FS_WITH_SILENT_RULES,silent-rules) \
	$(call autoconf_bool,CONFIG_FS_WITH_SRTP,srtp) \
	$(call autoconf_bool,CONFIG_FS_WITH_SRTP_GENERIC_AESICM,generic-aesicm) \
	$(call autoconf_bool,CONFIG_FS_WITH_SRTP_KERNEL_LINUX,kernel-linux) \
	$(call autoconf_bool,CONFIG_FS_WITH_SRTP_OPENSSL,openssl) \
	$(call autoconf_bool,CONFIG_FS_WITH_STUN,stun) \
	$(call autoconf_bool,CONFIG_FS_WITH_APR_THREADS,threads) \
	$(call autoconf_bool,CONFIG_FS_WITH_VISIBILITY,visibility) \
	$(call autoconf_bool,CONFIG_PACKAGE_$(PKG_NAME)-mod-spandsp && CONFIG_FS_WITH_FIXED_POINT,fixed-point) \
	$(call autoconf_bool,CONFIG_PACKAGE_$(PKG_NAME)-mod-spandsp,builtin-tiff) \
	$(call autoconf_bool,CONFIG_PACKAGE_$(PKG_NAME)-mod-timerfd,timerfd-wrapper) \
	$(if $(CONFIG_FS_WITH_ODBC),--with-odbc-lib="$(STAGING_DIR)/usr/lib") \
	$(if $(CONFIG_FS_WITH_ODBC),--with-odbc="$(STAGING_DIR)/usr") \
	$(if $(CONFIG_FS_WITH_OGG),--with-ogg="$(STAGING_DIR)/usr") \
	$(if $(CONFIG_FS_WITH_OPENSSL),--with-openssl="pkg-config") \
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-celt),--with-ogg="$(STAGING_DIR)/usr",--without-ogg) \
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-erlang-event),--with-erlang="$(CONFIG_FS_WITH_ERLANG)",--without-erlang) \
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-java),--with-java="$(STAGING_DIR)/usr",--without-java) \
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-python),--with-python="$(CONFIG_FS_WITH_PYTHON)",--without-python) \
	$(if ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-curl)|$(CONFIG_PACKAGE_$(PKG_NAME)-mod-xml-cdr)|$(CONFIG_PACKAGE_$(PKG_NAME)-mod-xml-curl)),--with-libcurl="$(STAGING_DIR)/usr",--without-libcurl) \
	--with$(if $(CONFIG_FS_WITH_MYSQL),,out)-mysql \
	--with$(if $(CONFIG_FS_WITH_POSTGRESQL),,out)-pgsql \
	--with$(if $(CONFIG_FS_WITH_SQLITE3),,out)-sqlite3 \


ifeq ($(ARCH),arm)
	CONFIGURE_ARGS+= --enable-arm5e-asm \

endif


CONFIGURE_VARS+= \
	config_TARGET_CC="$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)" \
	config_TARGET_CXX="$(TOOLCHAIN_DIR)/bin/$(TARGET_CXX)" \
	config_TARGET_CFLAGS="$(FS_TARGET_CPPFLAGS) $(FS_TARGET_CFLAGS)" \
	config_TARGET_CXXFLAGS="$(FS_TARGET_CPPFLAGS) $(FS_TARGET_CXXFLAGS)" \
	config_TARGET_CPPFLAGS="$(FS_TARGET_CPPFLAGS)" \
	config_TARGET_READLINE_INC="$(FS_TARGET_CPPFLAGS)" \
	config_TARGET_READLINE_LIBS="-lreadline -lncurses" \
	config_TARGET_LIBS="-lpthread -ldl" \
	config_BUILD_CC="$(HOSTCC)" \
	CC_FOR_BUILD="$(HOSTCC)" \
	BUILDTOOL_CC="$(HOSTCC)" \
	BUILDTOOL_CCLD="$(HOSTCC)" \
	CC="$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)" \
	CXX="$(TOOLCHAIN_DIR)/bin/$(TARGET_CXX)" \
	AR="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)ar" \
	RANLIB="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)ranlib" \
	CFLAGS="$(FS_TARGET_CPPFLAGS) $(FS_TARGET_CFLAGS)" \
	CXXFLAGS="$(FS_TARGET_CPPFLAGS) $(FS_TARGET_CXXFLAGS)" \
	CPPFLAGS="$(FS_TARGET_CPPFLAGS)" \
	LDFLAGS="-L$(STAGING_DIR)/usr/lib/perl5/5.20/CORE -Wl,-rpath-link=\"$(STAGING_DIR)/usr/lib\" -Wl,-rpath-link=\"$(STAGING_DIR)/usr/lib$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-perl),/perl5/5.20/CORE)\" -Wl,-rpath,/usr/lib -Wl,-rpath,/usr/lib$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-perl),/perl5/5.20/CORE -lperl -lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc)" \
	HOST_CC="/usr/bin/cc" \
	HOST_CXX="/usr/bin/g++" \
	CROSS_COMPILE="1" \
	$(if $(CONFIG_FS_WITH_APR_SCTP),ac_cv_header_netinet_sctp_h="yes") \


define Build/Prepare
	$(call Build/Prepare/Default)
	$(call Prepare/celt)
	$(call Prepare/event-zmq)
	$(call Prepare/flite)
	$(call Prepare/json-cdr)
	$(call Prepare/ldap)
	$(call Prepare/mongo)
	$(call Prepare/opus)
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en-08KHz),$(call Prepare/sounds-en-08KHz))
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en-16KHz),$(call Prepare/sounds-en-16KHz))
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en-32KHz),$(call Prepare/sounds-en-32KHz))
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en-48KHz),$(call Prepare/sounds-en-48KHz))
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh-08KHz),$(call Prepare/sounds-moh-08KHz))
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh-16KHz),$(call Prepare/sounds-moh-16KHz))
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh-32KHz),$(call Prepare/sounds-moh-32KHz))
	$(if $(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh-48KHz),$(call Prepare/sounds-moh-48KHz))
ifeq ($(CONFIG_FS_WITH_LOCAL_SOURCE),y)
	(cd $(PKG_BUILD_DIR); $(if $(CONFIG_FS_WITH_LATEST_HEAD),if $(QUILT_CMD) top > /dev/null 2>&1 && [ -f $(PKG_BUILD_DIR)/patches/series ]; then $(QUILT_CMD) pop -a; fi; git pull;) if $(QUILT_CMD) next > /dev/null 2>&1; then $(QUILT_CMD) push -a; fi)
endif
endef


define Build/Configure
	(cd $(PKG_BUILD_DIR); $(if $(CONFIG_FS_WITH_LATEST_HEAD),if $(QUILT_CMD) top > /dev/null 2>&1 && [ -f $(PKG_BUILD_DIR)/patches/series ]; then $(QUILT_CMD) pop -a; fi; git pull;) if $(QUILT_CMD) next > /dev/null 2>&1; then $(QUILT_CMD) push -a; fi)
	(cd $(PKG_BUILD_DIR); $(AM_TOOL_PATHS) ./bootstrap.sh)
	$(foreach m,$(FS_MOD_AVAILABLE),
		$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-$(m)),
			$(SED) 's|^[ #]*\([^#]*/mod_$(subst -,_,$(m))\)$$$$|\1|g' $(PKG_BUILD_DIR)/modules.conf
		,
			$(SED) 's|^\([^#]*/mod_$(subst -,_,$(m))\)$$$$|#\1|g' $(PKG_BUILD_DIR)/modules.conf
		)
	)
	$(call Build/Configure/Default)
endef


define Build/Compile
	$(call Build/Compile/Default, \
		DESTDIR="$(PKG_INSTALL_DIR)" \
		all $(MAKE_INSTALL_TARGETS) \
	)
	$(SED) 's|^\([ \t]*\)\(.*\)"mod_console"\(.*\)$$$$|\1<!-- \2"mod_console"\3 -->|' $(PKG_INSTALL_DIR)/etc/$(PKG_NAME)/autoload_configs/modules.conf.xml
	$(SED) 's|^\([ \t]*\)<!-- *\(.*\)"mod_syslog"\(.*\) *-->\(.*\)$$$$|\1\2"mod_syslog"\3\4|' $(PKG_INSTALL_DIR)/etc/$(PKG_NAME)/autoload_configs/modules.conf.xml
endef


define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/include $(1)/usr
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME).{a,so*} $(1)/usr/lib/
endef


define Package/$(PKG_NAME)/install
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_DIR) $(1)/etc/default
	$(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
	$(INSTALL_DIR) $(1)/etc/$(PKG_NAME)/scripts
	$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_DIR) $(1)/usr/include
	$(INSTALL_DIR) $(1)/usr/lib
	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
	$(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
	$(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
	$(INSTALL_DATA) ./files/$(PKG_NAME).default $(1)/etc/default/$(PKG_NAME)
	$(INSTALL_DATA) ./files/$(PKG_NAME).hotplug $(1)/etc/hotplug.d/iface/90-$(PKG_NAME)
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
	$(CP) $(PKG_INSTALL_DIR)/usr/include $(1)/usr/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME)* $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/$(PKG_NAME).pc $(1)/usr/lib/pkgconfig/
	$(if $(1)/usr/lib/lib$(PKG_NAME).la,$(STAGING_DIR_HOST)/bin/sed -i -re 's|$(STAGING_DIR)||g;s|$(TOOLCHAIN_DIR)||g;s|$(TARGET_CROSS)|usr|g;s|$(REAL_GNU_TARGET_NAME)|usr|g;s|-L$(PKG_BUILD_DIR)(.*)libzrtp ||g;:a;s|((-[IL]/\S+\s).*)\2|\1|;ta' $(1)/usr/lib/lib$(PKG_NAME).la)
endef


define Package/$(PKG_NAME)-collection-upstream-defaults/install
	$(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
endef


define Package/$(PKG_NAME)-example-config/install
	$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/examples/conf
	$(CP) $(PKG_INSTALL_DIR)/etc/$(PKG_NAME)/* $(1)/usr/share/$(PKG_NAME)/examples/conf/
endef


define Package/$(PKG_NAME)-config-upstream-defaults/install
	$(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
	$(CP) $(PKG_INSTALL_DIR)/etc/$(PKG_NAME) $(1)/etc
endef


define Package/$(PKG_NAME)-collection-minimal/install
	$(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
endef


define Package/$(PKG_NAME)-collection-uci-minimal/install
	$(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
endef


define Package/$(PKG_NAME)-config-minimal/install
	$(INSTALL_DIR) $(1)/etc/$(PKG_NAME)/autoload_configs

	#
	# Copying dialplan directory jingle_profiles sip_profiles $(PKG_NAME).xml
	# fur_elise.ttml mime.types tetris.ttml tones.conf vars.xml
	#
	$(foreach f,dialplan directory jingle_profiles sip_profiles $(PKG_NAME).xml fur_elise.ttml mime.types tetris.ttml vars.xml,$(if $(PKG_BUILD_DIR)/conf/vanilla/$(f),$(CP) $(PKG_BUILD_DIR)/conf/vanilla/$(f) $(1)/etc/$(PKG_NAME);))

	#
	# Copying acl ivr modules post_load_modules switch timezones
	#
	$(foreach f,acl ivr modules post_load_modules switch timezones,$(if $(PKG_BUILD_DIR)/conf/vanilla/autoload_configs/$(f).conf.xml,$(CP) $(PKG_BUILD_DIR)/conf/vanilla/autoload_configs/$(f).conf.xml $(1)/etc/$(PKG_NAME)/autoload_configs;))
endef


define Package/$(PKG_NAME)-sounds-en-08KHz/install
	#
	# sounds-en-8KHz
	#
	for dir in `(cd $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en/us/callie;ls)`; \
	do \
		[ -d $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/8000 ] || $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/8000; \
		$(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/8000/* $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/8000; \
	done
endef


define Package/$(PKG_NAME)-sounds-en-16KHz/install
	#
	# sounds-en-16KHz
	#
	for dir in `(cd $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en/us/callie;ls)`; \
	do \
		[ -d $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/16000 ] || $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/16000; \
		$(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/16000/* $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/16000; \
	done
endef


define Package/$(PKG_NAME)-sounds-en-32KHz/install
	#
	# sounds-en-32KHz
	#
	for dir in `(cd $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en/us/callie;ls)`; \
	do \
		[ -d $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/32000 ] || $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/32000; \
		$(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/32000/* $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/32000; \
	done
endef


define Package/$(PKG_NAME)-sounds-en-48KHz/install
	#
	# sounds-en-48KHz
	#
	for dir in `(cd $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en/us/callie;ls)`; \
	do \
		[ -d $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/48000 ] || $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/48000; \
		$(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/48000/* $(1)/usr/share/$(PKG_NAME)/sounds/en/us/callie/$$$${dir}/48000; \
	done
endef


define Package/$(PKG_NAME)-sounds-moh-08KHz/install
	#
	# sounds-moh-8KHz
	#
	[ -d $(1)/usr/share/$(PKG_NAME)/sounds/music/8000 ] || $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds/music/8000;
	$(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/music/8000 $(1)/usr/share/$(PKG_NAME)/sounds/music;
endef


define Package/$(PKG_NAME)-sounds-moh-16KHz/install
	#
	# sounds-moh-16KHz
	#
	[ -d $(1)/usr/share/$(PKG_NAME)/sounds/music/16000 ] || $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds/music/16000;
	$(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/music/16000 $(1)/usr/share/$(PKG_NAME)/sounds/music;
endef


define Package/$(PKG_NAME)-sounds-moh-32KHz/install
	#
	# sounds-moh-32KHz
	#
	[ -d $(1)/usr/share/$(PKG_NAME)/sounds/music/32000 ] || $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds/music/32000;
	$(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/music/32000 $(1)/usr/share/$(PKG_NAME)/sounds/music;
endef


define Package/$(PKG_NAME)-sounds-moh-48KHz/install
	#
	# sounds-moh-48KHz
	#
	[ -d $(1)/usr/share/$(PKG_NAME)/sounds/music/48000 ] || $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds/music/48000;
	$(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/music/48000 $(1)/usr/share/$(PKG_NAME)/sounds/music;
endef


define Package/$(PKG_NAME)-tools/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/fs_cli $(1)/usr/bin/
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/fs_encode $(1)/usr/bin/
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/fs_ivrd $(1)/usr/bin/
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/fsxs $(1)/usr/bin/
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/gentls_cert $(1)/usr/bin/
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/tone2wav $(1)/usr/bin/
	$(STAGING_DIR_HOST)/bin/sed -i -re 's|$(ICONV_LDFLAGS)||g;s|$(INTL_LDFLAGS)||g;s|$(PKG_BUILD_DIR)|/usr|g;s|$(STAGING_DIR)||g;s|$(STAGING_DIR_HOST)|/usr|g;s|$(TOOLCHAIN_DIR)||g;s|$(TARGET_CROSS)|usr|g;s|$(REAL_GNU_TARGET_NAME)|usr|g;:a;s|((-[IL]/\S+\s).*)[ ,\n]\1|\1|;ta' $(1)/usr/bin/fsxs
endef


# 1. Name
# 2. Title
# 3. Selection on module configuration file
# 4. Files (module files include different names)
# 5. Files (supporting files include different names)
# 6. Inter module depends
# 7. Extra depends
#
define BuildPlugin
  define Package/$(PKG_NAME)-mod-$(1)
    $$(call Package/$(PKG_NAME)/Default)
    TITLE:= FS $(2) module
    DEPENDS:= $(PKG_NAME) $(foreach m,$(6),+$(PKG_NAME)-mod-$(m)) $(7)
  endef

  define Package/$(PKG_NAME)-mod-$(1)/install
	[ -z "mod_$(subst -,_,$(1))" ] || $(INSTALL_DIR) $$(1)/usr/lib/$(PKG_NAME)

	for f in $$$$(realpath $$$$(wildcard $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME)/mod_$(subst -,_,$(1)).*)) $$$$(wildcard $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME)/$(4)_*); \
	do \
		$(CP) $$$$$$$${f} $$(1)/usr/lib/$(PKG_NAME)/; \
	done

	#
	# mod_$(subst -,_,$(1)): $(5)
	#
	$(foreach f,$(5),[ -d $(dir $$(1)/usr/${f}) ] || $(INSTALL_DIR) $(dir $$(1)/usr/${f});$(CP) $$$$(wildcard $(PKG_INSTALL_DIR)/usr/${f}*) $(dir $$(1)/usr/${f});)

	#
	# mod_$(subst -,_,$(1)): Clean installed library control files from referencig to OpenWRT PATH.
	#
	$(STAGING_DIR_HOST)/bin/sed -i -re 's|$(STAGING_DIR)||g;s|$(TOOLCHAIN_DIR)||g;s|$(TARGET_CROSS)|usr|g;s|$(REAL_GNU_TARGET_NAME)|usr|g;s|-L$(PKG_BUILD_DIR)(.*)libzrtp ||g;s|-L$(PKG_BUILD_DIR)(.*)libtiff ||g;:a;s|((-[IL]/\S+\s).*)\2|\1|;ta' $(foreach l,`find $$(1)/usr/lib -name "*.la" -print`,$(l))

	#
	# 1. mod_$(subst -,_,$(1)) XML configuration files from: $$$$(patsubst $(PKG_BUILD_DIR)/%,%,$$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/conf/$(3)/autoload_configs/$(subst -,_,$(1)).conf.xml)))
	#
	$$$$(if $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/conf/$(3)/autoload_configs/$(subst -,_,$(1)).conf.xml)),[ -d $$(1)/etc/$(PKG_NAME)/autoload_configs ] || $(INSTALL_DIR) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(CP) $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/conf/$(3)/autoload_configs/$(subst -,_,$(1)).conf.xml)) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(SED) 's|/usr/local/lib|/usr/lib|g;s|/usr/local|/etc|g' $$(1)/etc/$(PKG_NAME)/autoload_configs/$(subst -,_,$(1)).conf.xml)

	#
	# 2. mod_$(subst -,_,$(1)) XML configuration files from: $$$$(patsubst $(PKG_BUILD_DIR)/%,%,$$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/$(3)/$(1)/*/$(subst -,_,$(1)).conf.xml)))
	#
	$$$$(if $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/$(3)/$(1)/*/$(subst -,_,$(1)).conf.xml)),[ -d $$(1)/etc/$(PKG_NAME)/autoload_configs ] || $(INSTALL_DIR) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(CP) $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/$(3)/$(1)/*/$(subst -,_,$(1)).conf.xml)) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(SED) 's|/usr/local/lib|/usr/lib|g;s|/usr/local|/etc|g' $$(1)/etc/$(PKG_NAME)/autoload_configs/$(subst -,_,$(1)).conf.xml)

	#
	# 3. mod_$(subst -,_,$(1)) XML configuration files from: $$$$(patsubst $(PKG_BUILD_DIR)/%,%,$$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/conf/autoload_configs/$(subst -,_,$(1)).conf.xml)))
	#
	$$$$(if $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/conf/autoload_configs/$(subst -,_,$(1)).conf.xml)),[ -d $$(1)/etc/$(PKG_NAME)/autoload_configs ] || $(INSTALL_DIR) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(CP) $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/conf/autoload_configs/$(subst -,_,$(1)).conf.xml)) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(SED) 's|/usr/local/lib|/usr/lib|g;s|/usr/local|/etc|g' $$(1)/etc/$(PKG_NAME)/autoload_configs/$(subst -,_,$(1)).conf.xml)

	#
	# 4. mod_$(subst -,_,$(1)) XML configuration files from: $$$$(patsubst $(PKG_BUILD_DIR)/%,%,$$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/conf*/$(subst -,_,$(1)).conf.xml)))
	#
	$$$$(if $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/conf*/$(subst -,_,$(1)).conf.xml)),[ -d $$(1)/etc/$(PKG_NAME)/autoload_configs ] || $(INSTALL_DIR) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(CP) $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/conf*/$(subst -,_,$(1)).conf.xml)) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(SED) 's|/usr/local/lib|/usr/lib|g;s|/usr/local|/etc|g' $$(1)/etc/$(PKG_NAME)/autoload_configs/$(subst -,_,$(1)).conf.xml)

	#
	# 5. mod_$(subst -,_,$(1)) XML configuration files from: $$$$(patsubst $(PKG_BUILD_DIR)/%,%,$$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/$(subst -,_,$(1)).conf.xml)))
	#
	$$$$(if $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/$(subst -,_,$(1)).conf.xml)),[ -d $$(1)/etc/$(PKG_NAME)/autoload_configs ] || $(INSTALL_DIR) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(CP) $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/src/$(3)/*/mod_$(subst -,_,$(1))/$(subst -,_,$(1)).conf.xml)) $$(1)/etc/$(PKG_NAME)/autoload_configs;$(SED) 's|/usr/local/lib|/usr/lib|g;s|/usr/local|/etc|g' $$(1)/etc/$(PKG_NAME)/autoload_configs/$(subst -,_,$(1)).conf.xml)

	#
	# 6. Additional configuration files for mod_$(subst -,_,$(1)) from: $$$$(patsubst $(PKG_BUILD_DIR)/%,%,$$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/conf/$(3)/$(1)/*.$(1))))
	#
	$$$$(if $$$$(firstword $$$$(wildcard $(PKG_BUILD_DIR)/conf/$(3)/$(1)/*.$(1))),[ -d $$(1)/etc/$(PKG_NAME)/$(1) ] || $(INSTALL_DIR) $$(1)/etc/$(PKG_NAME)/$(1);$(CP) $(PKG_BUILD_DIR)/conf/$(3)/$(1) $$(1)/etc/$(PKG_NAME))
  endef

  define Package/$(PKG_NAME)-mod-$(1)/postinst
#!/bin/sh
sed -i -e 's|^\([ \t]*\)<!-- *\(.*\)"mod_$(subst -,_,$(1))"\(.*\) *-->\(.*\)$$$$|\1\2"mod_$(subst -,_,$(1))"\3\4|' $$$${IPKG_INSTROOT}/etc/$(PKG_NAME)/autoload_configs/modules.conf.xml
  endef

  define Package/$(PKG_NAME)-mod-$(1)/prerm
#!/bin/sh
sed -i -e 's|^\([ \t]*\)\(.*\)"mod_$(subst -,_,$(1))"\(.*\)$$$$|\1<!-- \2"mod_$(subst -,_,$(1))"\3 -->|' $$$${IPKG_INSTROOT}/etc/$(PKG_NAME)/autoload_configs/modules.conf.xml
  endef

  $$(eval $$(call BuildPackage,$(PKG_NAME)-mod-$(1)))
endef


$(eval $(call BuildPackage,$(PKG_NAME)))
$(eval $(call BuildPackage,$(PKG_NAME)-collection-upstream-defaults))
$(eval $(call BuildPackage,$(PKG_NAME)-collection-minimal))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds-en-08KHz))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds-en-16KHz))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds-en-32KHz))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds-en-48KHz))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds-moh-08KHz))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds-moh-16KHz))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds-moh-32KHz))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds-moh-48KHz))
$(eval $(call BuildPackage,$(PKG_NAME)-tools))
$(eval $(call BuildPackage,$(PKG_NAME)-example-config))
$(eval $(call BuildPackage,$(PKG_NAME)-config-upstream-defaults))
$(eval $(call BuildPackage,$(PKG_NAME)-config-minimal))


#
# $(eval $(call BuildPlugin,Name,Title,Selection on module Conf File,Files,Inter Depends,Extra Depends))
#
$(eval $(call BuildPlugin,abstraction,An Abstraction To API Call,vanilla,,,,))
$(eval $(call BuildPlugin,alsa,Alsa Endpoint,vanilla,,,,+FS_WITH_ALSA:alsa-lib @FS_WITH_ALSA))
$(eval $(call BuildPlugin,amr,Adaptive Multi-Rate On Bandwidth Codec,vanilla,,,,))
$(eval $(call BuildPlugin,amrwb,Wide Band AMR,vanilla,,,,))
$(eval $(call BuildPlugin,avmd,Advanced Voice Mail Detection,vanilla,,,,))
$(eval $(call BuildPlugin,basic,BASIC,vanilla,,,,))
$(eval $(call BuildPlugin,bert,Naive Bit Error Rate Tester,vanilla,,,,))
$(eval $(call BuildPlugin,blacklist,Blacklist,vanilla,,,,))
$(eval $(call BuildPlugin,bv,BroadVoice 16/32-bit Audio Codec,vanilla,,,,))
$(eval $(call BuildPlugin,callcenter,Call Center,vanilla,,,,))
$(eval $(call BuildPlugin,cdr-csv,CSV-CDR Handler,mod,,,,)) # ~/conf
$(eval $(call BuildPlugin,cdr-mongodb,MongoDB CDR logger,vanilla,,,,))
$(eval $(call BuildPlugin,cdr-pg-csv,PostgreSQL CDR Handler,vanilla,,,,+coreutils +FS_WITH_POSTGRESQL:libpq @FS_WITH_POSTGRESQL))
$(eval $(call BuildPlugin,cdr-sqlite,SQLite3 CDR Handler,vanilla,,,,@FS_WITH_SQLITE3))
$(eval $(call BuildPlugin,celt,CELT Ultra-Low Delay Codec,vanilla,,,,+ogg_svn))
$(eval $(call BuildPlugin,cepstral,Cepstral Interface,vanilla,,,,@BROKEN)) # needs <swift.h>
$(eval $(call BuildPlugin,cidlookup,Data Query For CID->NAME Services,mod,,,,+libcurl)) # ~/conf
$(eval $(call BuildPlugin,cluechoo,Framework Demo,vanilla,,,,))
$(eval $(call BuildPlugin,codec2,CoDec 2,,,,,))
$(eval $(call BuildPlugin,commands,API Commands,vanilla,,,,))
$(eval $(call BuildPlugin,conference,Conference Room,vanilla,,,,))
$(eval $(call BuildPlugin,console,Console Logger,vanilla,,,,))
$(eval $(call BuildPlugin,curl,HTTP Request,vanilla,,,,+libcurl))
$(eval $(call BuildPlugin,dahdi-codec,DAHDI Codecs,vanilla,,,,))
$(eval $(call BuildPlugin,db,Database Backend,vanilla,,,,+libdb47))
$(eval $(call BuildPlugin,dialplan-asterisk,Asterisk Dialplan Parser,vanilla,,,,))
$(eval $(call BuildPlugin,dialplan-directory,Dialplan Directory,vanilla,,,,))
$(eval $(call BuildPlugin,dialplan-xml,Dialplan-XML Interface,vanilla,,,,))
$(eval $(call BuildPlugin,dingaling,Jabber Interface,vanilla,,,,+libopenssl))
$(eval $(call BuildPlugin,directory,Search By Name Directory IVR,vanilla,,,,))
$(eval $(call BuildPlugin,distributor,Simple Robin-Round Load,vanilla,,,,))
$(eval $(call BuildPlugin,dptools,Dialplan Tools,vanilla,,,,))
$(eval $(call BuildPlugin,easyroute,Simple DID Routing,vanilla,,,,))
$(eval $(call BuildPlugin,enum,ENUM Routing,,,,,+libldns @BROKEN))
$(eval $(call BuildPlugin,erlang-event,Erlang Event Handler,vanilla,,,,+erlang))
$(eval $(call BuildPlugin,esf,Extra SIP Functionality,vanilla,,,,))
$(eval $(call BuildPlugin,event-multicast,Multicast Event Handler,vanilla,,,,))
$(eval $(call BuildPlugin,event-socket,Socket Event Handler,vanilla,,,,))
$(eval $(call BuildPlugin,event-zmq,Socket Event Handler By Zero MQ,vanilla,,,,+libuuid))
$(eval $(call BuildPlugin,expr,Expression Evaluation,vanilla,,,,))
$(eval $(call BuildPlugin,fifo,FIFO,vanilla,,,,))
$(eval $(call BuildPlugin,file-string,Streaming Multiple Sound Files Sequentially,vanilla,,,,@OBSOLETE)) # merged into dptools
$(eval $(call BuildPlugin,flite,Festival TTS,vanilla,,,,@(!(armeb||avr32)||BROKEN)))
$(eval $(call BuildPlugin,format-cdr,XML CDR Module to files or curl,vanilla,,,,))
$(eval $(call BuildPlugin,fsk,Bell-202 1200-Baud FSK Decoder,vanilla,,,,))
$(eval $(call BuildPlugin,fsv,Video Player / Recorder,vanilla,,,,))
$(eval $(call BuildPlugin,g723-1,G.723.1 Codec,vanilla,,,,))
$(eval $(call BuildPlugin,g729,G.729 Codec,vanilla,,,,))
$(eval $(call BuildPlugin,gsmopen,GSM Modem compatible Endpoint,mod,,,alsa,+FS_WITH_ALSA:alsa-lib +FS_WITH_LZMA:liblzma @FS_WITH_ALSA @BROKEN)) # needs gsmlib
$(eval $(call BuildPlugin,h26x,H26X Linear Codec,vanilla,,,,))
$(eval $(call BuildPlugin,h323,H323 Endpoint,mod,,,,@BROKEN)) # Req. H323Plus v1.24.x or newer
$(eval $(call BuildPlugin,hash,API For Manipulating A Hash Table,vanilla,,,,))
#$(eval $(call BuildPlugin,html5,HTML5 Endpoint Module,vanilla,,,,)) # defunct?
$(eval $(call BuildPlugin,httapi,HT Telephony API and HTTP Caching,mod,,,,)) # ~/conf
$(eval $(call BuildPlugin,http-cache,HTTP GET With Caching,mod,,,,+libcurl)) # ~/conf
$(eval $(call BuildPlugin,ilbc,ILBC Codec,vanilla,,,,))
$(eval $(call BuildPlugin,isac,iSAC Codec,vanilla,,,,))
$(eval $(call BuildPlugin,java,Java Language Interface,vanilla,,,,@BROKEN)) # needs java
$(eval $(call BuildPlugin,json-cdr,JSon-CDR Interface,mod,,,,+libcurl))
$(eval $(call BuildPlugin,ldap,LDAP interface,vanilla,,,,+libopenldap))
$(eval $(call BuildPlugin,lcr,Least Cost Routing,vanilla,,,,))
$(eval $(call BuildPlugin,local-stream,Multi-Channel On Same Stream,vanilla,,,,))
$(eval $(call BuildPlugin,logfile,File Logger,vanilla,,,,))
$(eval $(call BuildPlugin,loopback,Loopback to Dialplan Endpoint,vanilla,,,,))
$(eval $(call BuildPlugin,lua,LUA Language Interface,vanilla,,,,))
$(eval $(call BuildPlugin,managed,Media Switching Software Library,vanilla,,,,+glib2 @BROKEN)) # needs Mono
$(eval $(call BuildPlugin,memcache,MemCached Interface,vanilla,,,,+libmemcached @BROKEN)) # Req host libmemcached
$(eval $(call BuildPlugin,mongo,A Document-Oriented Database,vanilla,,,,@BROKEN))
$(eval $(call BuildPlugin,mp4,MP4 File Format Support For Video,vanilla,,,,@BROKEN)) # needs host libmp4v2
$(eval $(call BuildPlugin,mp4v,MP4 CoDec Support For Video,vanilla,,,,))
$(eval $(call BuildPlugin,native-file,WAV Format Sound Player,vanilla,,,,))
$(eval $(call BuildPlugin,nibblebill,Credit / Debit Billing,vanilla,,,,))
$(eval $(call BuildPlugin,opus,Opus CoDec,vanilla,,,,))
$(eval $(call BuildPlugin,oreka,Media Recording with Oreka,vanilla,,,,))
$(eval $(call BuildPlugin,perl,Perl Language Interface,vanilla,,lib/perl5/5.20/$(PKG_NAME).la lib/perl5/5.20/$(PKG_NAME).pm lib/perl5/5.20/$(PKG_NAME).so,,+perl +libdb47 +libgdbm @ROKEN))
$(eval $(call BuildPlugin,portaudio,Portaudio To Sound Card Interface,vanilla,,,alsa,+FS_WITH_ALSA:alsa-lib @FS_WITH_ALSA @BROKEN)) # needs portaudio
$(eval $(call BuildPlugin,portaudio-stream,Portaudio Streaming Interface,vanilla,,,alsa,+FS_WITH_ALSA:alsa-lib @FS_WITH_ALSA @BROKEN)) # needs portaudio
$(eval $(call BuildPlugin,posix-timer,POSIX Compliant Soft Timer,vanilla,,,,))
$(eval $(call BuildPlugin,python,Python Language Interface,vanilla,,,,python @BROKEN))
$(eval $(call BuildPlugin,radius-cdr,Radius-CDR interface,vanilla,,,,@BROKEN)) # fails in freeradius-client
$(eval $(call BuildPlugin,rayo,Rayo server & node implementation,vanilla,,,,))
$(eval $(call BuildPlugin,redis,Redis Limited Backend,vanilla,,,,))
$(eval $(call BuildPlugin,rss,RRS Feeds via TTS,vanilla,,,,))
$(eval $(call BuildPlugin,rtc,RTC endpoint,vanilla,,,,))
$(eval $(call BuildPlugin,rtmp,RTMP Protocol Handler,vanilla,,,,))
$(eval $(call BuildPlugin,sangoma-codec,Sangoma Codec,vanilla,,,,@BROKEN)) # Req. Sangoma CoDec source
$(eval $(call BuildPlugin,say-de,German Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-en,English Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-es,Spanish Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-fa,Persian Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-fr,French Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-hu,Hungarian Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-it,Italian Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-nl,Dutch Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-pt,Portugeese Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-ru,Russian Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-th,Thai Say,vanilla,,,,))
$(eval $(call BuildPlugin,say-zh,Chineese Say,vanilla,,,,))
$(eval $(call BuildPlugin,shell-stream,Streaming Audio Through CLI,vanilla,,,,))
$(eval $(call BuildPlugin,silk,Skype(TM) SILK Codec Module,vanilla,,,,))
$(eval $(call BuildPlugin,siren,G.722.1 Codec,vanilla,,,,))
$(eval $(call BuildPlugin,skel,Template For New Module,vanilla,,,,))
$(eval $(call BuildPlugin,skinny,Skinny Call Control Protocol (SCCP),vanilla,,,,))
$(eval $(call BuildPlugin,skypopen,Skype Compatible Endpoint,mod,,,,@FEATURE_drawing-backend_libX11))
$(eval $(call BuildPlugin,sms,SMS,vanilla,,,,))
$(eval $(call BuildPlugin,snapshot,Record Audio Snapshot to File,vanilla,,,,))
$(eval $(call BuildPlugin,sndfile,Multi-Format Sound File,vanilla,,,,))
$(eval $(call BuildPlugin,snipe-hunt,Snipe Hunt (Simple Example Module),vanilla,,,,))
$(eval $(call BuildPlugin,snmp,SNMP AgentX Subagent,vanilla,,,,+libnetsnmp))
$(eval $(call BuildPlugin,snom,SNOM specific features,vanilla,,,,))
$(eval $(call BuildPlugin,sofia,SOFIA SIP,mod,,,,)) # ~/conf
$(eval $(call BuildPlugin,sonar,Sonar Ping Timer,vanilla,,,,))
$(eval $(call BuildPlugin,spandsp,Span DSP,mod,,,,+libjpeg +FS_WITH_LZMA:liblzma @FS_WITH_LZMA)) # ~/conf
$(eval $(call BuildPlugin,spidermonkey,JavaScript,vanilla,,,,@BROKEN)) # fails in js
$(eval $(call BuildPlugin,spidermonkey-core_db,JavaScript DB,vanilla,,,,@BROKEN))
$(eval $(call BuildPlugin,spidermonkey-curl,JavaScript Curl,vanilla,,,,@BROKEN))
$(eval $(call BuildPlugin,spidermonkey-odbc,JavaScript ODBC,vanilla,,,,@BROKEN))
$(eval $(call BuildPlugin,spidermonkey-socket,JavaScript Socket,vanilla,,,,@BROKEN))
$(eval $(call BuildPlugin,spidermonkey-teletone,JavaScript Teletone,vanilla,,,,@BROKEN))
$(eval $(call BuildPlugin,spy,User Spy,vanilla,,,,))
$(eval $(call BuildPlugin,ssml,SSML audio rendering format,mod,,,rayo,))
$(eval $(call BuildPlugin,stress,Voice Stress Detection,vanilla,,,,))
$(eval $(call BuildPlugin,syslog,SysLog logger,vanilla,,,,))
$(eval $(call BuildPlugin,timerfd,Linux Kernel timerfd API,vanilla,,,,))
$(eval $(call BuildPlugin,tone-stream,Tone Generation Stream,vanilla,,,,))
$(eval $(call BuildPlugin,tts-commandline,ASR TTS Command Interface,vanilla,,,,))
$(eval $(call BuildPlugin,unimrcp,UniMRCP (MRCP Client),vanilla,,,,@BROKEN))
$(eval $(call BuildPlugin,valet-parking,Valet Parking Application,vanilla,,,,))
$(eval $(call BuildPlugin,verto,HTML5 Verto interface,vanilla,,lib/perl5/5.20/MCAST.so lib/perl5/5.20/MCAST.la lib/perl5/5.20/MCAST.pm,perl rtc,@BROKEN))
$(eval $(call BuildPlugin,vmd,VoiceMail Beep Detection,vanilla,,,,))
$(eval $(call BuildPlugin,voicemail,VoiceMail,vanilla,,,,))
$(eval $(call BuildPlugin,voicemail-ivr,VoiceMail IVR,vanilla,,,,))
$(eval $(call BuildPlugin,vp8,VP8 Video Codec,vanilla,,,,))
$(eval $(call BuildPlugin,xml-cdr,XML-CDR Handler,vanilla,,,,+libcurl))
$(eval $(call BuildPlugin,xml-curl,XML-Curl Gateway,vanilla,,,,+libcurl))
$(eval $(call BuildPlugin,xml-ldap,LDAP-XML Gateway,vanilla,,,,+PACKAGE_$(PKG_NAME)-mod-ldap:libopenldap))
$(eval $(call BuildPlugin,xml-rpc,XML-RPC Interface,vanilla,,,,))
$(eval $(call BuildPlugin,xml-radius,Radius authentication and authorization,vanilla,,,,+freeradius-client @BROKEN)) # freeradius-client isn't yet supported by OpenWRT.
$(eval $(call BuildPlugin,xml-scgi,SCGI XML Gateway,vanilla,,,,))
$(eval $(call BuildPlugin,yaml,YAML language,vanilla,,,,+libyaml @BROKEN))