]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/asterisk
a87cad928c2d2f5c4b52b99531132374bac348a7
[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 include Config
22
23 VER = 11.9.0
24
25 THISAPP = asterisk-$(VER)
26 DL_FILE = $(THISAPP).tar.gz
27 DL_FROM = $(URL_IPFIRE)
28 DIR_APP = $(DIR_SRC)/$(THISAPP)
29 TARGET = $(DIR_INFO)/$(THISAPP)
30 PROG = asterisk
31 PAK_VER = 10
32
33 DEPS = "sqlite"
34
35 ###############################################################################
36 # Top-level Rules
37 ###############################################################################
38
39 objects = $(DL_FILE) \
40 srtp-1.4.2.tar.gz \
41 asterisk-1.4-de-prompts.tar.gz \
42 asterisk-extra-sounds-en-gsm-1.4.14.tar.gz \
43 asterisk-moh-opsound-gsm-2.03.tar.gz
44
45 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
46 srtp-1.4.2.tar.gz = $(URL_IPFIRE)/srtp-1.4.2.tar.gz
47 asterisk-extra-sounds-en-gsm-1.4.14.tar.gz = $(URL_IPFIRE)/asterisk-extra-sounds-en-gsm-1.4.14.tar.gz
48 asterisk-moh-opsound-gsm-2.03.tar.gz = $(URL_IPFIRE)/asterisk-moh-opsound-gsm-2.03.tar.gz
49 asterisk-1.4-de-prompts.tar.gz = $(URL_IPFIRE)/asterisk-1.4-de-prompts.tar.gz
50
51 $(DL_FILE)_MD5 = 743e7dc0112e24f794453443b17ce42b
52 srtp-1.4.2.tar.gz_MD5 = 7b0ffbfad9bbaf33d397027e031cb35a
53 asterisk-extra-sounds-en-gsm-1.4.14.tar.gz_MD5 = ffc2e0ffd783c03fef5b75277dba0896
54 asterisk-moh-opsound-gsm-2.03.tar.gz_MD5 = 09066f55f1358f298bc1a6e4678a3ddf
55 asterisk-1.4-de-prompts.tar.gz_MD5 = 626a2b95071a5505851e43874dfbfd5c
56
57 install : $(TARGET)
58
59 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
60
61 download :$(patsubst %,$(DIR_DL)/%,$(objects))
62
63 md5 : $(subst %,%_MD5,$(objects))
64
65 dist:
66 $(PAK)
67
68 ###############################################################################
69 # Downloading, checking, md5sum
70 ###############################################################################
71
72 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
73 @$(CHECK)
74
75 $(patsubst %,$(DIR_DL)/%,$(objects)) :
76 @$(LOAD)
77
78 $(subst %,%_MD5,$(objects)) :
79 @$(MD5)
80
81 ###############################################################################
82 # Installation Details
83 ###############################################################################
84
85 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
86 @$(PREBUILD)
87
88 # build srtp
89 @rm -rf $(DIR_SRC)/srtp && cd $(DIR_SRC) && tar zxf $(DIR_DL)/srtp-1.4.2.tar.gz
90 cd $(DIR_SRC)/srtp && ./configure --prefix=/usr && make uninstall && make && make install
91
92 # remove old directories and extract asterisk
93 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
94
95 # patch asterisk
96 cd $(DIR_APP) && patch -p4 < $(DIR_SRC)/src/patches/asterisk-no-ffmpeg.patch
97
98 # configure asterisk
99 cd $(DIR_APP) && ./configure --prefix=/usr --sysconfdir=/var/ipfire \
100 --without-oss \
101 --without-sdl \
102 --without-SDL_image \
103 --without-netsnmp \
104 --without-avcodec \
105 --without-vorbis \
106 --without-ogg \
107 --without-spandsp \
108 --disable-xmldoc
109
110 # enable additional features (include following sound-tars)
111 cd $(DIR_APP) && make menuselect.makeopts && menuselect/menuselect \
112 --enable res_srtp \
113 --enable app_mysql \
114 --enable cdr_mysql \
115 --enable res_config_mysql \
116 --enable EXTRA-SOUNDS-EN-GSM \
117 --enable MOH-OPSOUND-GSM \
118 menuselect.makeopts
119
120 # add additional sounds
121 cd $(DIR_APP) && cp -fv $(DIR_DL)/asterisk-extra-sounds-en-gsm-1.4.14.tar.gz $(DIR_APP)/sounds/
122 cd $(DIR_APP) && cp -fv $(DIR_DL)/asterisk-moh-opsound-gsm-2.03.tar.gz $(DIR_APP)/sounds/
123
124 # Fix wrong cpu optimization (march=armv5tel)
125 cd $(DIR_APP) && sed -i -e "s|^PROC=armv5te.*|PROC=armv5te|g" makeopts
126
127 # Add armv5te to gsm codecs
128 cd $(DIR_APP) && sed -i -e "s|armv5b |*armv5te |g" codecs/gsm/Makefile
129
130 # compile and install
131 cd $(DIR_APP) && make $(MAKETUNING) all
132 cd $(DIR_APP) && make install
133 cd $(DIR_APP) && make samples
134
135 # add german sounds and remove README.txt
136 tar xfz $(DIR_DL)/asterisk-1.4-de-prompts.tar.gz -C /var/lib/asterisk/sounds/
137 -rm -f /var/lib/asterisk/sounds/README.txt
138
139 # remove build directories
140 @rm -rf $(DIR_APP) $(DIR_SRC)/asterisk-*
141
142 # copy additional ipfire scripts for asterisk
143 -mkdir -p /var/ipfire/asterisk
144 cp -vrf $(DIR_SRC)/config/asterisk/* /var/ipfire/asterisk/
145 chmod o+w /var/ipfire/asterisk
146 chown nobody:nobody -R /var/ipfire/asterisk
147 ln -f -s /var/ipfire/asterisk/wakeup/wakeup.sh /etc/fcron.minutely/wakeup.sh
148
149 # be sure all source is removed
150 @rm -rf $(DIR_APP) $(DIR_SRC)/asterisk-*
151
152 # remember backup-location
153 install -v -m 644 $(DIR_SRC)/config/backup/includes/asterisk /var/ipfire/backup/addons/includes/asterisk
154
155 # generate softlink (or asterisk will not work properly)
156 ln -sf /var/ipfire/asterisk /etc/asterisk
157
158 # make asterisk start with reboot
159 ln -sf /etc/rc.d/init.d/asterisk /etc/rc.d/rc0.d/K30asterisk
160 ln -sf /etc/rc.d/init.d/asterisk /etc/rc.d/rc6.d/K30asterisk
161 ln -sf /etc/rc.d/init.d/asterisk /etc/rc.d/rc3.d/S30asterisk
162
163 # all done
164 @$(POSTBUILD)