[packages] freeswitch: misc tweaks
[openwrt/svn-archive/archive.git] / net / freeswitch / Makefile
1 #
2 # Copyright (C) 2009 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 PKG_NAME:=freeswitch
11 PKG_VERSION:=1.0.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://files.freeswitch.org/
16 PKG_MD5SUM:=86e34bdd8cc027d71772cb0dc51388da
17
18 PKG_FIXUP:=libtool
19
20 FS_MOD_AVAILABLE:= \
21 alsa \
22 amr \
23 amrwb \
24 cdr-csv \
25 celt \
26 cepstral \
27 cluechoo \
28 commands \
29 conference \
30 console \
31 curl \
32 dahdi-codec \
33 dialplan-asterisk \
34 dialplan-directory \
35 dialplan-xml \
36 dingaling \
37 dptools \
38 easyroute \
39 enum \
40 erlang-event \
41 esf \
42 event-multicast \
43 event-socket \
44 expr \
45 fax \
46 fifo \
47 file-string \
48 flite \
49 fsv \
50 g723-1 \
51 g729 \
52 h26x \
53 iax \
54 ilbc \
55 lcr \
56 ldap \
57 limit \
58 local-stream \
59 logfile \
60 loopback \
61 lua \
62 memcache \
63 native-file \
64 nibblebill \
65 opal \
66 openzap \
67 perl \
68 pocketsphinx \
69 portaudio \
70 python \
71 radius-cdr \
72 rss \
73 say-de \
74 say-en \
75 say-es \
76 say-fr \
77 say-it \
78 say-nl \
79 say-ru \
80 say-zh \
81 shout \
82 siren \
83 skypiax \
84 sndfile \
85 snom \
86 sofia \
87 soundtouch \
88 speex \
89 spidermonkey \
90 spidermonkey-core-db \
91 spidermonkey-curl \
92 spidermonkey-odbc \
93 spidermonkey-socket \
94 spidermonkey-teletone \
95 spy \
96 syslog \
97 tone-stream \
98 unimrcp \
99 vmd \
100 voicemail \
101 voipcodecs \
102 xml-cdr \
103 xml-curl \
104 xml-ldap \
105 xml-rpc \
106 yaml \
107
108 PKG_CONFIG_DEPENDS:= \
109 $(patsubst %,CONFIG_PACKAGE_freeswitch-mod-%,$(FS_MOD_AVAILABLE)) \
110
111 include $(INCLUDE_DIR)/package.mk
112
113 define Package/freeswitch/Default
114 SECTION:=net
115 CATEGORY:=Network
116 URL:=http://www.freeswitch.org/
117 endef
118
119
120 define Package/freeswitch
121 $(call Package/freeswitch/Default)
122 TITLE:=FreeSWITCH open source telephony platform
123 DEPENDS:=+libopenssl +libreadline +libncurses +libpthread +libstdcpp
124 MENU:=1
125 endef
126
127 define Package/freeswitch/description
128 FreeSWITCH is an open source telephony platform designed to
129 facilitate the creation of voice and chat driven products scaling
130 from a soft-phone up to a soft-switch.
131 endef
132
133
134 define Package/freeswitch-default
135 $(call Package/freeswitch/Default)
136 TITLE:=FreeSWITCH default config
137 DEPENDS:=freeswitch \
138 +freeswitch-mod-commands \
139 +freeswitch-mod-conference \
140 +freeswitch-mod-console \
141 +freeswitch-mod-curl \
142 +freeswitch-mod-dialplan-xml \
143 +freeswitch-mod-dptools \
144 +freeswitch-mod-event-socket \
145 +freeswitch-mod-g723-1 \
146 +freeswitch-mod-ilbc \
147 +freeswitch-mod-local-stream \
148 +freeswitch-mod-logfile \
149 +freeswitch-mod-lua \
150 +freeswitch-mod-native-file \
151 +freeswitch-mod-sndfile \
152 +freeswitch-mod-sofia \
153 +freeswitch-mod-speex \
154 +freeswitch-mod-tone-stream \
155 +freeswitch-mod-voipcodecs \
156 +freeswitch-mod-xml-curl \
157 +freeswitch-mod-xml-rpc
158 endef
159
160 define Package/freeswitch-minimal
161 $(call Package/freeswitch/Default)
162 TITLE:=FreeSWITCH minimal config
163 DEPENDS:=freeswitch \
164 +freeswitch-mod-commands \
165 +freeswitch-mod-console \
166 +freeswitch-mod-curl \
167 +freeswitch-mod-dialplan-xml \
168 +freeswitch-mod-dptools \
169 +freeswitch-mod-local-stream \
170 +freeswitch-mod-sndfile \
171 +freeswitch-mod-sofia \
172 +freeswitch-mod-tone-stream \
173 +freeswitch-mod-voipcodecs
174 endef
175
176 define Package/freeswitch-sounds-en
177 $(call Package/freeswitch/Default)
178 TITLE:=FreeSWITCH english sounds
179 DEPENDS:=freeswitch
180 endef
181
182
183 define Package/freeswitch-sounds-moh
184 $(call Package/freeswitch/Default)
185 TITLE:=FreeSWITCH music-on-hold sounds
186 DEPENDS:=freeswitch
187 endef
188
189
190 define Package/freeswitch-tools
191 $(call Package/freeswitch/Default)
192 TITLE:=FreeSWITCH control tools
193 DEPENDS:=freeswitch
194 endef
195
196
197 define Download/files
198 define Download/$(1)
199 FILE:=$(2)
200 URL:=http://files.freeswitch.org/$(4)
201 MD5SUM:=$(3)
202 endef
203 define Prepare/$(1)
204 $(CP) $(DL_DIR)/$(2) $(PKG_BUILD_DIR)/$(5)
205 endef
206 $$(eval $$(call Download,$(1)))
207 endef
208
209 MAKE_INSTALL_TARGETS:=install
210
211 ifneq ($(CONFIG_PACKAGE_freeswitch-mod-celt),)
212 $(eval $(call Download/files,celt,celt-0.6.1.tar.gz,2961ffb6fadb5f905d20de9f0d86e44c,downloads/libs/,libs/))
213 endif
214
215 ifneq ($(CONFIG_PACKAGE_freeswitch-mod-curl),)
216 $(eval $(call Download/files,json-c,json-c-0.8.tar.gz,9c7b90dff16eec3063084829c382ebac,downloads/libs/,libs/))
217 endif
218
219 ifneq ($(CONFIG_PACKAGE_freeswitch-mod-flite),)
220 $(eval $(call Download/files,flite,flite-1.3.99-latest.tar.gz,,downloads/libs/,libs/))
221 endif
222
223 ifneq ($(CONFIG_PACKAGE_freeswitch-sounds-en),)
224 $(eval $(call Download/files,sounds-en,freeswitch-sounds-en-us-callie-8000-1.0.10.tar.gz,f7f85aaf3763673c884ec3451f1c1c3e,,))
225 MAKE_INSTALL_TARGETS+= sounds-install
226 endif
227
228 ifneq ($(CONFIG_PACKAGE_freeswitch-sounds-moh),)
229 $(eval $(call Download/files,sounds-moh,freeswitch-sounds-music-8000-1.0.8.tar.gz,f63ef3cc3507af079ae5c7b8b8a01e42,,))
230 MAKE_INSTALL_TARGETS+= moh-install
231 endif
232
233
234 CONFIGURE_ARGS+= \
235 --prefix="/usr/freeswitch" \
236 --bindir="/usr/bin" \
237 --libdir="/usr/lib" \
238 --sysconfdir="/etc/freeswitch" \
239 --with-modinstdir="/usr/lib/freeswitch" \
240 --enable-ipv6 \
241 \
242 --with-libcurl="$(STAGING_DIR)/usr" \
243 --with-openssl="$(STAGING_DIR)/usr" \
244 --with-random="/dev/urandom" \
245 --without-erlang \
246 --without-java \
247 --without-odbc \
248 --without-mysql \
249 --without-pgsql \
250 --without-python \
251 --disable-zrtp \
252
253 CONFIGURE_VARS+= \
254 config_BUILD_CC="$(HOSTCC)" \
255 config_BUILD_CFLAGS="$(HOST_CFLAGS)" \
256 config_TARGET_CC="$(TARGET_CC)" \
257 config_TARGET_CFLAGS="$(TARGET_CFLAGS)" \
258 config_TARGET_READLINE_INC="$(TARGET_CPPFLAGS)" \
259 config_TARGET_READLINE_LIBS="$(TARGET_LDFLAGS) -lreadline -lncurses" \
260 config_TARGET_LIBS="$(TARGET_LDFLAGS) -lpthread" \
261 CC_FOR_BUILD="$(HOSTCC)" \
262 CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
263 LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
264 LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link=\"$(STAGING_DIR)/usr/lib\"" \
265 ac_cv_dev_urandom="yes" \
266 ac_cv_file_dbd_apr_dbd_mysql_c="no" \
267 ac_cv_file__dev_random="no" \
268 ac_cv_file__dev_urandom="yes" \
269 ac_cv_file___dev_urandom_="yes" \
270 ac_cv_func_mmap_fixed_mapped="yes" \
271 ac_cv_func_pthread_rwlock_init="yes" \
272 ac_cv_struct_rlimit="yes" \
273 apr_cv_mutex_recursive="yes" \
274 apr_cv_process_shared_works="no" \
275 apr_cv_tcp_nodelay_with_cork="yes" \
276 apr_cv_type_rwlock_t="yes" \
277
278 define Build/Prepare
279 $(call Build/Prepare/Default)
280 $(call Prepare/celt)
281 $(call Prepare/flite)
282 $(call Prepare/json-c)
283 $(call Prepare/sounds-en)
284 $(call Prepare/sounds-moh)
285 endef
286
287 define Build/Configure
288 ( cd $(PKG_BUILD_DIR); ./rebootstrap.sh; )
289 $(call Build/Configure/Default)
290 $(foreach m,$(FS_MOD_AVAILABLE),
291 $(if $(CONFIG_PACKAGE_freeswitch-mod-$(m)),
292 $(SED) 's|^[ #]*\([^#]*/mod_$(subst -,_,$(m))\)$$$$|\1|g' $(PKG_BUILD_DIR)/modules.conf
293 ,
294 $(SED) 's|^\([^#]*/mod_$(subst -,_,$(m))\)$$$$|#\1|g' $(PKG_BUILD_DIR)/modules.conf
295 )
296 )
297 endef
298
299 define Build/Compile
300 $(MAKE) -C $(PKG_BUILD_DIR) \
301 DESTDIR="$(PKG_INSTALL_DIR)" \
302 LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
303 all $(MAKE_INSTALL_TARGETS)
304 endef
305
306 define Build/InstallDev
307 $(INSTALL_DIR) $(1)/usr/include/freeswitch
308 $(CP) $(PKG_INSTALL_DIR)/usr/freeswitch/include/* $(1)/usr/include/freeswitch/
309 $(INSTALL_DIR) $(1)/usr/lib
310 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreeswitch.{a,so*} $(1)/usr/lib/
311 endef
312
313 define Package/freeswitch/install
314 $(INSTALL_DIR) $(1)/usr/bin
315 $(CP) $(PKG_INSTALL_DIR)/usr/bin/freeswitch $(1)/usr/bin/
316 $(INSTALL_DIR) $(1)/usr/lib
317 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreeswitch.so.* $(1)/usr/lib/
318 $(INSTALL_DIR) $(1)/usr/lib/freeswitch
319 $(INSTALL_DIR) $(1)/etc/default
320 $(INSTALL_DATA) ./files/freeswitch.default $(1)/etc/default/freeswitch
321 $(INSTALL_DIR) $(1)/etc/init.d
322 $(INSTALL_BIN) ./files/freeswitch.init $(1)/etc/init.d/freeswitch
323 endef
324
325 define Package/freeswitch-default/install
326 $(INSTALL_DIR) $(1)/etc/freeswitch
327 $(CP) $(PKG_INSTALL_DIR)/etc/freeswitch/* $(1)/etc/freeswitch/
328 endef
329
330 define Package/freeswitch-minimal/install
331 $(INSTALL_DIR) $(1)/etc/freeswitch
332 $(CP) $(PKG_INSTALL_DIR)/etc/freeswitch/* $(1)/etc/freeswitch/
333 endef
334
335 define Package/freeswitch-sounds-en/install
336 $(INSTALL_DIR) $(1)/usr/freeswitch/sounds
337 $(CP) $(PKG_INSTALL_DIR)/usr/freeswitch/sounds/en $(1)/usr/freeswitch/sounds/
338 endef
339
340 define Package/freeswitch-sounds-moh/install
341 $(INSTALL_DIR) $(1)/usr/freeswitch/sounds
342 $(CP) $(PKG_INSTALL_DIR)/usr/freeswitch/sounds/music $(1)/usr/freeswitch/sounds/
343 endef
344
345 define Package/freeswitch-tools/install
346 $(INSTALL_DIR) $(1)/usr/bin
347 $(CP) $(PKG_INSTALL_DIR)/usr/bin/fs_cli $(1)/usr/bin/
348 endef
349
350 # 1. Name
351 # 2. Title
352 # 3. Files
353 # 4. Inter Depends
354 # 5. Extra Depends
355 define BuildPlugin
356 define Package/freeswitch-mod-$(1)
357 $$(call Package/freeswitch/Default)
358 TITLE:= FS $(2) module
359 DEPENDS:=freeswitch $$(foreach m,$(4),+freeswitch-mod-$$m) $(5)
360 endef
361
362 define Package/freeswitch-mod-$(1)/install
363 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeswitch
364 for f in $(3); do \
365 $(CP) \
366 $(PKG_INSTALL_DIR)/usr/lib/freeswitch/$$$$$$$${f}.so \
367 $$(1)/usr/lib/freeswitch/ ; \
368 done
369 endef
370
371 $$(eval $$(call BuildPackage,freeswitch-mod-$(1)))
372 endef
373
374 $(eval $(call BuildPackage,freeswitch))
375 $(eval $(call BuildPackage,freeswitch-default))
376 $(eval $(call BuildPackage,freeswitch-minimal))
377 $(eval $(call BuildPackage,freeswitch-sounds-en))
378 $(eval $(call BuildPackage,freeswitch-sounds-moh))
379 $(eval $(call BuildPackage,freeswitch-tools))
380
381 #$(eval $(call BuildPlugin,Name,Title,Files,Depends))
382 $(eval $(call BuildPlugin,alsa,Alsa endpoint,mod_alsa,,+alsa-lib))
383 $(eval $(call BuildPlugin,amr,GSM-AMR codec,mod_amr,,))
384 $(eval $(call BuildPlugin,amrwb,GSM-AMRWB,mod_amrwb,,))
385 $(eval $(call BuildPlugin,cdr-csv,CSV-CDR handler,mod_cdr_csv,,))
386 $(eval $(call BuildPlugin,celt,CELT ultra-low delay codec,mod_celt,,))
387 $(eval $(call BuildPlugin,cepstral,Cepstral interface,mod_cepstral,,@BROKEN)) # needs <swift.h>
388 $(eval $(call BuildPlugin,cluechoo,Framework Demo,mod_cluechoo,,))
389 $(eval $(call BuildPlugin,commands,API commands,mod_commands,,))
390 $(eval $(call BuildPlugin,conference,Conference room,mod_conference,,))
391 $(eval $(call BuildPlugin,console,Console logger,mod_console,,))
392 $(eval $(call BuildPlugin,curl,HTTP request,mod_curl,,))
393 $(eval $(call BuildPlugin,dahdi-codec,DAHDI codecs,mod_dahdi_codec,,))
394 $(eval $(call BuildPlugin,dialplan-asterisk,Asterisk dialplan parser,mod_dialplan_asterisk,,))
395 $(eval $(call BuildPlugin,dialplan-directory,Dialplan-Directory interface,mod_dialplan_directory,,))
396 $(eval $(call BuildPlugin,dialplan-xml,Dialplan-XML interface,mod_dialplan_xml,,))
397 $(eval $(call BuildPlugin,dingaling,Jabber interface,mod_dingaling,,))
398 $(eval $(call BuildPlugin,dptools,Dialplan tools,mod_dptools,,))
399 $(eval $(call BuildPlugin,easyroute,DID routing,mod_easyroute,,))
400 $(eval $(call BuildPlugin,enum,ENUM routing,mod_enum,,))
401 $(eval $(call BuildPlugin,erlang-event,Erlang event handler,mod_erlang_event,,@BROKEN)) # needs <ei.h>
402 $(eval $(call BuildPlugin,esf,Extra SIP Functionality,mod_esf,,))
403 $(eval $(call BuildPlugin,event-multicast,Multicast event handler,mod_event_multicast,,))
404 $(eval $(call BuildPlugin,event-socket,Socket event handler,mod_event_socket,,))
405 $(eval $(call BuildPlugin,expr,Expression evaluation,mod_expr,,))
406 $(eval $(call BuildPlugin,fax,Fax,mod_fax,,@BROKEN)) # fails in spandsp
407 $(eval $(call BuildPlugin,fifo,FIFO,mod_fifo,,))
408 $(eval $(call BuildPlugin,file-string,File streaming,mod_file_string,,))
409 $(eval $(call BuildPlugin,flite,Festival TTS,mod_flite,,))
410 $(eval $(call BuildPlugin,fsv,Video,mod_fsv,,))
411 $(eval $(call BuildPlugin,g723-1,G.723.1 codec,mod_g723_1,,))
412 $(eval $(call BuildPlugin,g729,G.729 codec,mod_g729,,))
413 $(eval $(call BuildPlugin,h26x,H26X linear codec,mod_h26x,,))
414 $(eval $(call BuildPlugin,iax,IAX2 interface,mod_iax,,))
415 $(eval $(call BuildPlugin,ilbc,ILBC codec,mod_ilbc,,))
416 $(eval $(call BuildPlugin,lcr,Least Cost Routing,mod_lcr,,))
417 $(eval $(call BuildPlugin,ldap,LDAP interface,mod_ldap,,@BROKEN)) # fails in openldap
418 $(eval $(call BuildPlugin,limit,Resource limitation,mod_limit,,))
419 $(eval $(call BuildPlugin,local-stream,Local streaming,mod_local_stream,,))
420 $(eval $(call BuildPlugin,logfile,File logger,mod_logfile,,))
421 $(eval $(call BuildPlugin,loopback,Loopback endpoint,mod_loopback,,))
422 $(eval $(call BuildPlugin,lua,Lua language interface,mod_lua,,+libstdcpp)) # needs C++
423 $(eval $(call BuildPlugin,memcache,MemCached interface,mod_memcache,,@BROKEN)) # fails in libmemcached
424 $(eval $(call BuildPlugin,native-file,Native files,mod_native_file,,))
425 $(eval $(call BuildPlugin,nibblebill,Billing,mod_nibblebill,,))
426 $(eval $(call BuildPlugin,opal,Multi-Protocol endpoint,mod_opal,,@BROKEN)) # needs Opal
427 $(eval $(call BuildPlugin,openzap,Zaptel hardware interface,mod_openzap ozmod_analog ozmod_analog_em ozmod_isdn ozmod_skel ozmod_ss7_boost ozmod_zt,,+libpcap))
428 $(eval $(call BuildPlugin,perl,Perl language interface,mod_perl,,+perl @BROKEN)) # needs Perl
429 $(eval $(call BuildPlugin,pocketsphinx,PocketSphinx SR,mod_pocketsphinx,,@BROKEN)) # fails in sphinxbase
430 $(eval $(call BuildPlugin,portaudio,Local audio endpoint,mod_portaudio,,+alsa-lib))
431 $(eval $(call BuildPlugin,python,Python language interface,mod_python,,+python @BROKEN)) # needs Python
432 $(eval $(call BuildPlugin,radius-cdr,Radius-CDR interface,mod_radius_cdr,,@BROKEN)) # fails in freeradius-client
433 $(eval $(call BuildPlugin,rss,RRS feeds via TTS,mod_rss,,))
434 $(eval $(call BuildPlugin,say-de,German say,mod_say_de,,))
435 $(eval $(call BuildPlugin,say-en,English say,mod_say_en,,))
436 $(eval $(call BuildPlugin,say-es,Spanish say,mod_say_es,,))
437 $(eval $(call BuildPlugin,say-fr,French say,mod_say_fr,,))
438 $(eval $(call BuildPlugin,say-it,Italian say,mod_say_it,,))
439 $(eval $(call BuildPlugin,say-nl,Dutch say,mod_say_nl,,))
440 $(eval $(call BuildPlugin,say-ru,Russian say,mod_say_ru,,))
441 $(eval $(call BuildPlugin,say-zh,Chineese say,mod_say_zh,,))
442 $(eval $(call BuildPlugin,shout,MP3 and Shoutcast stream,mod_shout,,@BROKEN)) # needs Ogg/Vorbis
443 $(eval $(call BuildPlugin,siren,G.722.1 codec,mod_siren,,@BROKEN)) # fails in libg722_1
444 $(eval $(call BuildPlugin,skypiax,Skype compatible endpoint,mod_skypiax,,@BROKEN)) # needs <X11/Xlib.h>
445 $(eval $(call BuildPlugin,sndfile,Multi-Format file transcoder,mod_sndfile,,))
446 $(eval $(call BuildPlugin,snom,SNOM specific features,mod_snom,,))
447 $(eval $(call BuildPlugin,sofia,SIP,mod_sofia,,))
448 $(eval $(call BuildPlugin,soundtouch,Sound effects,mod_soundtouch,,@BROKEN)) # fails in soundtouch
449 $(eval $(call BuildPlugin,speex,Speex codec,mod_speex,,))
450 $(eval $(call BuildPlugin,spidermonkey,JavaScript,mod_spidermonkey,,@BROKEN)) # fails in js
451 $(eval $(call BuildPlugin,spidermonkey-core_db,JavaScript DB,mod_spidermonkey_core_db,,@BROKEN))
452 $(eval $(call BuildPlugin,spidermonkey-curl,JavaScript Curl,mod_spidermonkey_curl,,@BROKEN))
453 $(eval $(call BuildPlugin,spidermonkey-odbc,JavaScript ODBC,mod_spidermonkey_odbc,,@BROKEN))
454 $(eval $(call BuildPlugin,spidermonkey-socket,JavaScript socket,mod_spidermonkey_socket,,@BROKEN))
455 $(eval $(call BuildPlugin,spidermonkey-teletone,JavaScript teletone,mod_spidermonkey_teletone,,@BROKEN))
456 $(eval $(call BuildPlugin,spy,User spy,mod_spy,,))
457 $(eval $(call BuildPlugin,syslog,SysLog logger,mod_syslog,,))
458 $(eval $(call BuildPlugin,tone-stream,Tone generation stream,mod_tone_stream,,))
459 $(eval $(call BuildPlugin,unimrcp,MRCP interface,mod_unimrcp,,))
460 $(eval $(call BuildPlugin,vmd,VoiceMail beep detection,mod_vmd,,))
461 $(eval $(call BuildPlugin,voicemail,VoiceMail,mod_voicemail,,))
462 $(eval $(call BuildPlugin,voipcodecs,VoIP codecs,mod_voipcodecs,,))
463 $(eval $(call BuildPlugin,xml-cdr,XML-CDR handler,mod_xml_cdr,,+libcurl))
464 $(eval $(call BuildPlugin,xml-curl,XML-Curl gateway,mod_xml_curl,,+libcurl))
465 $(eval $(call BuildPlugin,xml-ldap,LDAP-XML gateway,mod_xml_ldap,,@BROKEN)) # fails in openldap
466 $(eval $(call BuildPlugin,xml-rpc,XML-RPC interface,mod_xml_rpc,,))
467 $(eval $(call BuildPlugin,yaml,YAML dialplans,mod_yaml,,))