Move complex packages to their own menu
[openwrt.git] / openwrt / 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_SPEEX,asterisk-codec-speex,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
22
23 APPS:=
24 MODS:=
25 ifneq ($(BR2_PACKAGE_ASTERISK_MYSQL),)
26 APPS += app_sql_mysql.so
27 MODS += cdr_mysql.so
28 endif
29 ifneq ($(BR2_PACKAGE_ASTERISK_PGSQL),)
30 APPS += app_sql_postgres.so
31 MODS += cdr_pgsql.so
32 endif
33 ifneq ($(BR2_PACKAGE_ASTERISK_SPEEX),)
34 SPEEX:=codec_speex.so
35 endif
36
37 asterisk-compile: $(PKG_BUILD_DIR)/.prepared
38 $(MAKE) -C "$(PKG_BUILD_DIR)/channels" \
39 CC="$(HOSTCC)" \
40 gentone
41 $(MAKE) -C "$(PKG_BUILD_DIR)" \
42 CC_FOR_BUILD="$(HOSTCC)" \
43 $(TARGET_CONFIGURE_OPTS) \
44 OPTIMIZE="$(TARGET_CFLAGS)" \
45 PROC="$(ARCH)" \
46 CFLAGS_EXTRA="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include/speex" \
47 LDFLAGS_EXTRA="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/lib/mysql" \
48 CRYPTO_LIBS="-L$(STAGING_DIR)/usr/lib -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic" \
49 EXTRA_APPS="$(APPS)" \
50 EXTRA_MODS="$(MODS)" \
51 MODSPEEX="$(SPEEX)"
52
53 $(PKG_BUILD_DIR)/.configured:
54 touch $@
55
56 $(PKG_BUILD_DIR)/.built: asterisk-compile
57 touch $@
58
59 $(IPKG_ASTERISK): asterisk-compile
60 $(MAKE) -C $(PKG_BUILD_DIR) \
61 DESTDIR="$(IDIR_ASTERISK)" \
62 install samples
63 rm -rf $(IDIR_ASTERISK)/usr/sbin/astgenkey
64 rm -rf $(IDIR_ASTERISK)/usr/bin
65 rm -rf $(IDIR_ASTERISK)/usr/share
66 rm -rf $(IDIR_ASTERISK)/usr/include
67 rm -rf $(IDIR_ASTERISK)/var
68 (cd $(IDIR_ASTERISK)/usr/lib/asterisk; \
69 rm -rf agi-bin/*; \
70 rm -rf firmware; \
71 rm -rf images; \
72 rm -rf keys/*; \
73 rm -rf mohmp3; \
74 rm -rf sounds/*; \
75 cd modules; \
76 rm -rf *adsi* *festival* *modem* *meetme* *oss* *phone* *intercom* \
77 *mp3* *nbscat* *mysql* *postgres* *pgsql* *voicemail* *speex* \
78 *musiconhold* *zapateller* *jpeg*; \
79 )
80 (cd $(IDIR_ASTERISK)/etc/asterisk; \
81 rm -f *odbc* *mysql* *postgres* *pgsql* *voicemail* *adsi* *oss* *alsa* \
82 *festival* *modem* *meetme* *phone* *tds* *vofr* *rpt* *vpb* \
83 *zapata* *musiconhold*; \
84 )
85 -$(STRIP) $(IDIR_ASTERISK)/usr/sbin/asterisk
86 -$(STRIP) $(IDIR_ASTERISK)/usr/lib/asterisk/modules/*
87 cp -a ./files/* $(IDIR_ASTERISK)/
88 find $(IDIR_ASTERISK) -name CVS | xargs rm -rf
89 chmod +x $(IDIR_ASTERISK)/etc/init.d/*
90 $(IPKG_BUILD) $(IDIR_ASTERISK) $(PACKAGE_DIR)
91
92 $(IPKG_ASTERISK_MYSQL): asterisk-compile
93 mkdir -p $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules
94 mkdir -p $(IDIR_ASTERISK_MYSQL)/etc/asterisk
95 cp $(PKG_BUILD_DIR)/apps/app_sql_mysql.so $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/
96 cp $(PKG_BUILD_DIR)/cdr/cdr_mysql.so $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/
97 $(STRIP) $(IDIR_ASTERISK_MYSQL)/usr/lib/asterisk/modules/*
98 cp $(PKG_BUILD_DIR)/configs/cdr_mysql.conf.sample $(IDIR_ASTERISK_MYSQL)/etc/asterisk/cdr_mysql.conf
99 $(IPKG_BUILD) $(IDIR_ASTERISK_MYSQL) $(PACKAGE_DIR)
100
101 $(IPKG_ASTERISK_PGSQL): asterisk-compile
102 mkdir -p $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules
103 mkdir -p $(IDIR_ASTERISK_PGSQL)/etc/asterisk
104 cp $(PKG_BUILD_DIR)/apps/app_sql_postgres.so $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/
105 cp $(PKG_BUILD_DIR)/cdr/cdr_pgsql.so $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/
106 $(STRIP) $(IDIR_ASTERISK_PGSQL)/usr/lib/asterisk/modules/*
107 cp $(PKG_BUILD_DIR)/configs/cdr_pgsql.conf.sample $(IDIR_ASTERISK_PGSQL)/etc/asterisk/cdr_pgsql.conf
108 $(IPKG_BUILD) $(IDIR_ASTERISK_PGSQL) $(PACKAGE_DIR)
109
110 $(IPKG_ASTERISK_SOUNDS): asterisk-compile
111 mkdir -p $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds
112 cp -a $(PKG_BUILD_DIR)/sounds/* $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/
113 rm -f $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/*.mp3
114 rm -f $(IDIR_ASTERISK_SOUNDS)/usr/lib/asterisk/sounds/vm-*
115 $(IPKG_BUILD) $(IDIR_ASTERISK_SOUNDS) $(PACKAGE_DIR)
116
117 $(IPKG_ASTERISK_SPEEX): asterisk-compile
118 mkdir -p $(IDIR_ASTERISK_SPEEX)/usr/lib/asterisk/modules
119 cp $(PKG_BUILD_DIR)/codecs/*speex.so $(IDIR_ASTERISK_SPEEX)/usr/lib/asterisk/modules
120 $(STRIP) $(IDIR_ASTERISK_SPEEX)/usr/lib/asterisk/modules/*
121 $(IPKG_BUILD) $(IDIR_ASTERISK_SPEEX) $(PACKAGE_DIR)
122
123 $(IPKG_ASTERISK_VOICEMAIL): asterisk-compile
124 mkdir -p $(IDIR_ASTERISK_VOICEMAIL)/etc/asterisk
125 cp $(PKG_BUILD_DIR)/configs/voicemail.conf.sample $(IDIR_ASTERISK_VOICEMAIL)/etc/asterisk/voicemail.conf
126 mkdir -p $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules
127 cp $(PKG_BUILD_DIR)/apps/*voicemail.so $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules
128 $(STRIP) $(IDIR_ASTERISK_VOICEMAIL)/usr/lib/asterisk/modules/*
129 $(IPKG_BUILD) $(IDIR_ASTERISK_VOICEMAIL) $(PACKAGE_DIR)
This page took 0.055761 seconds and 5 git commands to generate.