c5d51521ea1f42d64328decef8a2c186b651ed30
[packages.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-cdr-csv \
139                 +freeswitch-mod-commands \
140                 +freeswitch-mod-conference \
141                 +freeswitch-mod-console \
142                 +freeswitch-mod-dialplan-xml \
143                 +freeswitch-mod-dptools \
144                 +freeswitch-mod-enum \
145                 +freeswitch-mod-event-socket \
146                 +freeswitch-mod-expr \
147                 +freeswitch-mod-fifo \
148                 +freeswitch-mod-file-string \
149                 +freeswitch-mod-esf \
150                 +freeswitch-mod-fsv \
151                 +freeswitch-mod-iax \
152                 +freeswitch-mod-limit \
153                 +freeswitch-mod-local-stream \
154                 +freeswitch-mod-logfile \
155                 +freeswitch-mod-loopback \
156                 +freeswitch-mod-native-file \
157                 +freeswitch-mod-rss \
158                 +freeswitch-mod-say-en \
159                 +freeswitch-mod-sndfile \
160                 +freeswitch-mod-sofia \
161                 +freeswitch-mod-syslog \
162                 +freeswitch-mod-tone-stream \
163                 +freeswitch-mod-voicemail \
164                 +freeswitch-mod-voipcodecs \
165                 +freeswitch-mod-xml-cdr \
166                 +freeswitch-mod-xml-rpc
167 endef
168
169
170 define Package/freeswitch-minimal
171 $(call Package/freeswitch/Default)
172   TITLE:=FreeSWITCH minimal config
173   DEPENDS:=freeswitch \
174         +freeswitch-mod-commands \
175         +freeswitch-mod-console \
176         +freeswitch-mod-dialplan-xml \
177         +freeswitch-mod-dptools \
178         +freeswitch-mod-sofia \
179         +freeswitch-mod-voipcodecs
180 endef
181
182
183 define Package/freeswitch-tools
184 $(call Package/freeswitch/Default)
185   TITLE:=FreeSWITCH control tools
186   DEPENDS:=freeswitch
187 endef
188
189
190 define Download/lib
191  define Download/$(1)
192   FILE:=$(2)
193   URL:=http://files.freeswitch.org/downloads/libs/
194   MD5SUM:=$(3)
195  endef
196  define Prepare/$(1)
197   $(CP) $(DL_DIR)/$(2) $(PKG_BUILD_DIR)/libs/
198  endef
199  $$(eval $$(call Download,$(1)))
200 endef
201
202 ifneq ($(CONFIG_PACKAGE_freeswitch-mod-celt),)
203  $(eval $(call Download/lib,celt,celt-0.6.1.tar.gz,2961ffb6fadb5f905d20de9f0d86e44c))
204 endif
205
206 ifneq ($(CONFIG_PACKAGE_freeswitch-mod-curl),)
207  $(eval $(call Download/lib,json-c,json-c-0.8.tar.gz,9c7b90dff16eec3063084829c382ebac))
208 endif
209
210 ifneq ($(CONFIG_PACKAGE_freeswitch-mod-flite),)
211  $(eval $(call Download/lib,flite,flite-1.3.99-latest.tar.gz,))
212 endif
213
214
215 CONFIGURE_ARGS+= \
216         --prefix="/usr/freeswitch" \
217         --bindir="/usr/bin" \
218         --libdir="/usr/lib" \
219         --sysconfdir="/etc/freeswitch" \
220         --with-modinstdir="/usr/lib/freeswitch" \
221         --enable-ipv6 \
222         \
223         --with-libcurl="$(STAGING_DIR)/usr" \
224         --with-openssl="$(STAGING_DIR)/usr" \
225         --with-random="/dev/urandom" \
226         --without-erlang \
227         --without-java \
228         --without-odbc \
229         --without-mysql \
230         --without-pgsql \
231         --without-python \
232         --disable-zrtp \
233
234 CONFIGURE_VARS+= \
235         config_BUILD_CC="$(HOSTCC)" \
236         config_BUILD_CFLAGS="$(HOST_CFLAGS)" \
237         config_TARGET_CC="$(TARGET_CC)" \
238         config_TARGET_CFLAGS="$(TARGET_CFLAGS)" \
239         config_TARGET_READLINE_INC="$(TARGET_CPPFLAGS)" \
240         config_TARGET_READLINE_LIBS="$(TARGET_LDFLAGS) -lreadline -lncurses" \
241         config_TARGET_LIBS="$(TARGET_LDFLAGS) -lpthread" \
242         CC_FOR_BUILD="$(HOSTCC)" \
243         CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
244         LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
245         LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link=\"$(STAGING_DIR)/usr/lib\"" \
246         ac_cv_dev_urandom="yes" \
247         ac_cv_file_dbd_apr_dbd_mysql_c="no" \
248         ac_cv_file__dev_random="no" \
249         ac_cv_file__dev_urandom="yes" \
250         ac_cv_file___dev_urandom_="yes" \
251         ac_cv_func_mmap_fixed_mapped="yes" \
252         ac_cv_func_pthread_rwlock_init="yes" \
253         ac_cv_struct_rlimit="yes" \
254         apr_cv_mutex_recursive="yes" \
255         apr_cv_process_shared_works="no" \
256         apr_cv_tcp_nodelay_with_cork="yes" \
257         apr_cv_type_rwlock_t="yes" \
258
259 define Build/Prepare
260 $(call Build/Prepare/Default)
261         $(call Prepare/celt)
262         $(call Prepare/flite)
263         $(call Prepare/json-c)
264 endef
265
266 define Build/Configure
267         ( cd $(PKG_BUILD_DIR); ./rebootstrap.sh; )
268 $(call Build/Configure/Default)
269         $(foreach m,$(FS_MOD_AVAILABLE),
270                 $(if $(CONFIG_PACKAGE_freeswitch-mod-$(m)),
271                         $(SED) 's|^[ #]*\([^#]*/mod_$(subst -,_,$(m))\)$$$$|\1|g' $(PKG_BUILD_DIR)/modules.conf
272                 ,
273                         $(SED) 's|^\([^#]*/mod_$(subst -,_,$(m))\)$$$$|#\1|g' $(PKG_BUILD_DIR)/modules.conf
274                 )
275         )
276 endef
277
278 define Build/Compile
279         $(MAKE) -C $(PKG_BUILD_DIR) \
280                 DESTDIR="$(PKG_INSTALL_DIR)" \
281                 LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
282                 all install
283 endef
284
285 define Build/InstallDev
286         $(INSTALL_DIR) $(1)/usr/include/freeswitch
287         $(CP) $(PKG_INSTALL_DIR)/usr/freeswitch/include/* $(1)/usr/include/freeswitch/
288         $(INSTALL_DIR) $(1)/usr/lib
289         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreeswitch.{a,so*} $(1)/usr/lib/
290 endef
291
292 define Package/freeswitch/install
293         $(INSTALL_DIR) $(1)/usr/bin
294         $(CP) $(PKG_INSTALL_DIR)/usr/bin/freeswitch $(1)/usr/bin/
295         $(INSTALL_DIR) $(1)/usr/lib
296         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreeswitch.so.* $(1)/usr/lib/
297         $(INSTALL_DIR) $(1)/usr/lib/freeswitch
298         $(INSTALL_DIR) $(1)/etc/default
299         $(INSTALL_DATA) ./files/freeswitch.default $(1)/etc/default/freeswitch
300         $(INSTALL_DIR) $(1)/etc/init.d
301         $(INSTALL_BIN) ./files/freeswitch.init $(1)/etc/init.d/freeswitch
302 endef
303
304 define Package/freeswitch-default/install
305         $(INSTALL_DIR) $(1)/etc/freeswitch
306         $(CP) $(PKG_INSTALL_DIR)/etc/freeswitch/* $(1)/etc/freeswitch/
307 endef
308
309 define Package/freeswitch-minimal/install
310         $(INSTALL_DIR) $(1)/etc/freeswitch
311         $(CP) $(PKG_INSTALL_DIR)/etc/freeswitch/* $(1)/etc/freeswitch/
312 endef
313
314 define Package/freeswitch-tools/install
315         $(INSTALL_DIR) $(1)/usr/bin
316         $(CP) $(PKG_INSTALL_DIR)/usr/bin/fs_cli $(1)/usr/bin/
317 endef
318
319 # 1. Name
320 # 2. Title
321 # 3. Files
322 # 4. Inter Depends
323 # 5. Extra Depends
324 define BuildPlugin
325   define Package/freeswitch-mod-$(1)
326     $$(call Package/freeswitch/Default)
327     TITLE:= FS $(2) module
328     DEPENDS:=freeswitch $$(foreach m,$(4),+freeswitch-mod-$$m) $(5)
329   endef
330
331   define Package/freeswitch-mod-$(1)/install
332         [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeswitch
333         for f in $(3); do \
334                 $(CP) \
335                         $(PKG_INSTALL_DIR)/usr/lib/freeswitch/$$$$$$$${f}.so \
336                         $$(1)/usr/lib/freeswitch/ ; \
337         done
338   endef
339
340   $$(eval $$(call BuildPackage,freeswitch-mod-$(1)))
341 endef
342
343 $(eval $(call BuildPackage,freeswitch))
344 $(eval $(call BuildPackage,freeswitch-default))
345 $(eval $(call BuildPackage,freeswitch-minimal))
346 $(eval $(call BuildPackage,freeswitch-tools))
347
348 #$(eval $(call BuildPlugin,Name,Title,Files,Depends))
349 $(eval $(call BuildPlugin,alsa,Alsa endpoint,mod_alsa,,+alsa-lib))
350 $(eval $(call BuildPlugin,amr,GSM-AMR codec,mod_amr,,))
351 $(eval $(call BuildPlugin,amrwb,GSM-AMRWB,mod_amrwb,,))
352 $(eval $(call BuildPlugin,cdr-csv,CSV-CDR handler,mod_cdr_csv,,))
353 $(eval $(call BuildPlugin,celt,CELT ultra-low delay codec,mod_celt,,))
354 $(eval $(call BuildPlugin,cepstral,Cepstral interface,mod_cepstral,,@BROKEN)) # needs <swift.h>
355 $(eval $(call BuildPlugin,cluechoo,Framework Demo,mod_cluechoo,,))
356 $(eval $(call BuildPlugin,commands,API commands,mod_commands,,))
357 $(eval $(call BuildPlugin,conference,Conference room,mod_conference,,))
358 $(eval $(call BuildPlugin,console,Console logger,mod_console,,))
359 $(eval $(call BuildPlugin,curl,HTTP request,mod_curl,,))
360 $(eval $(call BuildPlugin,dahdi-codec,DAHDI codecs,mod_dahdi_codec,,))
361 $(eval $(call BuildPlugin,dialplan-asterisk,Asterisk dialplan parser,mod_dialplan_asterisk,,))
362 $(eval $(call BuildPlugin,dialplan-directory,Dialplan-Directory interface,mod_dialplan_directory,,))
363 $(eval $(call BuildPlugin,dialplan-xml,Dialplan-XML interface,mod_dialplan_xml,,))
364 $(eval $(call BuildPlugin,dingaling,Jabber interface,mod_dingaling,,))
365 $(eval $(call BuildPlugin,dptools,Dialplan tools,mod_dptools,,))
366 $(eval $(call BuildPlugin,easyroute,DID routing,mod_easyroute,,))
367 $(eval $(call BuildPlugin,enum,ENUM routing,mod_enum,,))
368 $(eval $(call BuildPlugin,erlang-event,Erlang event handler,mod_erlang_event,,@BROKEN)) # needs <ei.h>
369 $(eval $(call BuildPlugin,esf,Extra SIP Functionality,mod_esf,,))
370 $(eval $(call BuildPlugin,event-multicast,Multicast event handler,mod_event_multicast,,))
371 $(eval $(call BuildPlugin,event-socket,Socket event handler,mod_event_socket,,))
372 $(eval $(call BuildPlugin,expr,Expression evaluation,mod_expr,,))
373 $(eval $(call BuildPlugin,fax,Fax,mod_fax,,@BROKEN)) # fails in spandsp
374 $(eval $(call BuildPlugin,fifo,FIFO,mod_fifo,,))
375 $(eval $(call BuildPlugin,file-string,File streaming,mod_file_string,,))
376 $(eval $(call BuildPlugin,flite,Festival TTS,mod_flite,,))
377 $(eval $(call BuildPlugin,fsv,Video,mod_fsv,,))
378 $(eval $(call BuildPlugin,g723-1,G.723.1 codec,mod_g723_1,,))
379 $(eval $(call BuildPlugin,g729,G.729 codec,mod_g729,,))
380 $(eval $(call BuildPlugin,h26x,H26X linear codec,mod_h26x,,))
381 $(eval $(call BuildPlugin,iax,IAX2 interface,mod_iax,,))
382 $(eval $(call BuildPlugin,ilbc,ILBC codec,mod_ilbc,,))
383 $(eval $(call BuildPlugin,lcr,Least Cost Routing,mod_lcr,,))
384 $(eval $(call BuildPlugin,ldap,LDAP interface,mod_ldap,,@BROKEN)) # fails in openldap
385 $(eval $(call BuildPlugin,limit,Resource limitation,mod_limit,,))
386 $(eval $(call BuildPlugin,local-stream,Local streaming,mod_local_stream,,))
387 $(eval $(call BuildPlugin,logfile,File logger,mod_logfile,,))
388 $(eval $(call BuildPlugin,loopback,Loopback endpoint,mod_loopback,,))
389 $(eval $(call BuildPlugin,lua,Lua language interface,mod_lua,,+libstdcpp)) # needs C++
390 $(eval $(call BuildPlugin,memcache,MemCached interface,mod_memcache,,@BROKEN)) # fails in libmemcached
391 $(eval $(call BuildPlugin,native-file,Native files,mod_native_file,,))
392 $(eval $(call BuildPlugin,nibblebill,Billing,mod_nibblebill,,))
393 $(eval $(call BuildPlugin,opal,Multi-Protocol endpoint,mod_opal,,@BROKEN)) # needs Opal
394 $(eval $(call BuildPlugin,openzap,Zaptel hardware interface,mod_openzap ozmod_analog ozmod_analog_em ozmod_isdn ozmod_skel ozmod_ss7_boost ozmod_zt,,+libpcap))
395 $(eval $(call BuildPlugin,perl,Perl language interface,mod_perl,,+perl @BROKEN)) # needs Perl
396 $(eval $(call BuildPlugin,pocketsphinx,PocketSphinx SR,mod_pocketsphinx,,@BROKEN)) # fails in sphinxbase
397 $(eval $(call BuildPlugin,portaudio,Local audio endpoint,mod_portaudio,,+alsa-lib))
398 $(eval $(call BuildPlugin,python,Python language interface,mod_python,,+python @BROKEN)) # needs Python
399 $(eval $(call BuildPlugin,radius-cdr,Radius-CDR interface,mod_radius_cdr,,@BROKEN)) # fails in freeradius-client
400 $(eval $(call BuildPlugin,rss,RRS feeds via TTS,mod_rss,,))
401 $(eval $(call BuildPlugin,say-de,German say,mod_say_de,,))
402 $(eval $(call BuildPlugin,say-en,English say,mod_say_en,,))
403 $(eval $(call BuildPlugin,say-es,Spanish say,mod_say_es,,))
404 $(eval $(call BuildPlugin,say-fr,French say,mod_say_fr,,))
405 $(eval $(call BuildPlugin,say-it,Italian say,mod_say_it,,))
406 $(eval $(call BuildPlugin,say-nl,Dutch say,mod_say_nl,,))
407 $(eval $(call BuildPlugin,say-ru,Russian say,mod_say_ru,,))
408 $(eval $(call BuildPlugin,say-zh,Chineese say,mod_say_zh,,))
409 $(eval $(call BuildPlugin,shout,MP3 and Shoutcast stream,mod_shout,,@BROKEN)) # needs Ogg/Vorbis
410 $(eval $(call BuildPlugin,siren,G.722.1 codec,mod_siren,,@BROKEN)) # fails in libg722_1
411 $(eval $(call BuildPlugin,skypiax,Skype compatible endpoint,mod_skypiax,,@BROKEN)) # needs <X11/Xlib.h>
412 $(eval $(call BuildPlugin,sndfile,Multi-Format file transcoder,mod_sndfile,,))
413 $(eval $(call BuildPlugin,snom,SNOM specific features,mod_snom,,))
414 $(eval $(call BuildPlugin,sofia,SIP,mod_sofia,,))
415 $(eval $(call BuildPlugin,soundtouch,Sound effects,mod_soundtouch,,@BROKEN)) # fails in soundtouch
416 $(eval $(call BuildPlugin,speex,Speex codec,mod_speex,,))
417 $(eval $(call BuildPlugin,spidermonkey,JavaScript,mod_spidermonkey,,@BROKEN)) # fails in js
418 $(eval $(call BuildPlugin,spidermonkey-core_db,JavaScript DB,mod_spidermonkey_core_db,,@BROKEN))
419 $(eval $(call BuildPlugin,spidermonkey-curl,JavaScript Curl,mod_spidermonkey_curl,,@BROKEN))
420 $(eval $(call BuildPlugin,spidermonkey-odbc,JavaScript ODBC,mod_spidermonkey_odbc,,@BROKEN))
421 $(eval $(call BuildPlugin,spidermonkey-socket,JavaScript socket,mod_spidermonkey_socket,,@BROKEN))
422 $(eval $(call BuildPlugin,spidermonkey-teletone,JavaScript teletone,mod_spidermonkey_teletone,,@BROKEN))
423 $(eval $(call BuildPlugin,spy,User spy,mod_spy,,))
424 $(eval $(call BuildPlugin,syslog,SysLog logger,mod_syslog,,))
425 $(eval $(call BuildPlugin,tone-stream,Tone generation stream,mod_tone_stream,,))
426 $(eval $(call BuildPlugin,unimrcp,MRCP interface,mod_unimrcp,,))
427 $(eval $(call BuildPlugin,vmd,VoiceMail beep detection,mod_vmd,,))
428 $(eval $(call BuildPlugin,voicemail,VoiceMail,mod_voicemail,,))
429 $(eval $(call BuildPlugin,voipcodecs,VoIP codecs,mod_voipcodecs,,))
430 $(eval $(call BuildPlugin,xml-cdr,XML-CDR handler,mod_xml_cdr,,+libcurl))
431 $(eval $(call BuildPlugin,xml-curl,XML-Curl gateway,mod_xml_curl,,+libcurl))
432 $(eval $(call BuildPlugin,xml-ldap,LDAP-XML gateway,mod_xml_ldap,,@BROKEN)) # fails in openldap
433 $(eval $(call BuildPlugin,xml-rpc,XML-RPC interface,mod_xml_rpc,,))
434 $(eval $(call BuildPlugin,yaml,YAML dialplans,mod_yaml,,))