eb6edee1d787463a3edf7e9dc752719fa9532091
[openwrt/svn-archive/archive.git] / openwrt / package / asterisk / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=asterisk
6 PKG_VERSION:=1.2.1
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=04657086791e80f319c0d728af705001
9
10 PKG_SOURCE_URL:=http://ftp.digium.com/pub/asterisk/old-releases/ ftp://ftp.digium.com/pub/asterisk/old-releases/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_CAT:=zcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
16
17 include $(TOPDIR)/package/rules.mk
18 $(eval $(call PKG_template,ASTERISK,asterisk,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
19 $(eval $(call PKG_template,ASTERISK_MINI,asterisk-mini,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
20 $(eval $(call PKG_template,ASTERISK_MYSQL,asterisk-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
21 $(eval $(call PKG_template,ASTERISK_PGSQL,asterisk-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
22 $(eval $(call PKG_template,ASTERISK_SQLITE,asterisk-sqlite,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
23 $(eval $(call PKG_template,ASTERISK_VOICEMAIL,asterisk-voicemail,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
24 $(eval $(call PKG_template,ASTERISK_SOUNDS,asterisk-sounds,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
25 $(eval $(call PKG_template,ASTERISK_CHAN_BLUETOOTH,asterisk-chan-bluetooth,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
26 $(eval $(call PKG_template,ASTERISK_CHAN_MGCP,asterisk-chan-mgcp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
27 $(eval $(call PKG_template,ASTERISK_CHAN_SKINNY,asterisk-chan-skinny,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
28 $(eval $(call PKG_template,ASTERISK_CODEC_ILBC,asterisk-codec-ilbc,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
29 $(eval $(call PKG_template,ASTERISK_CODEC_LPC10,asterisk-codec-lpc10,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
30 $(eval $(call PKG_template,ASTERISK_CODEC_SPEEX,asterisk-codec-speex,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
31 $(eval $(call PKG_template,ASTERISK_PBX_DUNDI,asterisk-pbx-dundi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
32 $(eval $(call PKG_template,ASTERISK_RES_AGI,asterisk-res-agi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
33
34 EXTRA_CFLAGS := -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
35 EXTRA_LDFLAGS := -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
36
37 ifneq ($(BR2_PACKAGE_ASTERISK_MYSQL),)
38 EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/mysql
39 EXTRA_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql
40 EXTRA_APP_MODULES += app_sql_mysql.so
41 EXTRA_CDR_MODULES += cdr_mysql.so
42 EXTRA_RES_MODULES += res_config_mysql.so
43 endif
44 ifneq ($(BR2_PACKAGE_ASTERISK_PGSQL),)
45 EXTRA_APP_MODULES += app_sql_postgres.so
46 EXTRA_CDR_MODULES += cdr_pgsql.so
47 endif
48 ifneq ($(BR2_PACKAGE_ASTERISK_SQLITE),)
49 EXTRA_CDR_MODULES += cdr_sqlite.so
50 endif
51 ifneq ($(BR2_PACKAGE_ASTERISK_CODEC_SPEEX),)
52 EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/speex
53 EXTRA_CODEC_MODULES += codec_speex.so
54 endif
55
56 $(PKG_BUILD_DIR)/.configured:
57 touch $@
58
59 $(PKG_BUILD_DIR)/.built:
60 $(MAKE) -C "$(PKG_BUILD_DIR)" \
61 CROSS_ARCH="Linux" \
62 CROSS_COMPILE="$(TARGET_CROSS)" \
63 CROSS_COMPILE_BIN="/void/" \
64 CROSS_COMPILE_TARGET="/void/" \
65 $(TARGET_CONFIGURE_OPTS) \
66 HOST_CC="$(HOSTCC)" \
67 OPTIMIZE="$(TARGET_CFLAGS)" \
68 PROC="$(ARCH)" \
69 DEBUG="" \
70 OPTIONS="-DLOW_MEMORY -Dlinux" \
71 NOCRYPTO="yes" \
72 EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
73 EXTRA_LDFLAGS="$(EXTRA_LDFLAGS)" \
74 EXTRA_APP_MODULES="$(EXTRA_APP_MODULES)" \
75 EXTRA_CDR_MODULES="$(EXTRA_CDR_MODULES)" \
76 EXTRA_CODEC_MODULES="$(EXTRA_CODEC_MODULES)" \
77 EXTRA_RES_MODULES="$(EXTRA_RES_MODULES)" \
78 DESTDIR="$(PKG_INSTALL_DIR)" \
79 ASTVARLIBDIR="/usr/lib/asterisk" \
80 all install samples
81 rm -f $(PKG_INSTALL_DIR)/etc/asterisk/*.old
82 touch $@
83
84 $(IPKG_ASTERISK):
85 $(CP) $(PKG_INSTALL_DIR)/* $(IDIR_ASTERISK)
86 rm -rf $(IDIR_ASTERISK)/usr/sbin/astgenkey
87 rm -rf $(IDIR_ASTERISK)/usr/bin
88 rm -rf $(IDIR_ASTERISK)/usr/share
89 rm -rf $(IDIR_ASTERISK)/usr/include
90 rm -rf $(IDIR_ASTERISK)/var
91 (cd $(IDIR_ASTERISK)/usr/lib/asterisk; \
92 rm -rf agi-bin; \
93 rm -rf images; \
94 rm -rf keys/*; \
95 rm -rf mohmp3/*.mp3; \
96 rm -rf sounds/*; \
97 cd modules; \
98 rm -rf *adsi* *festival* *modem* *meetme* *oss* *phone* *intercom* \
99 *mp3* *nbscat* *mysql* *postgres* *pgsql* *voicemail* *speex* \
100 *zapateller* *jpeg*; \
101 rm -f chan_bluetooth.so ; \
102 rm -f chan_mgcp.so ; \
103 rm -f chan_skinny.so ; \
104 rm -f {codec,format}_ilbc.so ; \
105 rm -f codec_lpc10.so ; \
106 rm -f pbx_dundi.so ; \
107 rm -f res_agi.so ; \
108 )
109 (cd $(IDIR_ASTERISK)/etc/asterisk; \
110 rm -f *odbc* *mysql* *postgres* *pgsql* *voicemail* *adsi* *oss* *alsa* \
111 *festival* *modem* *meetme* *phone* *tds* *vofr* *rpt* *vpb* \
112 *zapata*; \
113 rm -f bluetooth.conf ; \
114 rm -f mgcp.conf ; \
115 rm -f skinny.conf ; \
116 rm -f dundi.conf ; \
117 )
118 install -m0644 ./files/modules.conf $(IDIR_ASTERISK)/etc/asterisk/
119 $(SED) 's|/var/lib/asterisk|/usr/lib/asterisk|g' $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf
120 install -d -m0755 $(IDIR_ASTERISK)/etc/default
121 install -m0644 ./files/asterisk.default $(IDIR_ASTERISK)/etc/default/asterisk
122 install -d -m0755 $(IDIR_ASTERISK)/etc/init.d
123 install -m0755 ./files/asterisk.init $(IDIR_ASTERISK)/etc/init.d/asterisk
124 ln -sf asterisk $(IDIR_ASTERISK)/etc/init.d/S60asterisk
125 $(RSTRIP) $(IDIR_ASTERISK)
126 $(IPKG_BUILD) $(IDIR_ASTERISK) $(PACKAGE_DIR)
127
128 $(IPKG_ASTERISK_MINI):
129 install -d -m0755 $(IDIR_ASTERISK_MINI)/etc/asterisk
130 for f in asterisk enum extconfig extensions features iax iaxprov logger manager modules musiconhold rtp sip; do \
131 $(CP) $(PKG_INSTALL_DIR)/etc/asterisk/$$f.conf $(IDIR_ASTERISK_MINI)/etc/asterisk/ ; \
132 done
133 install -m0644 ./files/modules.conf $(IDIR_ASTERISK)/etc/asterisk/
134 $(SED) 's|/var/lib/asterisk|/usr/lib/asterisk|g' $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf
135 install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk
136 $(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/firmware $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/
137 install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/keys
138 install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/modules
139 for f in chan_iax2 chan_local chan_sip codec_gsm codec_ulaw format_gsm format_pcm format_wav \
140 format_wav_gsm pbx_config res_features res_musiconhold; do \
141 $(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$$f.so $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/modules/ ; \
142 done
143 install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/mohmp3
144 install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/lib/asterisk/sounds
145 install -d -m0755 $(IDIR_ASTERISK_MINI)/usr/sbin
146 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/asterisk $(IDIR_ASTERISK_MINI)/usr/sbin/
147 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/safe_asterisk $(IDIR_ASTERISK_MINI)/usr/sbin/
148 install -d -m0755 $(IDIR_ASTERISK_MINI)/etc/default
149 install -m0644 ./files/asterisk.default $(IDIR_ASTERISK_MINI)/etc/default/asterisk
150 install -d -m0755 $(IDIR_ASTERISK_MINI)/etc/init.d
151 install -m0755 ./files/asterisk.init $(IDIR_ASTERISK_MINI)/etc/init.d/asterisk
152 ln -sf asterisk $(IDIR_ASTERISK_MINI)/etc/init.d/S60asterisk
153 $(RSTRIP) $(IDIR_ASTERISK_MINI)
154 $(IPKG_BUILD) $(IDIR_ASTERISK_MINI) $(PACKAGE_DIR)
155
156 $(IPKG_ASTERISK_MYSQL):
157 install -d -m0755 $(IDIR_ASTERISK_MYSQL)/etc/asterisk
158 install -m0600 $(PKG_BUILD_DIR)/configs/cdr_mysql.conf.sample $(IDIR_ASTERISK_MYSQL)/etc/asterisk/cdr_mysql.conf
159 install -d -m0755 $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules
160 install -m0755 $(PKG_BUILD_DIR)/apps/app_sql_mysql.so $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/
161 install -m0755 $(PKG_BUILD_DIR)/cdr/cdr_mysql.so $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/
162 $(RSTRIP) $(IDIR_ASTERISK_MYSQL)
163 $(IPKG_BUILD) $(IDIR_ASTERISK_MYSQL) $(PACKAGE_DIR)
164
165 $(IPKG_ASTERISK_PGSQL):
166 install -d -m0755 $(IDIR_ASTERISK_PGSQL)/etc/asterisk
167 install -m0600 $(PKG_BUILD_DIR)/configs/cdr_pgsql.conf.sample $(IDIR_ASTERISK_PGSQL)/etc/asterisk/cdr_pgsql.conf
168 install -d -m0755 $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules
169 install -m0755 $(PKG_BUILD_DIR)/apps/app_sql_postgres.so $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/
170 install -m0755 $(PKG_BUILD_DIR)/cdr/cdr_pgsql.so $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/
171 $(RSTRIP) $(IDIR_ASTERISK_PGSQL)
172 $(IPKG_BUILD) $(IDIR_ASTERISK_PGSQL) $(PACKAGE_DIR)
173
174 $(IPKG_ASTERISK_SQLITE):
175 install -d -m0755 $(IDIR_ASTERISK_SQLITE)/usr/lib/asterisk/modules
176 install -m0755 $(PKG_BUILD_DIR)/cdr/cdr_sqlite.so $(IDIR_ASTERISK_SQLITE)/usr/lib/asterisk/modules/
177 $(RSTRIP) $(IDIR_ASTERISK_SQLITE)
178 $(IPKG_BUILD) $(IDIR_ASTERISK_SQLITE) $(PACKAGE_DIR)
179
180 $(IPKG_ASTERISK_SOUNDS):
181 install -d -m0755 $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds
182 $(CP) $(PKG_BUILD_DIR)/sounds/* $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/
183 rm -f $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/*.mp3
184 rm -f $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/vm-*
185 $(IPKG_BUILD) $(IDIR_ASTERISK_SOUNDS) $(PACKAGE_DIR)
186
187 $(IPKG_ASTERISK_VOICEMAIL):
188 install -d -m0755 $(IDIR_ASTERISK_VOICEMAIL)/etc/asterisk
189 install -m0644 $(PKG_BUILD_DIR)/configs/voicemail.conf.sample $(IDIR_ASTERISK_VOICEMAIL)/etc/asterisk/voicemail.conf
190 install -d -m0755 $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules
191 install -m0755 $(PKG_BUILD_DIR)/apps/*voicemail.so $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules/
192 install -m0755 $(PKG_BUILD_DIR)/res/res_adsi.so $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules/
193 install -d -m0755 $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/sounds
194 $(CP) $(PKG_BUILD_DIR)/sounds/vm-*.gsm $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/sounds/
195 $(RSTRIP) $(IDIR_ASTERISK_VOICEMAIL)
196 $(IPKG_BUILD) $(IDIR_ASTERISK_VOICEMAIL) $(PACKAGE_DIR)
197
198 $(IPKG_ASTERISK_CHAN_BLUETOOTH):
199 install -d -m0755 $(IDIR_ASTERISK_CHAN_BLUETOOTH)/etc/asterisk
200 install -m0644 $(PKG_BUILD_DIR)/configs/bluetooth.conf $(IDIR_ASTERISK_CHAN_BLUETOOTH)/etc/asterisk/bluetooth.conf
201 install -d -m0755 $(IDIR_ASTERISK_CHAN_BLUETOOTH)/usr/lib/asterisk/modules
202 install -m0755 $(PKG_BUILD_DIR)/channels/chan_bluetooth.so $(IDIR_ASTERISK_CHAN_BLUETOOTH)/usr/lib/asterisk/modules/
203 $(RSTRIP) $(IDIR_ASTERISK_CHAN_BLUETOOTH)
204 $(IPKG_BUILD) $(IDIR_ASTERISK_CHAN_BLUETOOTH) $(PACKAGE_DIR)
205
206 $(IPKG_ASTERISK_CHAN_MGCP):
207 install -d -m0755 $(IDIR_ASTERISK_CHAN_MGCP)/etc/asterisk
208 install -m0644 $(PKG_BUILD_DIR)/configs/mgcp.conf.sample $(IDIR_ASTERISK_CHAN_MGCP)/etc/asterisk/mgcp.conf
209 install -d -m0755 $(IDIR_ASTERISK_CHAN_MGCP)/usr/lib/asterisk/modules
210 install -m0755 $(PKG_BUILD_DIR)/channels/chan_mgcp.so $(IDIR_ASTERISK_CHAN_MGCP)/usr/lib/asterisk/modules/
211 $(RSTRIP) $(IDIR_ASTERISK_CHAN_MGCP)
212 $(IPKG_BUILD) $(IDIR_ASTERISK_CHAN_MGCP) $(PACKAGE_DIR)
213
214 $(IPKG_ASTERISK_CHAN_SKINNY):
215 install -d -m0755 $(IDIR_ASTERISK_CHAN_SKINNY)/etc/asterisk
216 install -m0644 $(PKG_BUILD_DIR)/configs/skinny.conf.sample $(IDIR_ASTERISK_CHAN_SKINNY)/etc/asterisk/skinny.conf
217 install -d -m0755 $(IDIR_ASTERISK_CHAN_SKINNY)/usr/lib/asterisk/modules
218 install -m0755 $(PKG_BUILD_DIR)/channels/chan_skinny.so $(IDIR_ASTERISK_CHAN_SKINNY)/usr/lib/asterisk/modules/
219 $(RSTRIP) $(IDIR_ASTERISK_CHAN_SKINNY)
220 $(IPKG_BUILD) $(IDIR_ASTERISK_CHAN_SKINNY) $(PACKAGE_DIR)
221
222 $(IPKG_ASTERISK_CODEC_ILBC):
223 install -d -m0755 $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules
224 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_ilbc.so $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules/
225 install -m0755 $(PKG_BUILD_DIR)/formats/format_ilbc.so $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules/
226 $(RSTRIP) $(IDIR_ASTERISK_CODEC_ILBC)
227 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_ILBC) $(PACKAGE_DIR)
228
229 $(IPKG_ASTERISK_CODEC_LPC10):
230 install -d -m0755 $(IDIR_ASTERISK_CODEC_LPC10)/usr/lib/asterisk/modules
231 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_lpc10.so $(IDIR_ASTERISK_CODEC_LPC10)/usr/lib/asterisk/modules/
232 $(RSTRIP) $(IDIR_ASTERISK_CODEC_LPC10)
233 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_LPC10) $(PACKAGE_DIR)
234
235 $(IPKG_ASTERISK_CODEC_SPEEX):
236 install -d -m0755 $(IDIR_ASTERISK_CODEC_SPEEX)/usr/lib/asterisk/modules
237 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_speex.so $(IDIR_ASTERISK_CODEC_SPEEX)/usr/lib/asterisk/modules/
238 $(RSTRIP) $(IDIR_ASTERISK_CODEC_SPEEX)
239 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_SPEEX) $(PACKAGE_DIR)
240
241 $(IPKG_ASTERISK_PBX_DUNDI):
242 install -d -m0755 $(IDIR_ASTERISK_PBX_DUNDI)/etc/asterisk
243 install -m0644 $(PKG_BUILD_DIR)/configs/dundi.conf.sample $(IDIR_ASTERISK_PBX_DUNDI)/etc/asterisk/dundi.conf
244 install -d -m0755 $(IDIR_ASTERISK_PBX_DUNDI)/usr/lib/asterisk/modules
245 install -m0755 $(PKG_BUILD_DIR)/pbx/pbx_dundi.so $(IDIR_ASTERISK_PBX_DUNDI)/usr/lib/asterisk/modules/
246 $(RSTRIP) $(IDIR_ASTERISK_PBX_DUNDI)
247 $(IPKG_BUILD) $(IDIR_ASTERISK_PBX_DUNDI) $(PACKAGE_DIR)
248
249 $(IPKG_ASTERISK_RES_AGI):
250 install -d -m0755 $(IDIR_ASTERISK_RES_AGI)/usr/lib/asterisk/agi-bin
251 install -d -m0755 $(IDIR_ASTERISK_RES_AGI)/usr/lib/asterisk/modules
252 install -m0755 $(PKG_BUILD_DIR)/res/res_agi.so $(IDIR_ASTERISK_RES_AGI)/usr/lib/asterisk/modules/
253 $(RSTRIP) $(IDIR_ASTERISK_RES_AGI)
254 $(IPKG_BUILD) $(IDIR_ASTERISK_RES_AGI) $(PACKAGE_DIR)
255