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