options.sh
7.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#!/bin/bash
#####################################################################################
#####################################################################################
# parse user options, do this at first
#####################################################################################
#####################################################################################
#####################################################################################
# output variables
#####################################################################################
help=no
SRS_HLS=RESERVED
SRS_SSL=RESERVED
SRS_FFMPEG=RESERVED
SRS_HTTP=RESERVED
SRS_RESEARCH=RESERVED
SRS_UTEST=RESERVED
SRS_GPERF=RESERVED # tcmalloc
SRS_GPERF_MC=RESERVED # gperf memory check
SRS_GPERF_MP=RESERVED # gperf memory profile
SRS_GPERF_CP=RESERVED # gperf cpu profile
# arguments
SRS_JOBS=1
# TODO: remove the default to yes.
SRS_HLS=YES
SRS_SSL=YES
SRS_FFMPEG=YES
SRS_HTTP=YES
SRS_RESEARCH=NO
SRS_UTEST=YES
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
#####################################################################################
# parse options
#####################################################################################
opt=
for option
do
opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"
case "$option" in
-*=*)
value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'`
option=`echo "$option" | sed -e 's/=[-_a-zA-Z0-9]*//'`
;;
*) value="" ;;
esac
case "$option" in
--help) help=yes ;;
--with-ssl) SRS_SSL=YES ;;
--with-hls) SRS_HLS=YES ;;
--with-ffmpeg) SRS_FFMPEG=YES ;;
--with-http) SRS_HTTP=YES ;;
--with-research) SRS_RESEARCH=YES ;;
--with-utest) SRS_UTEST=YES ;;
--with-gperf) SRS_GPERF=YES ;;
--with-gmc) SRS_GPERF_MC=YES ;;
--with-gmp) SRS_GPERF_MP=YES ;;
--with-gcp) SRS_GPERF_CP=YES ;;
--without-ssl) SRS_SSL=NO ;;
--without-hls) SRS_HLS=NO ;;
--without-ffmpeg) SRS_FFMPEG=NO ;;
--without-http) SRS_HTTP=NO ;;
--without-research) SRS_RESEARCH=NO ;;
--without-utest) SRS_UTEST=NO ;;
--without-gperf) SRS_GPERF=NO ;;
--without-gmc) SRS_GPERF_MC=NO ;;
--without-gmp) SRS_GPERF_MP=NO ;;
--without-gcp) SRS_GPERF_CP=NO ;;
--jobs) SRS_JOBS=${value} ;;
*)
echo "$0: error: invalid option \"$option\""
exit 1
;;
esac
done
# parse the jobs for make
if [[ "" -eq SRS_JOBS ]]; then
export SRS_JOBS="--jobs"
else
export SRS_JOBS="--jobs=${SRS_JOBS}"
fi
# save all config options to macro to write to auto headers file
SRS_CONFIGURE="$opt"
#####################################################################################
# show help and exit
#####################################################################################
if [ $help = yes ]; then
cat << END
--help print this message
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
to delivery h264 video and aac audio to flash player.
--with-hls enable hls streaming, build nginx as http server for hls.
--with-http enable http hooks, build cherrypy as demo api server.
srs will call the http hooks, such as: on_connect.
--with-ffmpeg enable transcoding with ffmpeg.
--with-research build the research tools.
--with-utest build the utest for srs.
--with-gperf build srs with gperf tools(no gmc/gmp/gcp, with tcmalloc only).
--with-gmc build memory check for srs with gperf tools.
--with-gmp build memory profile for srs with gperf tools.
--with-gcp build cpu profile for srs with gperf tools.
--without-ssl disable rtmp complex handshake.
--without-hls disable hls, rtmp streaming only.
--without-http disable http, http hooks callback.
--without-ffmpeg disable the ffmpeg transcoding feature.
--without-research do not build the research tools.
--without-utest do not build the utest for srs.
--without-gperf do not build srs with gperf tools(without tcmalloc and gmc/gmp/gcp).
--without-gmc do not build memory check for srs with gperf tools.
--without-gmp do not build memory profile for srs with gperf tools.
--without-gcp do not build cpu profile for srs with gperf tools.
--jobs[=N] Allow N jobs at once; infinite jobs with no arg.
used for make in the configure, for example, to make ffmpeg.
END
exit 0
fi
#####################################################################################
# check user options
#####################################################################################
__check_ok=YES
# check conflict
if [ $SRS_GPERF = NO ]; then
if [ $SRS_GPERF_MC = YES ]; then
echo "gperf-mc depends on gperf, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_GPERF_MP = YES ]; then
echo "gperf-mp depends on gperf, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_GPERF_CP = YES ]; then
echo "gperf-cp depends on gperf, see: ./configure --help";
__check_ok=NO
fi
fi
if [ $SRS_GPERF_MC = YES ]; then
if [ $SRS_GPERF_MP = YES ]; then
echo "gperf-mc not compatible with gperf-mp, see: ./configure --help";
echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html";
echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time";
__check_ok=NO
fi
fi
# check variable neccessary
if [ $SRS_SSL = RESERVED ]; then
echo "you must specifies the ssl, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_HLS = RESERVED ]; then
echo "you must specifies the hls, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_FFMPEG = RESERVED ]; then
echo "you must specifies the ffmpeg, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_HTTP = RESERVED ]; then
echo "you must specifies the http, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_RESEARCH = RESERVED ]; then
echo "you must specifies the research, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_UTEST = RESERVED ]; then
echo "you must specifies the utest, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_GPERF_MC = RESERVED ]; then
echo "you must specifies the gperf-mc, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_GPERF_MP = RESERVED ]; then
echo "you must specifies the gperf-mp, see: ./configure --help";
__check_ok=NO
fi
if [ $SRS_GPERF_CP = RESERVED ]; then
echo "you must specifies the gperf-cp, see: ./configure --help";
__check_ok=NO
fi
if [ $__check_ok = NO ]; then
exit 1;
fi
# generate the group option: SRS_GPERF
if [ $SRS_GPERF_MC = YES ]; then
SRS_GPERF=YES
fi
if [ $SRS_GPERF_MP = YES ]; then
SRS_GPERF=YES
fi
if [ $SRS_GPERF_CP = YES ]; then
SRS_GPERF=YES
fi