d040de5bd0821416e9564ddfb1ad7305caa8ce45
[packages.git] / net / freeswitch / Makefile
1 #
2 # Copyright (C) 2009-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 #
8 include $(TOPDIR)/rules.mk
9
10
11 PKG_NAME:=freeswitch
12 PKG_VERSION:=1.0.7
13 PKG_RELEASE:=1
14
15
16 #
17 # The latest FS git hash in PKG_REV can be obtained from http://fisheye.freeswitch.org
18 #
19 PKG_REV:=decb286114a685ea7920030f60f733c3fe34358c
20 PKG_SOURCE_VERSION:=$(PKG_REV)
21 PKG_SOURCE_PROTO:=git
22 PKG_SOURCE_URL:=git://git.$(PKG_NAME).org/$(PKG_NAME).git
23 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
24 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)_git-$(shell echo $(PKG_REV)|cut -b -9).tar.bz2
25 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
26
27
28 PKG_FIXUP:=libtool
29 PKG_BUILD_PARALLEL:=1
30
31
32 FS_MOD_AVAILABLE:= \
33         alsa \
34         amr \
35         amrwb \
36         avmd \
37         bv \
38         blacklist \
39         callcenter \
40         cdr-csv \
41         cdr-pg-csv \
42         cdr-sqlite \
43         celt \
44         cepstral \
45         cidlookup \
46         cluechoo \
47         codec2 \
48         commands \
49         conference \
50         console \
51         curl \
52         dahdi-codec \
53         db \
54         dialplan-asterisk \
55         dialplan-directory \
56         dialplan-xml \
57         dingaling \
58         directory \
59         distributor \
60         dptools \
61         easyroute \
62         enum \
63         erlang-event \
64         esf \
65         event-multicast \
66         event-socket \
67         event-zmq \
68         expr \
69         fifo \
70         file-string \
71         flite \
72         fsk \
73         fsv \
74         g723-1 \
75         g729 \
76         gsmopen \
77         h26x \
78         h323 \
79         hash \
80         ilbc \
81         java \
82         json-cdr \
83         lcr \
84         local-stream \
85         logfile \
86         loopback \
87         lua \
88         managed \
89         mp4 \
90         native-file \
91         nibblebill \
92         openzap \
93         opus \
94         portaudio \
95         portaudio-stream \
96         radius-cdr \
97         rss \
98         rtmp \
99         say-de \
100         say-en \
101         say-es \
102         say-fr \
103         say-hu \
104         say-it \
105         say-nl \
106         say-pt \
107         say-ru \
108         say-th \
109         say-zh \
110         shell-stream \
111         silk \
112         siren \
113         skinny \
114         skypopen \
115         sms \
116         snapshot \
117         snmp \
118         snipe-hunt \
119         sndfile \
120         snom \
121         sofia \
122         spandsp \
123         speex \
124         spidermonkey \
125         spidermonkey-core-db \
126         spidermonkey-curl \
127         spidermonkey-odbc \
128         spidermonkey-socket \
129         spidermonkey-teletone \
130         spy \
131         stress \
132         syslog \
133         tone-stream \
134         tts-commandline \
135         unimrcp \
136         valet-parking \
137         vmd \
138         voicemail \
139         xml-cdr \
140         xml-curl \
141         xml-rpc \
142         yaml \
143
144
145 PKG_CONFIG_DEPENDS:= \
146         CONFIG_FS_SOFIA_WITH_GNUTLS \
147         CONFIG_FS_SOFIA_WITH_IPV6 \
148         CONFIG_FS_SOFIA_WITH_ODBC \
149         CONFIG_FS_SOFIA_WITH_OPT \
150         CONFIG_FS_SOFIA_WITH_SCTP \
151         CONFIG_FS_SOFIA_WITH_ZRTP_GIT \
152         CONFIG_FS_SOFIA_WITHOUT_MYSQL \
153         $(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-mod-%,$(FS_MOD_AVAILABLE)) \
154
155
156 include $(INCLUDE_DIR)/package.mk
157 include $(INCLUDE_DIR)/nls.mk
158
159
160 define Package/$(PKG_NAME)/Default
161   SECTION:=net
162   CATEGORY:=Network
163   SUBMENU:=Telephony
164   URL:=http://www.$(PKG_NAME).org/
165   MAINTAINER:=Mazilo <OpenWRT@slickdeals.endjunk.com>
166 endef
167
168
169 define Package/$(PKG_NAME)
170 $(call Package/$(PKG_NAME)/Default)
171   TITLE:=FreeSWITCH open source telephony platform
172   DEPENDS:= +libreadline +libncurses +libpthread +libstdcpp
173   MENU:=1
174 endef
175
176
177 define Package/$(PKG_NAME)/description
178   FreeSWITCH is an open source telephony platform designed to 
179   facilitate the creation of voice and chat driven products scaling 
180   from a soft-phone up to a soft-switch.  See http://wiki.$(PKG_NAME).org
181 endef
182
183
184 define Package/$(PKG_NAME)/config
185     config FS_SOFIA_WITH_IPV6
186     depends on PACKAGE_$(PKG_NAME)
187     bool "Compile with IPV6 support"
188     default y
189     help
190             Compile $(PKG_NAME) with IPV6 Support.
191
192     config FS_SOFIA_WITH_OPT
193     depends on PACKAGE_$(PKG_NAME)
194     bool "Compile with optimization"
195     default y
196     help
197             Compile $(PKG_NAME) with optimization enabled.
198
199     config FS_SOFIA_WITHOUT_MYSQL
200     depends on PACKAGE_$(PKG_NAME)
201     bool "Compile without MySQL"
202     default y
203     help
204             Compile $(PKG_NAME) without MySQL.
205 endef
206
207
208 define Package/$(PKG_NAME)-mod-dingaling/config
209     config FS_SOFIA_WITH_GNUTLS
210     depends on PACKAGE_$(PKG_NAME)-mod-dingaling
211     bool "Compile with GNU TLS (Requires libgnutls-openssl)"
212     default y
213     select PACKAGE_libgnutls-openssl
214     help
215             Compile $(PKG_NAME)-mod-dingaling with GNU TLS Support (Requires libgnutls-openssl package).
216 endef
217
218
219 define Package/$(PKG_NAME)-mod-sofia/config
220     config FS_SOFIA_WITH_ODBC
221     depends on PACKAGE_$(PKG_NAME)-mod-sofia
222     depends on PACKAGE_unixodbc_svn
223     bool "Compile with ODBC support (Requires unixodbc_svn NOT YET AVAILABLE)"
224     default n
225     #select PACKAGE_unixodbc_svn
226     help
227             Compile $(PKG_NAME)-mod-sofia with ODBC Support. Since unixodbc_svn package is not yet available on OpenWRT, $(PKG_NAME)-mod-sofia CAN NOT be compiled with ODBC support.
228
229     config FS_SOFIA_WITH_SCTP
230     depends on PACKAGE_$(PKG_NAME)-mod-sofia
231     depends on PACKAGE_sctp
232     bool "Compile with SCTP (Stream Control Transfer Protocol) support"
233     default n
234     #select PACKAGE_sctp
235     help
236             Compile $(PKG_NAME)-mod-sofia with SCTP support.
237
238     config FS_SOFIA_WITH_ZRTP_GIT
239     depends on PACKAGE_$(PKG_NAME)-mod-sofia
240     depends on PACKAGE_libzrtpcpp
241     bool "Compile with ZRTP support (Requires libzrtpcpp NOT YET AVAILABLE)"
242     default n
243     #select PACKAGE_libzrtpcpp
244     help
245             Compile $(PKG_NAME)-mod-sofia with ZRTP Support. Since libzrtpcpp package is not yet available on OpenWRT, $(PKG_NAME)-mod-sofia CAN NOT be compiled with ZRTP support.
246 endef
247
248
249 define Package/$(PKG_NAME)-example-config
250 $(call Package/$(PKG_NAME)/Default)
251   TITLE:=FreeSWITCH example config (commented)
252   DEPENDS:= $(PKG_NAME)
253 endef
254
255
256 define Package/$(PKG_NAME)-example-config/description
257   The default configuration included with FreeSWITCH. It is not intended to be
258   a final product, and is thus moved to /usr/share/$(PKG_NAME)/examples/conf to
259   be an example of how FreeSWITCH can be configured.
260 endef
261
262
263 define Package/$(PKG_NAME)-config-upstream-defaults
264 $(call Package/$(PKG_NAME)/Default)
265   TITLE:=FreeSWITCH upstream config
266   DEPENDS:= $(PKG_NAME)
267 endef
268
269
270 define Package/$(PKG_NAME)-config-upstream-defaults/description
271   The default configuration included with FreeSWITCH. It is not intended to be
272   a final product, and but is included for those who don't want to use the 
273   OpenWRT configuration and/or want to try things as prepared by upstream.
274 endef
275
276
277 define Package/$(PKG_NAME)-config-minimal
278 $(call Package/$(PKG_NAME)/Default)
279   TITLE:=FreeSWITCH minimal config
280   DEPENDS:= $(PKG_NAME)
281 endef
282
283
284 define Package/$(PKG_NAME)-config-minimal/description
285   A minimal configuration of FreeSWITCH for OpenWRT devices.  Is what the UCI 
286   configuration began with.
287 endef
288
289
290 define Package/$(PKG_NAME)-collection-upstream-defaults
291 $(call Package/$(PKG_NAME)/Default)
292   TITLE:=FS upstream def sample conf
293   DEPENDS:= $(PKG_NAME) \
294                 +$(PKG_NAME)-config-upstream-defaults \
295                 +$(PKG_NAME)-mod-callcenter \
296                 +$(PKG_NAME)-mod-codec2 \
297                 +$(PKG_NAME)-mod-commands \
298                 +$(PKG_NAME)-mod-conference \
299                 +$(PKG_NAME)-mod-curl \
300                 +$(PKG_NAME)-mod-dialplan-xml \
301                 +$(PKG_NAME)-mod-dingaling \
302                 +$(PKG_NAME)-mod-dptools \
303                 +$(PKG_NAME)-mod-event-socket \
304                 +$(PKG_NAME)-mod-g723-1 \
305                 +$(PKG_NAME)-mod-g729 \
306                 +$(PKG_NAME)-mod-hash \
307                 +$(PKG_NAME)-mod-ilbc \
308                 +$(PKG_NAME)-mod-local-stream \
309                 +$(PKG_NAME)-mod-lua \
310                 +$(PKG_NAME)-mod-native-file \
311                 +$(PKG_NAME)-mod-sndfile \
312                 +$(PKG_NAME)-mod-sofia \
313                 +$(PKG_NAME)-mod-spandsp \
314                 +$(PKG_NAME)-mod-speex \
315                 +$(PKG_NAME)-mod-syslog \
316                 +$(PKG_NAME)-mod-tone-stream \
317                 +$(PKG_NAME)-mod-xml-curl \
318                 +$(PKG_NAME)-mod-xml-rpc \
319                 +$(PKG_NAME)-tools
320 endef
321
322
323 define Package/$(PKG_NAME)-collection-minimal
324 $(call Package/$(PKG_NAME)/Default)
325   TITLE:=FreeSWITCH minimal package collection
326   DEFAULT:=y
327   DEPENDS:= $(PKG_NAME) \
328                 +$(PKG_NAME)-config-minimal \
329                 +$(PKG_NAME)-mod-codec2 \
330                 +$(PKG_NAME)-mod-commands \
331                 +$(PKG_NAME)-mod-dialplan-xml \
332                 +$(PKG_NAME)-mod-dptools \
333                 +$(PKG_NAME)-mod-event-socket \
334                 +$(PKG_NAME)-mod-hash \
335                 +$(PKG_NAME)-mod-local-stream \
336                 +$(PKG_NAME)-mod-sndfile \
337                 +$(PKG_NAME)-mod-sofia \
338                 +$(PKG_NAME)-mod-syslog \
339                 +$(PKG_NAME)-mod-tone-stream \
340                 +$(PKG_NAME)-tools
341 endef
342
343
344 define Package/$(PKG_NAME)-sounds-en
345 $(call Package/$(PKG_NAME)/Default)
346   TITLE:=FreeSWITCH english sounds
347   DEPENDS:= $(PKG_NAME)
348 endef
349
350
351 define Package/$(PKG_NAME)-sounds-moh
352 $(call Package/$(PKG_NAME)/Default)
353   TITLE:=FreeSWITCH music-on-hold sounds
354   DEPENDS:= $(PKG_NAME)
355 endef
356
357
358 define Package/$(PKG_NAME)-tools
359 $(call Package/$(PKG_NAME)/Default)
360   TITLE:=FreeSWITCH control tools
361   DEPENDS:= $(PKG_NAME)
362 endef
363
364
365 define Download/files
366  define Download/$(1)
367   FILE:=$(2)
368   URL:=$(if $(4),$(4),http://files.$(PKG_NAME).org)/$(5)
369   MD5SUM:=$(3)
370  endef
371  define Prepare/$(1)
372   $(LN) $(DL_DIR)/$(2) $(PKG_BUILD_DIR)/$(6)
373  endef
374  $$(eval $$(call Download,$(1)))
375 endef
376
377
378 MAKE_INSTALL_TARGETS:=install
379
380
381 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-celt),)
382  $(eval $(call Download/files,celt,celt-0.10.0.tar.gz,a656f6176e9be84027c0e51ceedd710f,,downloads/libs/,libs/))
383 endif
384
385
386 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-curl),)
387  $(eval $(call Download/files,json-cdr,json-c-0.9.tar.gz,4653b3b9c568bb9c782178abfaac128d,,downloads/libs/,libs/))
388 endif
389
390
391 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-event-zmq),)
392  $(eval $(call Download/files,event-zmq,zeromq-2.1.9.tar.gz,94c5e0262a79c5f82bc0b178c1f8a33d,http://download.zeromq.org,,libs/))
393 endif
394
395
396 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-flite),)
397  $(eval $(call Download/files,flite,flite-1.3.99-latest.tar.gz,365b60881715c5e13c0d8bc37d9be6ff,,downloads/libs/,libs/))
398 endif
399
400
401 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-mod-opus),)
402  $(eval $(call Download/files,opus,opus-0.9.0.tar.gz,8a729db587430392e64280a499e9d061,,downloads/libs/,libs/))
403 endif
404
405
406 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-en),)
407  $(eval $(call Download/files,sounds-en,$(PKG_NAME)-sounds-en-us-callie-8000-1.0.16.tar.gz,bde0883eb75fe06f39bde11f50a1f858,,,))
408         MAKE_INSTALL_TARGETS+= sounds-install
409 endif
410
411
412 ifneq ($(CONFIG_PACKAGE_$(PKG_NAME)-sounds-moh),)
413  $(eval $(call Download/files,sounds-moh,$(PKG_NAME)-sounds-music-8000-1.0.8.tar.gz,f63ef3cc3507af079ae5c7b8b8a01e42,,,))
414         MAKE_INSTALL_TARGETS+= moh-install
415 endif
416
417
418 #
419 # XXX: -fgnu89-inline is not supported on all compiler versions, so only enable it on avr32 where it solves build issues
420 #
421 ifneq ($(CONFIG_avr32),)
422   TARGET_CFLAGS += -fgnu89-inline
423   TARGET_CXXFLAGS += -fgnu89-inline
424 endif
425
426
427 ifneq ($(CONFIG_USE_EGLIBC),)
428   ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
429     TARGET_CFLAGS += -DNO_GETLOGIN
430   endif
431 endif
432
433
434 FS_TARGET_CFLAGS:= ${TARGET_CFLAGS} -DLUA_USE_LINUX $(FPIC) -std=gnu99 -Wno-format
435 FS_TARGET_CXXFLAGS:= ${TARGET_CXXFLAGS} -DLUA_USE_LINUX $(FPIC) -Wno-format
436 FS_TARGET_CPPFLAGS:= -I. -I./lua $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-erlang-event),-I$(STAGING_DIR_HOST)/lib/erlang/lib/erl_interface-3.6/include) $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-json-cdr),-Wno-error) ${TARGET_CPPFLAGS}
437
438
439 CONFIGURE_ARGS+= \
440         --host=$(GNU_TARGET_NAME) \
441         --build=$(GNU_HOST_NAME) \
442         --prefix="/usr/share/$(PKG_NAME)" \
443         --bindir="/usr/bin" \
444         --libdir="/usr/lib" \
445         --srcdir="$(PKG_BUILD_DIR)" \
446         --sysconfdir="/etc/$(PKG_NAME)" \
447         --with-modinstdir="/usr/lib/$(PKG_NAME)" \
448         --with-random="/dev/urandom" \
449         $(if $(CONFIG_FS_SOFIA_WITHOUT_MYSQL),--without-mysql) \
450         $(call autoconf_bool,CONFIG_FS_SOFIA_WITH_IPV6,ipv6) \
451         $(call autoconf_bool,CONFIG_FS_SOFIA_WITH_OPT,optimization) \
452         $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-celt),--with-ogg="$(STAGING_DIR)/usr",--without-iogg) \
453         $(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) \
454         $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-dingaling)|$(CONFIG_FS_SOFIA_WITH_GNUTLS),--with-libgnutls="$(STAGING_DIR)/usr") \
455         $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-java),--with-java="$(STAGING_DIR)/usr",--without-java) \
456         $(call autoconf_bool,CONFIG_PACKAGE_$(PKG_NAME)-mod-spandsp,builtin-tiff) \
457         $(call autoconf_bool,CONFIG_FS_SOFIA_WITH_SCTP,sctp) \
458         $(call autoconf_bool,CONFIG_FS_SOFIA_WITH_ZRTP_GIT,zrtp) \
459         $(call autoconf_bool,CONFIG_FS_SOFIA_WITH_ODBC,core-odbc-support) \
460         $(if $(CONFIG_FS_SOFIA_WITH_ODBC),--with-odbc="$(STAGING_DIR)/usr") \
461
462
463 CONFIGURE_VARS+= \
464         config_TARGET_CC="${TARGET_CC}" \
465         config_TARGET_CFLAGS="${FS_TARGET_CPPFLAGS} ${FS_TARGET_CFLAGS}" \
466         config_TARGET_CXX="${TARGET_CXX}" \
467         config_TARGET_CXXFLAGS="${FS_TARGET_CPPFLAGS} ${FS_TARGET_CXXFLAGS}" \
468         config_TARGET_CPPFLAGS="${FS_TARGET_CPPFLAGS}" \
469         config_TARGET_READLINE_INC="${FS_TARGET_CPPFLAGS}" \
470         config_TARGET_READLINE_LIBS="${TARGET_LDFLAGS} -lreadline -lncurses" \
471         config_TARGET_LIBS="${TARGET_LDFLAGS} -lpthread" \
472         config_BUILD_CC="${HOSTCC}" \
473         config_BUILD_CFLAGS="${HOST_CFLAGS}" \
474         CC_FOR_BUILD="${HOSTCC}" \
475         LDFLAGS="$$$$LDFLAGS" \
476         LDFLAGS_FOR_BUILD="${HOST_LDFLAGS}" \
477         CC="${TARGET_CC}" \
478         CXX="${TARGET_CXX}" \
479         CFLAGS="${FS_TARGET_CPPFLAGS} ${FS_TARGET_CFLAGS}" \
480         CXXFLAGS="${FS_TARGET_CPPFLAGS} ${FS_TARGET_CXXFLAGS}" \
481         CPPFLAGS="${FS_TARGET_CPPFLAGS}" \
482         LDFLAGS="${TARGET_LDFLAGS} -Wl,-rpath-link=\"${STAGING_DIR}/usr/lib\"" \
483         PATH="${PATH}:${STAGING_DIR}" \
484         HOST_CC="/usr/bin/cc" \
485         HOST_CXX="/usr/bin/g++" \
486         CROSS_COMPILE="1" \
487         ax_cv_c_compiler_vendor="gnu" \
488         ac_cv_dev_urandom="yes" \
489         ac_cv_file_dbd_apr_dbd_mysql_c="no" \
490         ac_cv_file__dev_random="no" \
491         ac_cv_file__dev_urandom="yes" \
492         ac_cv_file___dev_urandom_="yes" \
493         ac_cv_func_mmap_fixed_mapped="yes" \
494         ac_cv_func_pthread_rwlock_init="yes" \
495         ac_cv_struct_rlimit="yes" \
496         apr_cv_mutex_recursive="yes" \
497         apr_cv_process_shared_works="no" \
498         apr_cv_tcp_nodelay_with_cork="yes" \
499         apr_cv_type_rwlock_t="yes" \
500         ac_cv_path_LIBGNUTLS_CONFIG="no" \
501         $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-perl),ac_cv_path_PERL="yes",) \
502         libzmq_cv_cxx_werror_flag="" \
503
504
505 define Build/Prepare
506         (cd $(PKG_BUILD_DIR); [ -h noreg ] || touch noreg)
507         $(call Build/Prepare/Default)
508         $(call Prepare/celt)
509         $(call Prepare/event-zmq)
510         $(call Prepare/flite)
511         $(call Prepare/json-cdr)
512         $(call Prepare/opus)
513         $(call Prepare/sounds-en)
514         $(call Prepare/sounds-moh)
515 endef
516
517
518 define Build/Configure
519         (cd $(PKG_BUILD_DIR); $(AM_TOOL_PATHS) ./bootstrap.sh)
520         $(call Build/Configure/Default,)
521         $(foreach m,$(FS_MOD_AVAILABLE),
522                 $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-$(m)),
523                         $(SED) 's|^[ #]*\([^#]*/mod_$(subst -,_,$(m))\)$$$$|\1|g' $(PKG_BUILD_DIR)/modules.conf
524                 ,
525                         $(SED) 's|^\([^#]*/mod_$(subst -,_,$(m))\)$$$$|#\1|g' $(PKG_BUILD_DIR)/modules.conf
526                 )
527         )
528 endef
529
530
531 define Build/Compile
532         $(MAKE) -C $(PKG_BUILD_DIR) \
533                 AR="$(TARGET_CROSS)ar" \
534                 RANLIB="$(TARGET_CROSS)ranlib" \
535                 CC="$(TARGET_CC)" \
536                 CXX="$(TARGET_CXX)" \
537                 DESTDIR="$(PKG_INSTALL_DIR)" \
538                 LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
539                 spandsp-reconf all $(MAKE_INSTALL_TARGETS)
540         $(SED) 's|^\([ \t]*\)\(.*\)"mod_console"\(.*\)$$$$|\1<!-- \2"mod_console"\3 -->|' $(PKG_INSTALL_DIR)/etc/$(PKG_NAME)/autoload_configs/modules.conf.xml
541         $(SED) 's|^\([ \t]*\)<!-- *\(.*\)"mod_syslog"\(.*\) *-->\(.*\)$$$$|\1\2"mod_syslog"\3\4|' $(PKG_INSTALL_DIR)/etc/$(PKG_NAME)/autoload_configs/modules.conf.xml
542 endef
543
544
545 define Build/InstallDev
546         $(INSTALL_DIR) $(1)/usr/include/$(PKG_NAME)
547         $(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/include/* $(1)/usr/include/$(PKG_NAME)/
548         $(INSTALL_DIR) $(1)/usr/lib
549         $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME).{a,so*} $(1)/usr/lib/
550 endef
551
552
553 define Package/$(PKG_NAME)/install
554         $(INSTALL_DIR) $(1)/usr/bin
555         $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
556         $(INSTALL_DIR) $(1)/usr/lib
557         $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$(PKG_NAME).so.* $(1)/usr/lib/
558         $(INSTALL_DIR) $(1)/usr/lib/$(PKG_NAME)
559         $(INSTALL_DIR) $(1)/etc/default
560         $(INSTALL_DATA) ./files/$(PKG_NAME).default $(1)/etc/default/$(PKG_NAME)
561         $(INSTALL_DIR) $(1)/etc/init.d
562         $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
563         $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
564         $(INSTALL_DATA) ./files/$(PKG_NAME).hotplug $(1)/etc/hotplug.d/iface/90-$(PKG_NAME)
565         $(INSTALL_DIR) $(1)/etc/config
566         $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
567 endef
568
569
570 define Package/$(PKG_NAME)-collection-upstream-defaults/install
571         $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
572 endef
573
574
575 define Package/$(PKG_NAME)-example-config/install
576         $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/examples/conf
577         #$(INSTALL_DIR) $(1)/var/log/$(PKG_NAME)/xml_cdr
578         $(CP) $(PKG_INSTALL_DIR)/etc/$(PKG_NAME)/* $(1)/usr/share/$(PKG_NAME)/examples/conf/
579 endef
580
581
582 define Package/$(PKG_NAME)-config-upstream-defaults/install
583         $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
584         $(CP) $(PKG_INSTALL_DIR)/etc/$(PKG_NAME)/* $(1)/etc/$(PKG_NAME)/
585 endef
586
587
588 define Package/$(PKG_NAME)-collection-minimal/install
589         $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
590 endef
591
592
593 define Package/$(PKG_NAME)-collection-uci-minimal/install
594         $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
595 endef
596
597
598 define Package/$(PKG_NAME)-config-minimal/install
599         $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
600         $(CP) ./files/etc.minimal/* $(1)/etc/$(PKG_NAME)/
601 endef
602
603
604 define Package/$(PKG_NAME)-sounds-en/install
605         $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds
606         $(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/en $(1)/usr/share/$(PKG_NAME)/sounds/
607 endef
608
609
610 define Package/$(PKG_NAME)-sounds-moh/install
611         $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/sounds
612         $(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/sounds/music $(1)/usr/share/$(PKG_NAME)/sounds/
613 endef
614
615
616 define Package/$(PKG_NAME)-tools/install
617         $(INSTALL_DIR) $(1)/usr/bin
618         $(CP) $(PKG_INSTALL_DIR)/usr/bin/fs_cli $(1)/usr/bin/
619         $(CP) $(PKG_INSTALL_DIR)/usr/bin/fs_encode $(1)/usr/bin/
620         $(CP) $(PKG_INSTALL_DIR)/usr/bin/fs_ivrd $(1)/usr/bin/
621         $(CP) $(PKG_INSTALL_DIR)/usr/bin/fsxs $(1)/usr/bin/
622         $(CP) $(PKG_INSTALL_DIR)/usr/bin/gentls_cert $(1)/usr/bin/
623         $(CP) $(PKG_INSTALL_DIR)/usr/bin/tone2wav $(1)/usr/bin/
624 endef
625
626
627 #
628 # 1. Name
629 # 2. Title
630 # 3. Files
631 # 4. Inter Depends
632 # 5. Extra Depends
633 #
634 define BuildPlugin
635   define Package/$(PKG_NAME)-mod-$(1)
636     $$(call Package/$(PKG_NAME)/Default)
637     TITLE:= FS $(2) module
638     DEPENDS:= $(PKG_NAME) $(foreach m,$(4),+$(PKG_NAME)-mod-$(m)) $(5)
639   endef
640
641   define Package/$(PKG_NAME)-mod-$(1)/install
642         [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/$(PKG_NAME)
643         for f in $(3); do \
644                 $(CP) \
645                         $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME)/$$$$$$$${f}.so \
646                         $$(1)/usr/lib/$(PKG_NAME)/ ; \
647         done
648         if [ -d "./files/etc.packages/$(1)" ]; then \
649                 $(INSTALL_DIR) $$(1)/etc/$(PKG_NAME) ; \
650                 $(CP) \
651                         ./files/etc.packages/$(1)/* \
652                         $$(1)/etc/$(PKG_NAME)/ ; \
653         fi
654   endef
655
656   define Package/$(PKG_NAME)-mod-$(1)/postinst
657 #!/bin/sh
658 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
659   endef
660
661   define Package/$(PKG_NAME)-mod-$(1)/postrm
662 #!/bin/sh
663 sed -i -e 's|^\([ \t]*\)\(.*\)"mod_$(subst -,_,$(1))"\(.*\)$$$$|\1<!-- \2"mod_$(subst -,_,$(1))"\3 -->|' $$$${IPKG_INSTROOT}/etc/$(PKG_NAME)/autoload_configs/modules.conf.xml
664   endef
665
666   $$(eval $$(call BuildPackage,$(PKG_NAME)-mod-$(1)))
667 endef
668
669
670 $(eval $(call BuildPackage,$(PKG_NAME)))
671 $(eval $(call BuildPackage,$(PKG_NAME)-collection-upstream-defaults))
672 $(eval $(call BuildPackage,$(PKG_NAME)-collection-minimal))
673 $(eval $(call BuildPackage,$(PKG_NAME)-sounds-en))
674 $(eval $(call BuildPackage,$(PKG_NAME)-sounds-moh))
675 $(eval $(call BuildPackage,$(PKG_NAME)-tools))
676 $(eval $(call BuildPackage,$(PKG_NAME)-example-config))
677 $(eval $(call BuildPackage,$(PKG_NAME)-config-upstream-defaults))
678 $(eval $(call BuildPackage,$(PKG_NAME)-config-minimal))
679
680
681 #
682 # $(eval $(call BuildPlugin,Name,Title,Files,Inter Depends,Extra Depends))
683 #
684 $(eval $(call BuildPlugin,alsa,Alsa endpoint,mod_alsa,,))
685 $(eval $(call BuildPlugin,amr,GSM-AMR codec,mod_amr,,))
686 $(eval $(call BuildPlugin,amrwb,GSM-AMRWB,mod_amrwb,,))
687 $(eval $(call BuildPlugin,avmd,Advanced Voice Mail Detection,mod_avmd,,))
688 $(eval $(call BuildPlugin,bv,codec mod_bv,mod_bv,,))
689 $(eval $(call BuildPlugin,blacklist,application blacklist,mod_blacklist,,))
690 $(eval $(call BuildPlugin,callcenter,Call Center,mod_callcenter,,))
691 $(eval $(call BuildPlugin,cdr-csv,CSV-CDR handler,mod_cdr_csv,,))
692 $(eval $(call BuildPlugin,cdr-pg-csv,Postgress CDR handler,mod_cdr_pg_csv,,+coreutils +libpq))
693 $(eval $(call BuildPlugin,cdr-sqlite,SQLite3 CDR handler,mod_cdr_sqlite,,+sqlite3))
694 $(eval $(call BuildPlugin,celt,CELT ultra-low delay codec,mod_celt,,+libogg))
695 $(eval $(call BuildPlugin,cepstral,Cepstral interface,mod_cepstral,,@BROKEN)) # needs <swift.h>
696 $(eval $(call BuildPlugin,cidlookup,applications mod_cidlookup,mod_cidlookup,,))
697 $(eval $(call BuildPlugin,cluechoo,Framework Demo,mod_cluechoo,,))
698 $(eval $(call BuildPlugin,codec2,CoDec 2,mod_codec2,,))
699 $(eval $(call BuildPlugin,commands,API commands,mod_commands,,))
700 $(eval $(call BuildPlugin,conference,Conference room,mod_conference,,))
701 $(eval $(call BuildPlugin,console,Console logger,mod_console,,))
702 $(eval $(call BuildPlugin,curl,HTTP request,mod_curl,,+libcurl))
703 $(eval $(call BuildPlugin,dahdi-codec,DAHDI codecs,mod_dahdi_codec,,))
704 $(eval $(call BuildPlugin,db,Database backend,mod_db,,))
705 $(eval $(call BuildPlugin,dialplan-asterisk,Asterisk dialplan parser,mod_dialplan_asterisk,,))
706 $(eval $(call BuildPlugin,dialplan-directory,Dialplan directory,mod_dialplan_directory,,))
707 $(eval $(call BuildPlugin,dialplan-xml,Dialplan-XML interface,mod_dialplan_xml,,))
708 $(eval $(call BuildPlugin,dingaling,Jabber interface,mod_dingaling,,)) 
709 $(eval $(call BuildPlugin,directory,application mod_directory,mod_directory,,))
710 $(eval $(call BuildPlugin,distributor,application mod_distributor,mod_distributor,,))
711 $(eval $(call BuildPlugin,dptools,Dialplan tools,mod_dptools,,))
712 $(eval $(call BuildPlugin,easyroute,DID routing,mod_easyroute,,))
713 $(eval $(call BuildPlugin,enum,ENUM routing,mod_enum,,))
714 $(eval $(call BuildPlugin,erlang-event,Erlang event handler,mod_erlang_event,,+erlang))
715 $(eval $(call BuildPlugin,esf,Extra SIP Functionality,mod_esf,,))
716 $(eval $(call BuildPlugin,event-multicast,Multicast event handler,mod_event_multicast,,))
717 $(eval $(call BuildPlugin,event-socket,Socket event handler,mod_event_socket,,))
718 $(eval $(call BuildPlugin,event-zmq,Socket event handler by Zero MQ,mod_event_zmq,,))
719 $(eval $(call BuildPlugin,expr,Expression evaluation,mod_expr,,))
720 $(eval $(call BuildPlugin,fifo,FIFO,mod_fifo,,))
721 $(eval $(call BuildPlugin,file-string,File streaming,mod_file_string,,@OBSOLETE)) # merged into dptools
722 $(eval $(call BuildPlugin,flite,Festival TTS,mod_flite,,@(!(armeb||avr32)||BROKEN)))
723 $(eval $(call BuildPlugin,fsk,Bell-202 1200-baud FSK decoder,mod_fsk,,))
724 $(eval $(call BuildPlugin,fsv,Video,mod_fsv,,))
725 $(eval $(call BuildPlugin,g723-1,G.723.1 codec,mod_g723_1,,))
726 $(eval $(call BuildPlugin,g729,G.729 codec,mod_g729,,))
727 $(eval $(call BuildPlugin,gsmopen,Short Message Service (SMS),mod_gsmopen,spandsp,+alsa-lib +gsmlib))
728 $(eval $(call BuildPlugin,h26x,H26X linear codec,mod_h26x,,))
729 $(eval $(call BuildPlugin,h323,h323 endpoint,mod_h323,,@BROKEN)) # missing header files (other packages needed)
730 $(eval $(call BuildPlugin,hash,API for manipulating a hash table,mod_hash,,))
731 $(eval $(call BuildPlugin,ilbc,ILBC codec,mod_ilbc,,))
732 $(eval $(call BuildPlugin,java,Java language interface,mod_java,,@BROKEN)) # needs java
733 $(eval $(call BuildPlugin,json-cdr,JSon-CDR interface,mod_json_cdr,,))
734 $(eval $(call BuildPlugin,lcr,Least Cost Routing,mod_lcr,,))
735 $(eval $(call BuildPlugin,local-stream,Local streaming,mod_local_stream,,))
736 $(eval $(call BuildPlugin,logfile,File logger,mod_logfile,,))
737 $(eval $(call BuildPlugin,loopback,Loopback endpoint,mod_loopback,,))
738 $(eval $(call BuildPlugin,lua,Lua language interface,mod_lua,,+libstdcpp))
739 $(eval $(call BuildPlugin,managed,language mod_managed,mod_managed,,+glib2 @BROKEN)) # needs Mono
740 $(eval $(call BuildPlugin,mp4,MP4 File Format support for video apps.,mod_mp4,,+libmp4v2))
741 $(eval $(call BuildPlugin,native-file,Native files,mod_native_file,,))
742 $(eval $(call BuildPlugin,nibblebill,Billing,mod_nibblebill,,))
743 $(eval $(call BuildPlugin,openzap,Zaptel hardware interface,mod_openzap ozmod_analog ozmod_analog_em ozmod_isdn ozmod_skel ozmod_zt,,+libpcap))
744 $(eval $(call BuildPlugin,opus,Opus CoDec,mod_opus,,))
745 $(eval $(call BuildPlugin,portaudio,Local audio endpoint,mod_portaudio,,+alsa-lib))
746 $(eval $(call BuildPlugin,portaudio-stream,portaudio stream format,mod_portaudio_stream,,))
747 $(eval $(call BuildPlugin,radius-cdr,Radius-CDR interface,mod_radius_cdr,,+freeradius2 @BROKEN)) # fails in freeradius-client
748 $(eval $(call BuildPlugin,rss,RRS feeds via TTS,mod_rss,,))
749 $(eval $(call BuildPlugin,rtmp,RTMP Protocol Handler,mod_rtmp,,))
750 $(eval $(call BuildPlugin,say-de,German say,mod_say_de,,))
751 $(eval $(call BuildPlugin,say-en,English say,mod_say_en,,))
752 $(eval $(call BuildPlugin,say-es,Spanish say,mod_say_es,,))
753 $(eval $(call BuildPlugin,say-fr,French say,mod_say_fr,,))
754 $(eval $(call BuildPlugin,say-hu,Hungarian say,mod_say_hu,,))
755 $(eval $(call BuildPlugin,say-it,Italian say,mod_say_it,,))
756 $(eval $(call BuildPlugin,say-nl,Dutch say,mod_say_nl,,))
757 $(eval $(call BuildPlugin,say-pt,Portugeese say,mod_say_pt,,))
758 $(eval $(call BuildPlugin,say-ru,Russian say,mod_say_ru,,))
759 $(eval $(call BuildPlugin,say-th,Thai say,mod_say_th,,))
760 $(eval $(call BuildPlugin,say-zh,Chineese say,mod_say_zh,,))
761 $(eval $(call BuildPlugin,shell-stream,Shell stream,mod_shell_stream,,))
762 $(eval $(call BuildPlugin,silk,codec mod_silk,mod_silk,,))
763 $(eval $(call BuildPlugin,siren,G.722.1 codec,mod_siren,,))
764 $(eval $(call BuildPlugin,skinny,endpoint mod_skinny,mod_skinny,,))
765 $(eval $(call BuildPlugin,skypopen,Skype compatible endpoint,mod_skypopen,,@FEATURE_drawing-backend_libX11))
766 $(eval $(call BuildPlugin,sms,SMS application,mod_sms,,))
767 $(eval $(call BuildPlugin,snapshot,application mod_snapshot,mod_snapshot,,))
768 $(eval $(call BuildPlugin,sndfile,Multi-Format file transcoder,mod_sndfile,,))
769 $(eval $(call BuildPlugin,snipe-hunt,application mod_snipe_hunt,mod_snipe_hunt,,))
770 $(eval $(call BuildPlugin,snmp,Simple Network Management Protocol,mod_snmp,,+libnetsnmp))
771 $(eval $(call BuildPlugin,snom,SNOM specific features,mod_snom,,))
772 $(eval $(call BuildPlugin,sofia,SIP,mod_sofia,,))
773 $(eval $(call BuildPlugin,spandsp,Span DSP,mod_spandsp,,+libjpeg))
774 $(eval $(call BuildPlugin,speex,Speex codec,mod_speex,,))
775 $(eval $(call BuildPlugin,spidermonkey,JavaScript,mod_spidermonkey,,@BROKEN)) # fails in js
776 $(eval $(call BuildPlugin,spidermonkey-core_db,JavaScript DB,mod_spidermonkey_core_db,,@BROKEN))
777 $(eval $(call BuildPlugin,spidermonkey-curl,JavaScript Curl,mod_spidermonkey_curl,,@BROKEN))
778 $(eval $(call BuildPlugin,spidermonkey-odbc,JavaScript ODBC,mod_spidermonkey_odbc,,@BROKEN))
779 $(eval $(call BuildPlugin,spidermonkey-socket,JavaScript socket,mod_spidermonkey_socket,,@BROKEN))
780 $(eval $(call BuildPlugin,spidermonkey-teletone,JavaScript teletone,mod_spidermonkey_teletone,,@BROKEN))
781 $(eval $(call BuildPlugin,spy,User spy,mod_spy,,))
782 $(eval $(call BuildPlugin,stress,application mod_stress,mod_stress,,))
783 $(eval $(call BuildPlugin,syslog,SysLog logger,mod_syslog,,))
784 $(eval $(call BuildPlugin,tone-stream,Tone generation stream,mod_tone_stream,,))
785 $(eval $(call BuildPlugin,tts-commandline,ASR TTS cli,mod_tts_commandline,,))
786 $(eval $(call BuildPlugin,unimrcp,MRCP interface,mod_unimrcp,,@BROKEN))
787 $(eval $(call BuildPlugin,valet-parking,application mod_valet_parking,mod_valet_parking,,))
788 $(eval $(call BuildPlugin,vmd,VoiceMail beep detection,mod_vmd,,))
789 $(eval $(call BuildPlugin,voicemail,VoiceMail,mod_voicemail,,))
790 $(eval $(call BuildPlugin,xml-cdr,XML-CDR handler,mod_xml_cdr,,+libcurl))
791 $(eval $(call BuildPlugin,xml-curl,XML-Curl gateway,mod_xml_curl,,+libcurl))
792 $(eval $(call BuildPlugin,xml-rpc,XML-RPC interface,mod_xml_rpc,,))
793 $(eval $(call BuildPlugin,yaml,YAML dialplans,mod_yaml,,))
794