backport from whiterussian [1371]
[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.9
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=0d7f1c680ae53a739f26a069ef8b580a
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_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
13 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/install
14 PKG_CAT:=zcat
15
16 include $(TOPDIR)/package/rules.mk
17 $(eval $(call PKG_template,ASTERISK,asterisk,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
18 $(eval $(call PKG_template,ASTERISK_MYSQL,asterisk-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
19 $(eval $(call PKG_template,ASTERISK_PGSQL,asterisk-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
20 $(eval $(call PKG_template,ASTERISK_VOICEMAIL,asterisk-voicemail,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
21 $(eval $(call PKG_template,ASTERISK_SOUNDS,asterisk-sounds,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
22 $(eval $(call PKG_template,ASTERISK_CODEC_ILBC,asterisk-codec-ilbc,$(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_CODEC_LPC10,asterisk-codec-lpc10,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
25 $(eval $(call PKG_template,ASTERISK_CODEC_SPEEX,asterisk-codec-speex,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
26 $(eval $(call PKG_template,ASTERISK_PBX_DUNDI,asterisk-pbx-dundi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
27
28 ifneq ($(DEVELOPER),)
29 APPS:=app_sql_mysql.so app_sql_postgres.so
30 MODS:=cdr_mysql.so cdr_pgsql.so
31 SPEEX:=codec_speex.so
32 else
33 APPS:=
34 MODS:=
35 ifneq ($(BR2_PACKAGE_ASTERISK_MYSQL),)
36 APPS += app_sql_mysql.so
37 MODS += cdr_mysql.so
38 endif
39 ifneq ($(BR2_PACKAGE_ASTERISK_PGSQL),)
40 APPS += app_sql_postgres.so
41 MODS += cdr_pgsql.so
42 endif
43 ifneq ($(BR2_PACKAGE_ASTERISK_CODEC_SPEEX),)
44 SPEEX:=codec_speex.so
45 endif
46 endif
47
48 $(PKG_BUILD_DIR)/.configured:
49 touch $@
50
51 $(PKG_BUILD_DIR)/.built:
52 $(MAKE) -C "$(PKG_BUILD_DIR)/channels" \
53 CC="$(HOSTCC)" \
54 gentone
55 $(MAKE) -C "$(PKG_BUILD_DIR)" \
56 CC_FOR_BUILD="$(HOSTCC)" \
57 $(TARGET_CONFIGURE_OPTS) \
58 OPTIMIZE="$(TARGET_CFLAGS)" \
59 PROC="$(ARCH)" \
60 CFLAGS_EXTRA="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/speex" \
61 LDFLAGS_EXTRA="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/lib/mysql" \
62 CRYPTO_LIBS="-L$(STAGING_DIR)/usr/lib -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic" \
63 EXTRA_APPS="$(APPS)" \
64 EXTRA_MODS="$(MODS)" \
65 MODSPEEX="$(SPEEX)"
66 $(MAKE) -C $(PKG_BUILD_DIR) \
67 DESTDIR="$(PKG_INSTALL_DIR)" \
68 install samples
69 touch $@
70
71 $(IPKG_ASTERISK):
72 cp -fpR $(PKG_INSTALL_DIR)/* $(IDIR_ASTERISK)
73 rm -rf $(IDIR_ASTERISK)/usr/sbin/astgenkey
74 rm -rf $(IDIR_ASTERISK)/usr/bin
75 rm -rf $(IDIR_ASTERISK)/usr/share
76 rm -rf $(IDIR_ASTERISK)/usr/include
77 rm -rf $(IDIR_ASTERISK)/var
78 (cd $(IDIR_ASTERISK)/usr/lib/asterisk; \
79 rm -rf agi-bin/*; \
80 rm -rf firmware; \
81 rm -rf images; \
82 rm -rf keys/*; \
83 rm -rf mohmp3; \
84 rm -rf sounds/*; \
85 cd modules; \
86 rm -rf *adsi* *festival* *modem* *meetme* *oss* *phone* *intercom* \
87 *mp3* *nbscat* *mysql* *postgres* *pgsql* *voicemail* *speex* \
88 *musiconhold* *zapateller* *jpeg*; \
89 rm -f {codec,format}_ilbc.so ; \
90 rm -f codec_lpc10.so ; \
91 rm -f chan_bluetooth.so ; \
92 rm -f pbx_dundi.so ; \
93 )
94 (cd $(IDIR_ASTERISK)/etc/asterisk; \
95 rm -f *odbc* *mysql* *postgres* *pgsql* *voicemail* *adsi* *oss* *alsa* \
96 *festival* *modem* *meetme* *phone* *tds* *vofr* *rpt* *vpb* \
97 *zapata* *musiconhold*; \
98 rm -f bluetooth.conf ; \
99 rm -f dundi.conf ; \
100 )
101 install -d -m0755 $(IDIR_ASTERISK)/etc/default
102 install -m0644 ./files/asterisk.default $(IDIR_ASTERISK)/etc/default/asterisk
103 install -d -m0755 $(IDIR_ASTERISK)/etc/init.d
104 install -m0755 ./files/asterisk.init $(IDIR_ASTERISK)/etc/init.d/asterisk
105 ln -sf asterisk $(IDIR_ASTERISK)/etc/init.d/S60asterisk
106 $(RSTRIP) $(IDIR_ASTERISK)
107 $(IPKG_BUILD) $(IDIR_ASTERISK) $(PACKAGE_DIR)
108
109 $(IPKG_ASTERISK_MYSQL):
110 install -d -m0755 $(IDIR_ASTERISK_MYSQL)/etc/asterisk
111 install -m0600 $(PKG_BUILD_DIR)/configs/cdr_mysql.conf.sample $(IDIR_ASTERISK_MYSQL)/etc/asterisk/cdr_mysql.conf
112 install -d -m0755 $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules
113 install -m0755 $(PKG_BUILD_DIR)/apps/app_sql_mysql.so $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/
114 install -m0755 $(PKG_BUILD_DIR)/cdr/cdr_mysql.so $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/
115 $(RSTRIP) $(IDIR_ASTERISK_MYSQL)
116 $(IPKG_BUILD) $(IDIR_ASTERISK_MYSQL) $(PACKAGE_DIR)
117
118 $(IPKG_ASTERISK_PGSQL):
119 install -d -m0755 $(IDIR_ASTERISK_PGSQL)/etc/asterisk
120 install -m0600 $(PKG_BUILD_DIR)/configs/cdr_pgsql.conf.sample $(IDIR_ASTERISK_PGSQL)/etc/asterisk/cdr_pgsql.conf
121 install -d -m0755 $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules
122 install -m0755 $(PKG_BUILD_DIR)/apps/app_sql_postgres.so $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/
123 install -m0755 $(PKG_BUILD_DIR)/cdr/cdr_pgsql.so $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/
124 $(RSTRIP) $(IDIR_ASTERISK_PGSQL)
125 $(IPKG_BUILD) $(IDIR_ASTERISK_PGSQL) $(PACKAGE_DIR)
126
127 $(IPKG_ASTERISK_SOUNDS):
128 install -d -m0755 $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds
129 cp -fpR $(PKG_BUILD_DIR)/sounds/* $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/
130 rm -f $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/*.mp3
131 rm -f $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/vm-*
132 $(IPKG_BUILD) $(IDIR_ASTERISK_SOUNDS) $(PACKAGE_DIR)
133
134 $(IPKG_ASTERISK_VOICEMAIL):
135 install -d -m0755 $(IDIR_ASTERISK_VOICEMAIL)/etc/asterisk
136 install -m0644 $(PKG_BUILD_DIR)/configs/voicemail.conf.sample $(IDIR_ASTERISK_VOICEMAIL)/etc/asterisk/voicemail.conf
137 install -d -m0755 $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules
138 install -m0755 $(PKG_BUILD_DIR)/apps/*voicemail.so $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules/
139 $(RSTRIP) $(IDIR_ASTERISK_VOICEMAIL)
140 $(IPKG_BUILD) $(IDIR_ASTERISK_VOICEMAIL) $(PACKAGE_DIR)
141
142 $(IPKG_ASTERISK_CHAN_BLUETOOTH):
143 install -d -m0755 $(IDIR_ASTERISK_CHAN_BLUETOOTH)/etc/asterisk
144 install -m0644 $(PKG_BUILD_DIR)/configs/bluetooth.conf $(IDIR_ASTERISK_CHAN_BLUETOOTH)/etc/asterisk/bluetooth.conf
145 install -d -m0755 $(IDIR_ASTERISK_CHAN_BLUETOOTH)/usr/lib/asterisk/modules
146 install -m0755 $(PKG_BUILD_DIR)/channels/chan_bluetooth.so $(IDIR_ASTERISK_CHAN_BLUETOOTH)/usr/lib/asterisk/modules/
147 $(RSTRIP) $(IDIR_ASTERISK_CHAN_BLUETOOTH)
148 $(IPKG_BUILD) $(IDIR_ASTERISK_CHAN_BLUETOOTH) $(PACKAGE_DIR)
149
150 $(IPKG_ASTERISK_CODEC_ILBC):
151 install -d -m0755 $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules
152 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_ilbc.so $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules/
153 install -m0755 $(PKG_BUILD_DIR)/formats/format_ilbc.so $(IDIR_ASTERISK_CODEC_ILBC)/usr/lib/asterisk/modules/
154 $(RSTRIP) $(IDIR_ASTERISK_CODEC_ILBC)
155 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_ILBC) $(PACKAGE_DIR)
156
157 $(IPKG_ASTERISK_CODEC_LPC10):
158 install -d -m0755 $(IDIR_ASTERISK_CODEC_LPC10)/usr/lib/asterisk/modules
159 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_lpc10.so $(IDIR_ASTERISK_CODEC_LPC10)/usr/lib/asterisk/modules/
160 $(RSTRIP) $(IDIR_ASTERISK_CODEC_LPC10)
161 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_LPC10) $(PACKAGE_DIR)
162
163 $(IPKG_ASTERISK_CODEC_SPEEX):
164 install -d -m0755 $(IDIR_ASTERISK_CODEC_SPEEX)/usr/lib/asterisk/modules
165 install -m0755 $(PKG_BUILD_DIR)/codecs/codec_speex.so $(IDIR_ASTERISK_CODEC_SPEEX)/usr/lib/asterisk/modules/
166 $(RSTRIP) $(IDIR_ASTERISK_CODEC_SPEEX)
167 $(IPKG_BUILD) $(IDIR_ASTERISK_CODEC_SPEEX) $(PACKAGE_DIR)
168
169 $(IPKG_ASTERISK_PBX_DUNDI):
170 install -d -m0755 $(IDIR_ASTERISK_PBX_DUNDI)/etc/asterisk
171 install -m0644 $(PKG_BUILD_DIR)/configs/dundi.conf.sample $(IDIR_ASTERISK_PBX_DUNDI)/etc/asterisk/dundi.conf
172 install -d -m0755 $(IDIR_ASTERISK_PBX_DUNDI)/usr/lib/asterisk/modules
173 install -m0755 $(PKG_BUILD_DIR)/pbx/pbx_dundi.so $(IDIR_ASTERISK_PBX_DUNDI)/usr/lib/asterisk/modules/
174 $(RSTRIP) $(IDIR_ASTERISK_PBX_DUNDI)
175 $(IPKG_BUILD) $(IDIR_ASTERISK_PBX_DUNDI) $(PACKAGE_DIR)
176