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