build the transitional iptables-extra meta-package too (port of changeset:2558)
[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.0.10
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=f60f4c4edc36fa61dc55a5385fd82e71
9
10 PKG_SOURCE_URL:=http://ftp.digium.com/pub/asterisk/ ftp://ftp.digium.com/pub/asterisk/
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_MYSQL,asterisk-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
20 $(eval $(call PKG_template,ASTERISK_PGSQL,asterisk-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
21 $(eval $(call PKG_template,ASTERISK_VOICEMAIL,asterisk-voicemail,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
22 $(eval $(call PKG_template,ASTERISK_SOUNDS,asterisk-sounds,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
23 $(eval $(call PKG_template,ASTERISK_CHAN_BLUETOOTH,asterisk-chan-bluetooth,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
24 $(eval $(call PKG_template,ASTERISK_CHAN_MGCP,asterisk-chan-mgcp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
25 $(eval $(call PKG_template,ASTERISK_CHAN_SKINNY,asterisk-chan-skinny,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
26 $(eval $(call PKG_template,ASTERISK_CODEC_ILBC,asterisk-codec-ilbc,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
27 $(eval $(call PKG_template,ASTERISK_CODEC_LPC10,asterisk-codec-lpc10,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
28 $(eval $(call PKG_template,ASTERISK_CODEC_SPEEX,asterisk-codec-speex,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
29 $(eval $(call PKG_template,ASTERISK_PBX_DUNDI,asterisk-pbx-dundi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
30 $(eval $(call PKG_template,ASTERISK_RES_AGI,asterisk-res-agi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
31
32 ifneq ($(DEVELOPER),)
33 APPS:=app_sql_mysql.so app_sql_postgres.so
34 MODS:=cdr_mysql.so cdr_pgsql.so
35 SPEEX:=codec_speex.so
36 else
37 APPS:=
38 MODS:=
39 ifneq ($(BR2_PACKAGE_ASTERISK_MYSQL),)
40 APPS += app_sql_mysql.so
41 MODS += cdr_mysql.so
42 endif
43 ifneq ($(BR2_PACKAGE_ASTERISK_PGSQL),)
44 APPS += app_sql_postgres.so
45 MODS += cdr_pgsql.so
46 endif
47 ifneq ($(BR2_PACKAGE_ASTERISK_CODEC_SPEEX),)
48 SPEEX:=codec_speex.so
49 endif
50 endif
51
52 $(PKG_BUILD_DIR)/.configured:
53 touch $@
54
55 $(PKG_BUILD_DIR)/.built:
56 $(MAKE) -C "$(PKG_BUILD_DIR)/channels" \
57 CC="$(HOSTCC)" \
58 gentone
59 $(MAKE) -C "$(PKG_BUILD_DIR)" \
60 CC_FOR_BUILD="$(HOSTCC)" \
61 $(TARGET_CONFIGURE_OPTS) \
62 OPTIMIZE="$(TARGET_CFLAGS)" \
63 PROC="$(ARCH)" \
64 CFLAGS_EXTRA="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/speex" \
65 LDFLAGS_EXTRA="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/lib/mysql" \
66 CRYPTO_LIBS="-L$(STAGING_DIR)/usr/lib -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic" \
67 EXTRA_APPS="$(APPS)" \
68 EXTRA_MODS="$(MODS)" \
69 MODSPEEX="$(SPEEX)"
70 $(MAKE) -C $(PKG_BUILD_DIR) \
71 DESTDIR="$(PKG_INSTALL_DIR)" \
72 install samples
73 touch $@
74
75 $(IPKG_ASTERISK):
76 cp -fpR $(PKG_INSTALL_DIR)/* $(IDIR_ASTERISK)
77 rm -rf $(IDIR_ASTERISK)/usr/sbin/astgenkey
78 rm -rf $(IDIR_ASTERISK)/usr/bin
79 rm -rf $(IDIR_ASTERISK)/usr/share
80 rm -rf $(IDIR_ASTERISK)/usr/include
81 rm -rf $(IDIR_ASTERISK)/var
82 (cd $(IDIR_ASTERISK)/usr/lib/asterisk; \
83 rm -rf agi-bin/*; \
84 rm -rf images; \
85 rm -rf keys/*; \
86 rm -rf mohmp3/*.mp3; \
87 rm -rf sounds/*; \
88 cd modules; \
89 rm -rf *adsi* *festival* *modem* *meetme* *oss* *phone* *intercom* \
90 *mp3* *nbscat* *mysql* *postgres* *pgsql* *voicemail* *speex* \
91 *zapateller* *jpeg*; \
92 rm -f chan_bluetooth.so ; \
93 rm -f chan_mgcp.so ; \
94 rm -f chan_skinny.so ; \
95 rm -f {codec,format}_ilbc.so ; \
96 rm -f codec_lpc10.so ; \
97 rm -f pbx_dundi.so ; \
98 rm -f res_agi.so ; \
99 )
100 (cd $(IDIR_ASTERISK)/etc/asterisk; \
101 rm -f *odbc* *mysql* *postgres* *pgsql* *voicemail* *adsi* *oss* *alsa* \
102 *festival* *modem* *meetme* *phone* *tds* *vofr* *rpt* *vpb* \
103 *zapata*; \
104 rm -f bluetooth.conf ; \
105 rm -f mgcp.conf ; \
106 rm -f skinny.conf ; \
107 rm -f dundi.conf ; \
108 )
109 $(SED) 's|/var/lib/asterisk|/usr/lib/asterisk|g' $(IDIR_ASTERISK)/etc/asterisk/musiconhold.conf
110 rm -f $(IDIR_ASTERISK)/etc/asterisk/*.old
111 install -d -m0755 $(IDIR_ASTERISK)/etc/default
112 install -m0644 ./files/asterisk.default $(IDIR_ASTERISK)/etc/default/asterisk
113 install -d -m0755 $(IDIR_ASTERISK)/etc/init.d
114 install -m0755 ./files/asterisk.init $(IDIR_ASTERISK)/etc/init.d/asterisk
115 ln -sf asterisk $(IDIR_ASTERISK)/etc/init.d/S60asterisk
116 $(RSTRIP) $(IDIR_ASTERISK)
117 $(IPKG_BUILD) $(IDIR_ASTERISK) $(PACKAGE_DIR)
118
119 $(IPKG_ASTERISK_MYSQL):
120 install -d -m0755 $(IDIR_ASTERISK_MYSQL)/etc/asterisk
121 install -m0600 $(PKG_BUILD_DIR)/configs/cdr_mysql.conf.sample $(IDIR_ASTERISK_MYSQL)/etc/asterisk/cdr_mysql.conf
122 install -d -m0755 $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules
123 install -m0755 $(PKG_BUILD_DIR)/apps/app_sql_mysql.so $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/
124 install -m0755 $(PKG_BUILD_DIR)/cdr/cdr_mysql.so $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/
125 $(RSTRIP) $(IDIR_ASTERISK_MYSQL)
126 $(IPKG_BUILD) $(IDIR_ASTERISK_MYSQL) $(PACKAGE_DIR)
127
128 $(IPKG_ASTERISK_PGSQL):
129 install -d -m0755 $(IDIR_ASTERISK_PGSQL)/etc/asterisk
130 install -m0600 $(PKG_BUILD_DIR)/configs/cdr_pgsql.conf.sample $(IDIR_ASTERISK_PGSQL)/etc/asterisk/cdr_pgsql.conf
131 install -d -m0755 $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules
132 install -m0755 $(PKG_BUILD_DIR)/apps/app_sql_postgres.so $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/
133 install -m0755 $(PKG_BUILD_DIR)/cdr/cdr_pgsql.so $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/
134 $(RSTRIP) $(IDIR_ASTERISK_PGSQL)
135 $(IPKG_BUILD) $(IDIR_ASTERISK_PGSQL) $(PACKAGE_DIR)
136
137 $(IPKG_ASTERISK_SOUNDS):
138 install -d -m0755 $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds
139 cp -fpR $(PKG_BUILD_DIR)/sounds/* $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/
140 rm -f $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/*.mp3
141 rm -f $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/vm-*
142 $(IPKG_BUILD) $(IDIR_ASTERISK_SOUNDS) $(PACKAGE_DIR)
143
144 $(IPKG_ASTERISK_VOICEMAIL):
145 install -d -m0755 $(IDIR_ASTERISK_VOICEMAIL)/etc/asterisk
146 install -m0644 $(PKG_BUILD_DIR)/configs/voicemail.conf.sample $(IDIR_ASTERISK_VOICEMAIL)/etc/asterisk/voicemail.conf
147 install -d -m0755 $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules
148 install -m0755 $(PKG_BUILD_DIR)/apps/*voicemail.so $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules/
149 install -m0755 $(PKG_BUILD_DIR)/res/res_adsi.so $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules/
150 install -d -m0755 $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/sounds
151 cp -fpR $(PKG_BUILD_DIR)/sounds/vm-*.gsm $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/sounds/
152 $(RSTRIP) $(IDIR_ASTERISK_VOICEMAIL)
153 $(IPKG_BUILD) $(IDIR_ASTERISK_VOICEMAIL) $(PACKAGE_DIR)
154
155 $(IPKG_ASTERISK_CHAN_BLUETOOTH):
156 install -d -m0755 $(IDIR_ASTERISK_CHAN_BLUETOOTH)/etc/asterisk
157 install -m0644 $(PKG_BUILD_DIR)/configs/bluetooth.conf $(IDIR_ASTERISK_CHAN_BLUETOOTH)/etc/asterisk/bluetooth.conf
158 install -d -m0755 $(IDIR_ASTERISK_CHAN_BLUETOOTH)/usr/lib/asterisk/modules
159 install -m0755 $(PKG_BUILD_DIR)/channels/chan_bluetooth.so $(IDIR_ASTERISK_CHAN_BLUETOOTH)/usr/lib/asterisk/modules/
160 $(RSTRIP) $(IDIR_ASTERISK_CHAN_BLUETOOTH)
161 $(IPKG_BUILD) $(IDIR_ASTERISK_CHAN_BLUETOOTH) $(PACKAGE_DIR)
162
163 $(IPKG_ASTERISK_CHAN_MGCP):
164 install -d -m0755 $(IDIR_ASTERISK_CHAN_MGCP)/etc/asterisk
165 install -m0644 $(PKG_BUILD_DIR)/configs/mgcp.conf.sample $(IDIR_ASTERISK_CHAN_MGCP)/etc/asterisk/mgcp.conf
166 install -d -m0755 $(IDIR_ASTERISK_CHAN_MGCP)/usr/lib/asterisk/modules
167 install -m0755 $(PKG_BUILD_DIR)/channels/chan_mgcp.so $(IDIR_ASTERISK_CHAN_MGCP)/usr/lib/asterisk/modules/
168 $(RSTRIP) $(IDIR_ASTERISK_CHAN_MGCP)
169 $(IPKG_BUILD) $(IDIR_ASTERISK_CHAN_MGCP) $(PACKAGE_DIR)
170
171 $(IPKG_ASTERISK_CHAN_SKINNY):
172 install -d -m0755 $(IDIR_ASTERISK_CHAN_SKINNY)/etc/asterisk
173 install -m0644 $(PKG_BUILD_DIR)/configs/skinny.conf.sample $(IDIR_ASTERISK_CHAN_SKINNY)/etc/asterisk/skinny.conf
174 install -d -m0755 $(IDIR_ASTERISK_CHAN_SKINNY)/usr/lib/asterisk/modules
175 install -m0755 $(PKG_BUILD_DIR)/channels/chan_skinny.so $(IDIR_ASTERISK_CHAN_SKINNY)/usr/lib/asterisk/modules/
176 $(RSTRIP) $(IDIR_ASTERISK_CHAN_SKINNY)
177 $(IPKG_BUILD) $(IDIR_ASTERISK_CHAN_SKINNY) $(PACKAGE_DIR)
178
179 $(IPKG_ASTERISK_CODEC_ILBC):
180 install -d -m0755 $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules
181 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_ilbc.so $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules/
182 install -m0755 $(PKG_BUILD_DIR)/formats/format_ilbc.so $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules/
183 $(RSTRIP) $(IDIR_ASTERISK_CODEC_ILBC)
184 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_ILBC) $(PACKAGE_DIR)
185
186 $(IPKG_ASTERISK_CODEC_LPC10):
187 install -d -m0755 $(IDIR_ASTERISK_CODEC_LPC10)/usr/lib/asterisk/modules
188 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_lpc10.so $(IDIR_ASTERISK_CODEC_LPC10)/usr/lib/asterisk/modules/
189 $(RSTRIP) $(IDIR_ASTERISK_CODEC_LPC10)
190 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_LPC10) $(PACKAGE_DIR)
191
192 $(IPKG_ASTERISK_CODEC_SPEEX):
193 install -d -m0755 $(IDIR_ASTERISK_CODEC_SPEEX)/usr/lib/asterisk/modules
194 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_speex.so $(IDIR_ASTERISK_CODEC_SPEEX)/usr/lib/asterisk/modules/
195 $(RSTRIP) $(IDIR_ASTERISK_CODEC_SPEEX)
196 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_SPEEX) $(PACKAGE_DIR)
197
198 $(IPKG_ASTERISK_PBX_DUNDI):
199 install -d -m0755 $(IDIR_ASTERISK_PBX_DUNDI)/etc/asterisk
200 install -m0644 $(PKG_BUILD_DIR)/configs/dundi.conf.sample $(IDIR_ASTERISK_PBX_DUNDI)/etc/asterisk/dundi.conf
201 install -d -m0755 $(IDIR_ASTERISK_PBX_DUNDI)/usr/lib/asterisk/modules
202 install -m0755 $(PKG_BUILD_DIR)/pbx/pbx_dundi.so $(IDIR_ASTERISK_PBX_DUNDI)/usr/lib/asterisk/modules/
203 $(RSTRIP) $(IDIR_ASTERISK_PBX_DUNDI)
204 $(IPKG_BUILD) $(IDIR_ASTERISK_PBX_DUNDI) $(PACKAGE_DIR)
205
206 $(IPKG_ASTERISK_RES_AGI):
207 install -d -m0755 $(IDIR_ASTERISK_RES_AGI)/usr/lib/asterisk/modules
208 install -m0755 $(PKG_BUILD_DIR)/res/res_agi.so $(IDIR_ASTERISK_RES_AGI)/usr/lib/asterisk/modules/
209 $(RSTRIP) $(IDIR_ASTERISK_RES_AGI)
210 $(IPKG_BUILD) $(IDIR_ASTERISK_RES_AGI) $(PACKAGE_DIR)
211