1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00
srs/trunk/auto/options.sh

156 lines
5.4 KiB
Bash
Raw Normal View History

2013-11-27 14:41:58 +00:00
#!/bin/bash
2014-02-28 06:38:27 +00:00
#####################################################################################
#####################################################################################
# parse user options, do this at first
#####################################################################################
#####################################################################################
#####################################################################################
# output variables
#####################################################################################
2013-11-27 14:41:58 +00:00
help=no
SRS_HLS=RESERVED
SRS_SSL=RESERVED
2013-11-30 03:59:21 +00:00
SRS_FFMPEG=RESERVED
2013-12-07 11:27:31 +00:00
SRS_HTTP=RESERVED
2014-02-28 06:38:27 +00:00
SRS_RESEARCH=RESERVED
2014-03-03 10:28:50 +00:00
SRS_UTEST=RESERVED
2014-03-06 06:10:45 +00:00
SRS_GPERF=RESERVED
2014-03-04 04:45:41 +00:00
# arguments
SRS_JOBS=1
2013-11-27 14:41:58 +00:00
# TODO: remove the default to yes.
SRS_HLS=YES
SRS_SSL=YES
2013-11-30 03:59:21 +00:00
SRS_FFMPEG=YES
2013-12-07 11:27:31 +00:00
SRS_HTTP=YES
2014-02-28 06:38:27 +00:00
SRS_RESEARCH=NO
SRS_UTEST=YES
2014-03-06 06:10:45 +00:00
SRS_GPERF=YES
2014-02-28 06:38:27 +00:00
#####################################################################################
# parse options
#####################################################################################
2013-11-27 14:41:58 +00:00
opt=
for option
do
opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"
case "$option" in
2014-03-04 04:45:41 +00:00
-*=*)
value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'`
option=`echo "$option" | sed -e 's/=[-_a-zA-Z0-9]*//'`
;;
2013-11-27 14:41:58 +00:00
*) value="" ;;
esac
case "$option" in
--help) help=yes ;;
--with-ssl) SRS_SSL=YES ;;
--with-hls) SRS_HLS=YES ;;
2013-11-30 03:59:21 +00:00
--with-ffmpeg) SRS_FFMPEG=YES ;;
2013-12-07 11:27:31 +00:00
--with-http) SRS_HTTP=YES ;;
2014-03-03 10:28:50 +00:00
--with-research) SRS_RESEARCH=YES ;;
--with-utest) SRS_UTEST=YES ;;
2014-03-06 06:10:45 +00:00
--with-gperf) SRS_GPERF=YES ;;
2013-11-27 14:41:58 +00:00
--without-ssl) SRS_SSL=NO ;;
--without-hls) SRS_HLS=NO ;;
2013-11-30 03:59:21 +00:00
--without-ffmpeg) SRS_FFMPEG=NO ;;
2013-12-07 11:27:31 +00:00
--without-http) SRS_HTTP=NO ;;
2014-03-03 10:28:50 +00:00
--without-research) SRS_RESEARCH=NO ;;
--without-utest) SRS_UTEST=NO ;;
2014-03-06 06:10:45 +00:00
--without-gperf) SRS_GPERF=NO ;;
2014-03-04 04:45:41 +00:00
--jobs) SRS_JOBS=${value} ;;
2013-11-27 14:41:58 +00:00
*)
echo "$0: error: invalid option \"$option\""
exit 1
;;
esac
done
2014-03-04 04:45:41 +00:00
# parse the jobs for make
if [[ "" -eq SRS_JOBS ]]; then
export SRS_JOBS="--jobs"
else
export SRS_JOBS="--jobs=${SRS_JOBS}"
fi
2014-02-28 06:38:27 +00:00
# save all config options to macro to write to auto headers file
2013-11-27 14:41:58 +00:00
SRS_CONFIGURE="$opt"
2014-02-28 06:38:27 +00:00
#####################################################################################
# show help and exit
#####################################################################################
2013-11-27 14:41:58 +00:00
if [ $help = yes ]; then
2014-02-28 06:38:27 +00:00
cat << END
2013-11-27 14:41:58 +00:00
--help print this message
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
to delivery h264 video and aac audio to flash player.
2014-01-05 07:58:17 +00:00
--with-hls enable hls streaming, build nginx as http server for hls.
2013-12-07 11:27:31 +00:00
--with-http enable http hooks, build cherrypy as demo api server.
srs will call the http hooks, such as: on_connect.
2014-01-05 07:58:17 +00:00
--with-ffmpeg enable transcoding with ffmpeg.
2014-02-28 06:38:27 +00:00
--with-research build the research tools.
2014-03-03 10:28:50 +00:00
--with-utest build the utest for srs.
2014-03-06 06:10:45 +00:00
--with-gperf build srs with gperf tools.
2013-11-27 14:41:58 +00:00
--without-ssl disable rtmp complex handshake.
--without-hls disable hls, rtmp streaming only.
2013-12-07 11:27:31 +00:00
--without-http disable http, http hooks callback.
2014-01-05 07:58:17 +00:00
--without-ffmpeg disable the ffmpeg transcoding feature.
2014-02-28 06:38:27 +00:00
--without-research do not build the research tools.
2014-03-03 10:28:50 +00:00
--without-utest do not build the utest for srs.
2014-03-06 06:10:45 +00:00
--without-gperf do not build srs with gperf tools.
2014-03-04 04:45:41 +00:00
--jobs[=N] Allow N jobs at once; infinite jobs with no arg.
used for make in the configure, for example, to make ffmpeg.
2013-11-27 14:41:58 +00:00
END
2014-02-28 06:38:27 +00:00
exit 0
2013-11-27 14:41:58 +00:00
fi
2014-02-28 06:38:27 +00:00
#####################################################################################
# check user options
#####################################################################################
2013-11-27 14:41:58 +00:00
__check_ok=YES
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
2013-11-30 03:59:21 +00:00
if [ $SRS_FFMPEG = RESERVED ]; then
echo "you must specifies the ffmpeg, see: ./configure --help";
__check_ok=NO
fi
2013-12-07 11:27:31 +00:00
if [ $SRS_HTTP = RESERVED ]; then
echo "you must specifies the http, see: ./configure --help";
__check_ok=NO
fi
2014-02-28 06:38:27 +00:00
if [ $SRS_RESEARCH = RESERVED ]; then
echo "you must specifies the research, see: ./configure --help";
__check_ok=NO
fi
2014-03-03 10:28:50 +00:00
if [ $SRS_UTEST = RESERVED ]; then
echo "you must specifies the utest, see: ./configure --help";
__check_ok=NO
fi
2014-03-06 06:10:45 +00:00
if [ $SRS_GPERF = RESERVED ]; then
echo "you must specifies the gperf, see: ./configure --help";
__check_ok=NO
fi
2013-11-27 14:41:58 +00:00
if [ $__check_ok = NO ]; then
exit 1;
2014-02-28 06:38:27 +00:00
fi