]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/asterisk
Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into asterisk-update
[ipfire-2.x.git] / lfs / asterisk
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2012 IPFire Team <info@ipfire.org> #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER = 11.8.1
28
29 THISAPP = asterisk-$(VER)
30 DL_FILE = $(THISAPP).tar.gz
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33 TARGET = $(DIR_INFO)/$(THISAPP)
34 PROG = asterisk
35 PAK_VER = 9
36
37 DEPS = "sqlite libpri libtiff libvorbis libogg spandsp netsnmpd mysql"
38
39 ###############################################################################
40 # Top-level Rules
41 ###############################################################################
42
43 objects = $(DL_FILE) \
44 asterisk-1.4-de-prompts.tar.gz \
45 asterisk-extra-sounds-en-gsm-1.4.14.tar.gz \
46 asterisk-moh-opsound-gsm-2.03.tar.gz
47
48 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
49 asterisk-extra-sounds-en-gsm-1.4.14.tar.gz = $(URL_IPFIRE)/asterisk-extra-sounds-en-gsm-1.4.14.tar.gz
50 asterisk-moh-opsound-gsm-2.03.tar.gz = $(URL_IPFIRE)/asterisk-moh-opsound-gsm-2.03.tar.gz
51 asterisk-1.4-de-prompts.tar.gz = $(URL_IPFIRE)/asterisk-1.4-de-prompts.tar.gz
52
53 $(DL_FILE)_MD5 = 7bace8e6845188ca68b8d682d71cb1cc
54 asterisk-extra-sounds-en-gsm-1.4.14.tar.gz_MD5 = ffc2e0ffd783c03fef5b75277dba0896
55 asterisk-moh-opsound-gsm-2.03.tar.gz_MD5 = 09066f55f1358f298bc1a6e4678a3ddf
56 asterisk-1.4-de-prompts.tar.gz_MD5 = 626a2b95071a5505851e43874dfbfd5c
57
58 install : $(TARGET)
59
60 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
61
62 download :$(patsubst %,$(DIR_DL)/%,$(objects))
63
64 md5 : $(subst %,%_MD5,$(objects))
65
66 dist:
67 $(PAK)
68
69 ###############################################################################
70 # Downloading, checking, md5sum
71 ###############################################################################
72
73 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
74 @$(CHECK)
75
76 $(patsubst %,$(DIR_DL)/%,$(objects)) :
77 @$(LOAD)
78
79 $(subst %,%_MD5,$(objects)) :
80 @$(MD5)
81
82 ###############################################################################
83 # Installation Details
84 ###############################################################################
85
86 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
87 @$(PREBUILD)
88
89 # remove old directories and extract asterisk
90 @rm -rf $(DIR_APP) $(DIR_SRC)/asterisk-* $(DIR_SRC)/agx-ast-addons && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
91
92 # configure asterisk
93 cd $(DIR_APP) && ./configure --prefix=/usr --sysconfdir=/var/ipfire
94
95 # enable additional features (include following sound-tars)
96 cd $(DIR_APP) && make menuselect.makeopts && menuselect/menuselect --enable app_mysql --enable cdr_mysql --enable res_config_mysql --enable EXTRA-SOUNDS-EN-GSM --enable MOH-OPSOUND-GSM menuselect.makeopts
97
98 # add additional sounds
99 cd $(DIR_APP) && cp -fv $(DIR_DL)/asterisk-extra-sounds-en-gsm-1.4.14.tar.gz $(DIR_APP)/sounds/
100 cd $(DIR_APP) && cp -fv $(DIR_DL)/asterisk-moh-opsound-gsm-2.03.tar.gz $(DIR_APP)/sounds/
101
102 # Fix wrong cpu optimization (march=armv5tel)
103 cd $(DIR_APP) && sed -i -e "s|^PROC=armv5te.*|PROC=armv5te|g" makeopts
104
105 # Add armv5te to gsm codecs
106 cd $(DIR_APP) && sed -i -e "s|armv5b |*armv5te |g" codecs/gsm/Makefile
107
108 # compile and install
109 cd $(DIR_APP) && make $(MAKETUNING) all
110 cd $(DIR_APP) && make install
111 cd $(DIR_APP) && make samples
112
113 # add german sounds and remove README.txt
114 tar xfz $(DIR_DL)/asterisk-1.4-de-prompts.tar.gz -C /var/lib/asterisk/sounds/
115 -rm -f /var/lib/asterisk/sounds/README.txt
116
117 # remove build directories
118 @rm -rf $(DIR_APP) $(DIR_SRC)/asterisk-*
119
120 # copy additional ipfire scripts for asterisk
121 -mkdir -p /var/ipfire/asterisk
122 cp -vrf $(DIR_SRC)/config/asterisk/* /var/ipfire/asterisk/
123 chmod o+w /var/ipfire/asterisk
124 chown nobody:nobody -R /var/ipfire/asterisk
125 ln -f -s /var/ipfire/asterisk/wakeup/wakeup.sh /etc/fcron.minutely/wakeup.sh
126
127 # be sure all source is removed
128 @rm -rf $(DIR_APP) $(DIR_SRC)/asterisk-*
129
130 # remember backup-location
131 install -v -m 644 $(DIR_SRC)/config/backup/includes/asterisk /var/ipfire/backup/addons/includes/asterisk
132
133 # generate softlink (or asterisk will not work properly)
134 ln -sf /var/ipfire/asterisk /etc/asterisk
135
136 # make asterisk start with reboot
137 ln -sf /etc/rc.d/init.d/asterisk /etc/rc.d/rc0.d/K30asterisk
138 ln -sf /etc/rc.d/init.d/asterisk /etc/rc.d/rc6.d/K30asterisk
139 ln -sf /etc/rc.d/init.d/asterisk /etc/rc.d/rc3.d/S30asterisk
140
141 # all done
142 @$(POSTBUILD)