convert aiccu to new packaging style
[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 PKG_APP:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
16 PKG_APP_DIR:=$(PKG_BUILD_DIR)/ipkg/asterisk
17
18 PKG_MYSQL:=$(PACKAGE_DIR)/$(PKG_NAME)-mysql_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
19 PKG_MYSQL_DIR:=$(PKG_BUILD_DIR)/ipkg/mysql
20
21 PKG_PGSQL:=$(PACKAGE_DIR)/$(PKG_NAME)-pgsql_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
22 PKG_PGSQL_DIR:=$(PKG_BUILD_DIR)/ipkg/pgsql
23
24 PKG_SPEEX:=$(PACKAGE_DIR)/$(PKG_NAME)-codec-speex_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
25 PKG_SPEEX_DIR:=$(PKG_BUILD_DIR)/ipkg/speex
26
27 PKG_SOUNDS:=$(PACKAGE_DIR)/$(PKG_NAME)-sounds_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
28 PKG_SOUNDS_DIR:=$(PKG_BUILD_DIR)/ipkg/sounds
29
30 PKG_VOICEMAIL:=$(PACKAGE_DIR)/$(PKG_NAME)-voicemail_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
31 PKG_VOICEMAIL_DIR:=$(PKG_BUILD_DIR)/ipkg/voicemail
32
33 APPS:=
34 MODS:=
35 COMPILE_TARGETS:=$(PKG_APP)
36 INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME).list
37 ifneq ($(BR2_PACKAGE_ASTERISK_MYSQL),)
38 APPS += app_sql_mysql.so
39 MODS += cdr_mysql.so
40 COMPILE_TARGETS += $(PKG_MYSQL)
41 endif
42 ifneq ($(BR2_PACKAGE_ASTERISK_PGSQL),)
43 APPS += app_sql_postgres.so
44 MODS += cdr_pgsql.so
45 COMPILE_TARGETS += $(PKG_PGSQL)
46 endif
47 ifneq ($(BR2_PACKAGE_ASTERISK_SOUNDS),)
48 COMPILE_TARGETS += $(PKG_SOUNDS)
49 endif
50 ifneq ($(BR2_PACKAGE_ASTERISK_SPEEX),)
51 SPEEX:=codec_speex.so
52 COMPILE_TARGETS += $(PKG_SPEEX)
53 endif
54 ifneq ($(BR2_PACKAGE_ASTERISK_VOICEMAIL),)
55 COMPILE_TARGETS += $(PKG_VOICEMAIL)
56 endif
57 ifeq ($(BR2_PACKAGE_ASTERISK_MYSQL),y)
58 INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-mysql.list
59 endif
60 ifeq ($(BR2_PACKAGE_ASTERISK_PGSQL),y)
61 INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-pgsql.list
62 endif
63 ifeq ($(BR2_PACKAGE_ASTERISK_VOICEMAIL),y)
64 INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-voicemail.list
65 endif
66 ifeq ($(BR2_PACKAGE_ASTERISK_SOUNDS),y)
67 INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-sounds.list
68 endif
69 ifeq ($(BR2_PACKAGE_ASTERISK_SPEEX),y)
70 INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-codec-speex.list
71 endif
72
73 $(DL_DIR)/$(PKG_SOURCE):
74 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL)
75
76 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE)
77 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
78 $(PATCH) $(PKG_BUILD_DIR) ./patches
79 touch $(PKG_BUILD_DIR)/.patched
80
81
82 asterisk-compile: $(PKG_BUILD_DIR)/.patched
83 $(MAKE) -C "$(PKG_BUILD_DIR)/channels" \
84 CC="$(HOSTCC)" \
85 gentone
86 $(MAKE) -C "$(PKG_BUILD_DIR)" \
87 CC_FOR_BUILD="$(HOSTCC)" \
88 $(TARGET_CONFIGURE_OPTS) \
89 OPTIMIZE="$(TARGET_CFLAGS)" \
90 PROC="$(ARCH)" \
91 CFLAGS_EXTRA="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include/speex" \
92 LDFLAGS_EXTRA="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/lib/mysql" \
93 CRYPTO_LIBS="-L$(STAGING_DIR)/usr/lib -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic" \
94 EXTRA_APPS="$(APPS)" \
95 EXTRA_MODS="$(MODS)" \
96 MODSPEEX="$(SPEEX)"
97
98 $(PKG_APP): asterisk-compile
99 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_APP_DIR) control/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
100 $(MAKE) -C $(PKG_BUILD_DIR) \
101 DESTDIR="$(PKG_APP_DIR)" \
102 install samples
103 rm -rf $(PKG_APP_DIR)/usr/sbin/astgenkey
104 rm -rf $(PKG_APP_DIR)/usr/bin
105 rm -rf $(PKG_APP_DIR)/usr/share
106 rm -rf $(PKG_APP_DIR)/usr/include
107 rm -rf $(PKG_APP_DIR)/var
108 (cd $(PKG_APP_DIR)/usr/lib/asterisk; \
109 rm -rf agi-bin/*; \
110 rm -rf firmware; \
111 rm -rf images; \
112 rm -rf keys/*; \
113 rm -rf mohmp3; \
114 rm -rf sounds/*; \
115 cd modules; \
116 rm -rf *adsi* *festival* *modem* *meetme* *oss* *phone* *intercom* \
117 *mp3* *nbscat* *mysql* *postgres* *pgsql* *voicemail* *speex* \
118 *musiconhold* *zapateller* *jpeg*; \
119 )
120 (cd $(PKG_APP_DIR)/etc/asterisk; \
121 rm -f *odbc* *mysql* *postgres* *pgsql* *voicemail* *adsi* *oss* *alsa* \
122 *festival* *modem* *meetme* *phone* *tds* *vofr* *rpt* *vpb* \
123 *zapata* *musiconhold*; \
124 )
125 -$(STRIP) $(PKG_APP_DIR)/usr/sbin/asterisk
126 -$(STRIP) $(PKG_APP_DIR)/usr/lib/asterisk/modules/*
127 cp -a ./files/* $(PKG_APP_DIR)/
128 find $(PKG_APP_DIR) -name CVS | xargs rm -rf
129 chmod +x $(PKG_APP_DIR)/etc/init.d/*
130 mkdir -p $(PACKAGE_DIR)
131 $(IPKG_BUILD) $(PKG_APP_DIR) $(PACKAGE_DIR)
132
133 $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_APP)
134 $(IPKG) install $(PKG_APP)
135
136 $(PKG_MYSQL): asterisk-compile
137 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_MYSQL_DIR) control/$(PKG_NAME)-mysql.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
138 mkdir -p $(PKG_MYSQL_DIR)/usr/lib/asterisk/modules
139 mkdir -p $(PKG_MYSQL_DIR)/etc/asterisk
140 cp $(PKG_BUILD_DIR)/apps/app_sql_mysql.so $(PKG_MYSQL_DIR)/usr/lib/asterisk/modules/
141 cp $(PKG_BUILD_DIR)/cdr/cdr_mysql.so $(PKG_MYSQL_DIR)/usr/lib/asterisk/modules/
142 $(STRIP) $(PKG_MYSQL_DIR)/usr/lib/asterisk/modules/*
143 echo /etc/asterisk/cdr_mysql.conf > $(PKG_MYSQL_DIR)/CONTROL/conffiles
144 cp $(PKG_BUILD_DIR)/configs/cdr_mysql.conf.sample $(PKG_MYSQL_DIR)/etc/asterisk/cdr_mysql.conf
145 mkdir -p $(PACKAGE_DIR)
146 $(IPKG_BUILD) $(PKG_MYSQL_DIR) $(PACKAGE_DIR)
147
148 $(IPKG_STATE_DIR)/info/$(PKG_NAME)-mysql.list: $(PKG_MYSQL)
149 $(IPKG) install $(PKG_MYSQL)
150
151 $(PKG_PGSQL): asterisk-compile
152 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_PGSQL_DIR) control/$(PKG_NAME)-pgsql.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
153 mkdir -p $(PKG_PGSQL_DIR)/usr/lib/asterisk/modules
154 mkdir -p $(PKG_PGSQL_DIR)/etc/asterisk
155 cp $(PKG_BUILD_DIR)/apps/app_sql_postgres.so $(PKG_PGSQL_DIR)/usr/lib/asterisk/modules/
156 cp $(PKG_BUILD_DIR)/cdr/cdr_pgsql.so $(PKG_PGSQL_DIR)/usr/lib/asterisk/modules/
157 $(STRIP) $(PKG_PGSQL_DIR)/usr/lib/asterisk/modules/*
158 echo /etc/asterisk/cdr_pgsql.conf > $(PKG_PGSQL_DIR)/CONTROL/conffiles
159 cp $(PKG_BUILD_DIR)/configs/cdr_pgsql.conf.sample $(PKG_PGSQL_DIR)/etc/asterisk/cdr_pgsql.conf
160 mkdir -p $(PACKAGE_DIR)
161 $(IPKG_BUILD) $(PKG_PGSQL_DIR) $(PACKAGE_DIR)
162
163 $(IPKG_STATE_DIR)/info/$(PKG_NAME)-pgsql.list: $(PKG_PGSQL)
164 $(IPKG) install $(PKG_PGSQL)
165
166 $(PKG_SOUNDS): asterisk-compile
167 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_SOUNDS_DIR) control/$(PKG_NAME)-sounds.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
168 mkdir -p $(PKG_SOUNDS_DIR)/usr/lib/asterisk/sounds
169 cp -a $(PKG_BUILD_DIR)/sounds/* $(PKG_SOUNDS_DIR)/usr/lib/asterisk/sounds/
170 rm -f $(PKG_SOUNDS_DIR)/usr/lib/asterisk/sounds/*.mp3
171 rm -f $(PKG_SOUNDS_DIR)/usr/lib/asterisk/sounds/vm-*
172 mkdir -p $(PACKAGE_DIR)
173 $(IPKG_BUILD) $(PKG_SOUNDS_DIR) $(PACKAGE_DIR)
174
175 $(IPKG_STATE_DIR)/info/$(PKG_NAME)-sounds.list: $(PKG_SOUNDS)
176 $(IPKG) install $(PKG_SOUNDS)
177
178 $(PKG_SPEEX): asterisk-compile
179 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_SPEEX_DIR) control/$(PKG_NAME)-codec-speex.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
180 mkdir -p $(PKG_SPEEX_DIR)/usr/lib/asterisk/modules
181 cp $(PKG_BUILD_DIR)/codecs/*speex.so $(PKG_SPEEX_DIR)/usr/lib/asterisk/modules
182 $(STRIP) $(PKG_SPEEX_DIR)/usr/lib/asterisk/modules/*
183 mkdir -p $(PACKAGE_DIR)
184 $(IPKG_BUILD) $(PKG_SPEEX_DIR) $(PACKAGE_DIR)
185
186 $(IPKG_STATE_DIR)/info/$(PKG_NAME)-speex.list: $(PKG_SPEEX)
187 $(IPKG) install $(PKG_SPEEX)
188
189 $(PKG_VOICEMAIL): asterisk-compile
190 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_VOICEMAIL_DIR) control/$(PKG_NAME)-voicemail.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
191 echo /etc/asterisk/voicemail.conf > $(PKG_VOICEMAIL_DIR)/CONTROL/conffiles
192 mkdir -p $(PKG_VOICEMAIL_DIR)/etc/asterisk
193 cp $(PKG_BUILD_DIR)/configs/voicemail.conf.sample $(PKG_VOICEMAIL_DIR)/etc/asterisk/voicemail.conf
194 mkdir -p $(PKG_VOICEMAIL_DIR)/usr/lib/asterisk/modules
195 cp $(PKG_BUILD_DIR)/apps/*voicemail.so $(PKG_VOICEMAIL_DIR)/usr/lib/asterisk/modules
196 $(STRIP) $(PKG_VOICEMAIL_DIR)/usr/lib/asterisk/modules/*
197 mkdir -p $(PACKAGE_DIR)
198 $(IPKG_BUILD) $(PKG_VOICEMAIL_DIR) $(PACKAGE_DIR)
199
200 $(IPKG_STATE_DIR)/info/$(PKG_NAME)-voicemail.list: $(PKG_VOICEMAIL)
201 $(IPKG) install $(PKG_VOICEMAIL)
202
203 source: $(DL_DIR)/$(PKG_SOURCE)
204 prepare: $(PKG_BUILD_DIR)/.patched
205 compile: $(COMPILE_TARGETS)
206 install: $(INSTALL_TARGETS)
207
208 clean:
209 rm -rf $(PKG_BUILD_DIR)
210 rm -f $(PKG_APP)
This page took 0.047521 seconds and 5 git commands to generate.