2013-11-27 14:41:58 +00:00
#!/bin/bash
2014-03-19 02:51:33 +00:00
# variables, parent script must set it:
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
2014-07-23 06:37:54 +00:00
################################################################
# feature options
2018-12-22 12:51:57 +00:00
SRS_HDS = NO
SRS_NGINX = NO
SRS_FFMPEG_TOOL = NO
SRS_LIBRTMP = NO
2019-12-18 07:50:17 +00:00
SRS_RESEARCH = NO
2018-12-22 12:51:57 +00:00
SRS_UTEST = YES
2018-12-22 12:31:47 +00:00
SRS_GPERF = NO # Performance test: tcmalloc
SRS_GPERF_MC = NO # Performance test: gperf memory check
SRS_GPERF_MD = NO # Performance test: gperf memory defence
SRS_GPERF_MP = NO # Performance test: gperf memory profile
SRS_GPERF_CP = NO # Performance test: gperf cpu profile
SRS_GPROF = NO # Performance test: gprof
2017-02-11 05:29:53 +00:00
# Always enable the bellow features.
2018-12-22 12:45:25 +00:00
SRS_STREAM_CASTER = YES
2018-12-22 12:30:13 +00:00
SRS_INGEST = YES
2018-12-22 12:03:40 +00:00
SRS_SSL = YES
2018-12-22 11:58:36 +00:00
SRS_STAT = YES
2018-12-22 11:48:55 +00:00
SRS_TRANSCODE = YES
2017-01-23 09:43:59 +00:00
SRS_HTTP_CALLBACK = YES
SRS_HTTP_SERVER = YES
SRS_HTTP_API = YES
SRS_HTTP_CORE = YES
2017-02-11 05:29:53 +00:00
SRS_HLS = YES
2017-02-11 09:27:40 +00:00
SRS_DVR = YES
2014-04-16 06:14:48 +00:00
#
2014-07-23 06:37:54 +00:00
################################################################
2014-04-16 06:14:48 +00:00
# libraries
2019-02-02 13:42:03 +00:00
SRS_FFMPEG_STUB = NO
2014-03-04 04:45:41 +00:00
# arguments
2014-03-22 14:07:14 +00:00
SRS_PREFIX = /usr/local/srs
2014-03-04 04:45:41 +00:00
SRS_JOBS = 1
2019-02-02 13:42:03 +00:00
SRS_STATIC = NO
# whether enable the gcov
SRS_GCOV = NO
2014-07-23 06:37:54 +00:00
# whether enable the log verbose/info/trace level.
# always enable the warn/error level.
2019-02-02 13:42:03 +00:00
SRS_LOG_VERBOSE = NO
SRS_LOG_INFO = NO
SRS_LOG_TRACE = NO
2019-12-25 07:46:58 +00:00
# The extra c/c++ flags to build SRS. Note that we also pass to ST as EXTRA_CFLAGS.
SRS_EXTRA_CFLAGS =
2014-04-06 11:19:13 +00:00
#
2014-07-23 06:37:54 +00:00
################################################################
2014-04-16 06:27:34 +00:00
# experts
# donot compile ssl, use system ssl(-lssl) if required.
SRS_USE_SYS_SSL = NO
2015-06-13 07:45:25 +00:00
# enable memory watch, detect memory leak,
# similar to gmc, should disable in release version for hurts performance.
SRS_MEM_WATCH = NO
2014-11-08 10:33:15 +00:00
# export the srs-librtmp to specified project, NO to disable it.
SRS_EXPORT_LIBRTMP_PROJECT = NO
# export the srs-librtmp to a single .h and .c, NO to disable it.
SRS_EXPORT_LIBRTMP_SINGLE = NO
2017-02-28 06:47:00 +00:00
# valgrind
2017-06-28 01:08:19 +00:00
SRS_VALGRIND = NO
2014-04-16 06:27:34 +00:00
#
2014-07-23 06:37:54 +00:00
################################################################
2014-04-16 05:24:00 +00:00
# presets
# for x86/x64 pc/servers
SRS_X86_X64 = NO
2015-03-10 04:50:27 +00:00
# for osx system
SRS_OSX = NO
2018-12-09 11:39:36 +00:00
SRS_ALLOW_OSX = NO
2014-03-26 02:05:07 +00:00
# dev, open all features for dev, no gperf/prof/arm.
SRS_DEV = NO
2014-08-18 06:15:39 +00:00
# dev, open main server feature for dev, no utest/research/librtmp
2014-06-21 03:41:00 +00:00
SRS_FAST_DEV = NO
2015-11-11 02:37:50 +00:00
# demo, for the demo of srs, @see: https://github.com/ossrs/srs/wiki/v1_CN_SampleDemo
2014-06-29 02:50:58 +00:00
SRS_DEMO = NO
2014-03-30 04:31:50 +00:00
# raspberry-pi, open hls/ssl/static
SRS_PI = NO
2014-06-19 03:22:24 +00:00
# cubieboard, donot open ffmpeg/nginx.
SRS_CUBIE = NO
2014-04-16 06:14:48 +00:00
# the most fast compile, nothing, only support vp6 RTMP.
SRS_FAST = NO
# only support RTMP with ssl.
SRS_PURE_RTMP = NO
2014-04-18 07:13:52 +00:00
# the most fast compile, nothing, only support vp6 RTMP.
SRS_DISABLE_ALL = NO
2014-06-08 05:03:03 +00:00
# all features is on
SRS_ENABLE_ALL = NO
2014-05-04 10:38:08 +00:00
#
2019-12-25 05:17:49 +00:00
#####################################################################################
# We don't support crossbuild for ARM/MIPS, please directly build it on ARM/MIPS server.
2015-09-23 02:27:57 +00:00
SRS_CROSS_BUILD = NO
2013-11-27 14:41:58 +00:00
2014-02-28 06:38:27 +00:00
#####################################################################################
2014-04-16 05:24:00 +00:00
# menu
2014-02-28 06:38:27 +00:00
#####################################################################################
2014-04-16 05:24:00 +00:00
function show_help( ) {
cat << END
2013-11-27 14:41:58 +00:00
2014-04-16 05:24:00 +00:00
Options:
-h, --help print this message
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
2017-02-11 09:27:40 +00:00
--with-hds enable hds streaming, mux RTMP to F4M/F4V files.
2014-04-16 05:24:00 +00:00
--with-nginx enable delivery HTTP stream with nginx.
2015-01-24 06:52:52 +00:00
--with-stream-caster enable stream caster to serve other stream over other protocol.
2014-04-16 05:24:00 +00:00
--with-ffmpeg enable transcoding tool ffmpeg.
--with-transcode enable transcoding features.
--with-ingest enable ingest features.
2014-08-17 14:11:43 +00:00
--with-stat enable the data statistic, for http api.
2014-04-16 05:24:00 +00:00
--with-librtmp enable srs-librtmp, library for client.
--with-research build the research tools.
--with-utest build the utest for SRS.
2016-01-08 05:58:19 +00:00
--with-gperf build SRS with gperf tools( no gmd/gmc/gmp/gcp, with tcmalloc only) .
2014-04-16 05:24:00 +00:00
--with-gmc build memory check for SRS with gperf tools.
2016-01-08 05:58:19 +00:00
--with-gmd build memory defense( corrupt memory) for SRS with gperf tools.
2014-04-16 05:24:00 +00:00
--with-gmp build memory profile for SRS with gperf tools.
--with-gcp build cpu profile for SRS with gperf tools.
--with-gprof build SRS with gprof( GNU profile tool) .
2015-09-23 03:21:51 +00:00
--with-arm-ubuntu12 cross build SRS on ubuntu12 for armhf( v7cpu) .
2015-09-23 03:23:55 +00:00
--with-mips-ubuntu12 cross build SRS on ubuntu12 for mips.
2014-04-16 05:24:00 +00:00
--without-ssl disable rtmp complex handshake.
2015-03-12 03:15:15 +00:00
--without-hds disable hds, the adobe http dynamic streaming.
2014-04-16 05:24:00 +00:00
--without-nginx disable delivery HTTP stream with nginx.
2015-01-24 06:52:52 +00:00
--without-stream-caster disable stream caster, only listen and serve RTMP/HTTP.
2014-04-16 05:24:00 +00:00
--without-ffmpeg disable the ffmpeg transcode tool feature.
--without-transcode disable the transcoding feature.
--without-ingest disable the ingest feature.
2014-08-17 14:11:43 +00:00
--without-stat disable the data statistic feature.
2014-04-16 05:24:00 +00:00
--without-librtmp disable srs-librtmp, library for client.
--without-research do not build the research tools.
--without-utest do not build the utest for SRS.
2016-01-08 05:58:19 +00:00
--without-gperf do not build SRS with gperf tools( without tcmalloc and gmd/gmc/gmp/gcp) .
2014-04-16 05:24:00 +00:00
--without-gmc do not build memory check for SRS with gperf tools.
2016-01-08 05:58:19 +00:00
--without-gmd do not build memory defense for SRS with gperf tools.
2014-04-16 05:24:00 +00:00
--without-gmp do not build memory profile for SRS with gperf tools.
--without-gcp do not build cpu profile for SRS with gperf tools.
--without-gprof do not build srs with gprof( GNU profile tool) .
2015-09-23 03:21:51 +00:00
--without-arm-ubuntu12 do not cross build srs on ubuntu12 for armhf( v7cpu) .
2015-09-23 03:23:55 +00:00
--without-mips-ubuntu12 do not cross build srs on ubuntu12 for mips.
2014-04-16 05:24:00 +00:00
2017-03-26 10:30:33 +00:00
--prefix= <path> The absolute installation path for srs. Default: $SRS_PREFIX
2019-02-02 13:42:03 +00:00
--static Whether add '-static' to link options.
--gcov Whether enable the GCOV compiler options.
2014-04-16 05:24:00 +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.
2014-07-23 06:37:54 +00:00
--log-verbose whether enable the log verbose level. default: no.
--log-info whether enable the log info level. default: no.
--log-trace whether enable the log trace level. default: yes.
2013-11-27 14:41:58 +00:00
2014-04-16 05:24:00 +00:00
Presets:
2014-04-16 06:14:48 +00:00
--x86-x64 [ default] for x86/x64 cpu, common pc and servers.
2015-03-10 04:50:27 +00:00
--osx for osx( darwin) system to build SRS.
2014-04-16 05:24:00 +00:00
--pi for raspberry-pi( directly build) , open features hls/ssl/static.
2014-06-19 03:22:24 +00:00
--cubie for cubieboard( directly build) , open features except ffmpeg/nginx.
--arm alias for --with-arm-ubuntu12, for ubuntu12, arm crossbuild
--mips alias for --with-mips-ubuntu12, for ubuntu12, mips crossbuild
2014-04-16 06:14:48 +00:00
--fast the most fast compile, nothing, only support vp6 RTMP.
--pure-rtmp only support RTMP with ssl.
2014-04-18 07:13:52 +00:00
--disable-all disable all features, only support vp6 RTMP.
2014-06-08 05:18:34 +00:00
--dev for dev, open all features, no nginx/gperf/gprof/arm.
2014-08-18 06:15:39 +00:00
--fast-dev for dev fast compile, the RTMP server, without librtmp/utest/research.
2015-11-11 02:37:50 +00:00
--demo for srs demo, @see: https://github.com/ossrs/srs/wiki/v1_CN_SampleDemo
2014-06-08 05:18:34 +00:00
--full enable all features, no gperf/gprof/arm.
2015-09-22 05:52:14 +00:00
--x86-64 alias for --x86-x64.
2017-02-11 04:45:49 +00:00
2019-12-25 07:46:58 +00:00
Toolchain options:
--extra-flags= <EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Pass to ST as EXTRA_CFLAGS.
Recomment to enable:
2017-02-11 09:27:40 +00:00
--with-http-api enable HTTP API, to communicate with SRS.
--with-http-callback enable HTTP hooks, build cherrypy as demo api server.
--with-http-server enable HTTP server to delivery http stream.
--with-hls enable HLS streaming, mux RTMP to M3U8/TS files.
--with-dvr enable DVR, record RTMP to FLV/MP4 files.
2014-04-16 05:24:00 +00:00
Conflicts:
2014-05-04 10:52:32 +00:00
1. --with-gmc vs --with-gmp:
2014-04-16 05:24:00 +00:00
@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html
2014-05-04 10:52:32 +00:00
2. --with-gperf/gmc/gmp vs --with-gprof:
2014-04-16 05:24:00 +00:00
gperftools not compatible with gprof.
2014-08-18 06:15:39 +00:00
3. --arm vs --with-ffmpeg/gperf/gmc/gmp/gprof:
2014-04-16 05:24:00 +00:00
the complex tools not available for arm.
2014-04-16 06:27:34 +00:00
Experts:
2014-11-08 10:33:15 +00:00
--use-sys-ssl donot compile ssl, use system ssl( -lssl) if required.
2015-06-13 07:45:25 +00:00
--memory-watch enable memory watch to detect memory leaking( hurts performance) .
2014-11-08 10:33:15 +00:00
--export-librtmp-project= <path> export srs-librtmp to specified project in path.
--export-librtmp-single= <path> export srs-librtmp to a single file( .h+.cpp) in path.
2017-03-25 07:40:28 +00:00
--without-valgrind donot support valgrind for memory check.
2014-04-16 06:27:34 +00:00
2014-04-16 05:24:00 +00:00
Workflow:
1. apply "Presets" . if not specified, use default preset.
2. apply "Options" . user specified option will override the preset.
3. check conflicts. @see Conflicts section.
4. generate detail features.
2015-09-22 04:43:22 +00:00
Remark:
1. both ubuntu12 and ubuntu14 are ok for SRS.
2. the centos5, centos6 and centos7 are ok for SRS.
3. all linux and unix-like os are ok for SRS.
4. windows is absolutely impossible for SRS.
2014-04-16 05:24:00 +00:00
END
}
2013-11-27 14:41:58 +00:00
2014-04-16 05:24:00 +00:00
function parse_user_option( ) {
2013-11-27 14:41:58 +00:00
case " $option " in
2014-04-16 05:24:00 +00:00
-h) help = yes ; ;
2014-04-01 08:06:32 +00:00
--help) help = yes ; ;
2013-11-27 14:41:58 +00:00
2014-04-01 08:06:32 +00:00
--with-ssl) SRS_SSL = YES ; ;
2015-03-12 03:15:15 +00:00
--with-hds) SRS_HDS = YES ; ;
2014-04-01 08:06:32 +00:00
--with-nginx) SRS_NGINX = YES ; ;
2014-08-17 14:11:43 +00:00
--with-ffmpeg) SRS_FFMPEG_TOOL = YES ; ;
2014-04-06 12:30:51 +00:00
--with-transcode) SRS_TRANSCODE = YES ; ;
2014-04-06 12:59:58 +00:00
--with-ingest) SRS_INGEST = YES ; ;
2014-08-17 14:11:43 +00:00
--with-stat) SRS_STAT = YES ; ;
2015-01-24 06:52:52 +00:00
--with-stream-caster) SRS_STREAM_CASTER = YES ; ;
2014-04-01 08:06:32 +00:00
--with-librtmp) SRS_LIBRTMP = YES ; ;
--with-research) SRS_RESEARCH = YES ; ;
--with-utest) SRS_UTEST = YES ; ;
--with-gperf) SRS_GPERF = YES ; ;
--with-gmc) SRS_GPERF_MC = YES ; ;
2016-01-08 05:58:19 +00:00
--with-gmd) SRS_GPERF_MD = YES ; ;
2014-04-01 08:06:32 +00:00
--with-gmp) SRS_GPERF_MP = YES ; ;
--with-gcp) SRS_GPERF_CP = YES ; ;
--with-gprof) SRS_GPROF = YES ; ;
2019-12-25 05:17:49 +00:00
--with-arm-ubuntu12) SRS_CROSS_BUILD = YES ; ;
--with-mips-ubuntu12) SRS_CROSS_BUILD = YES ; ;
2014-04-01 08:06:32 +00:00
--without-ssl) SRS_SSL = NO ; ;
2015-03-12 03:15:15 +00:00
--without-hds) SRS_HDS = NO ; ;
2014-04-01 08:06:32 +00:00
--without-nginx) SRS_NGINX = NO ; ;
2014-08-17 14:11:43 +00:00
--without-ffmpeg) SRS_FFMPEG_TOOL = NO ; ;
2014-04-06 12:30:51 +00:00
--without-transcode) SRS_TRANSCODE = NO ; ;
2014-04-06 12:59:58 +00:00
--without-ingest) SRS_INGEST = NO ; ;
2014-08-17 14:11:43 +00:00
--without-stat) SRS_STAT = NO ; ;
2015-01-24 06:52:52 +00:00
--without-stream-caster) SRS_STREAM_CASTER = NO ; ;
2014-04-01 08:06:32 +00:00
--without-librtmp) SRS_LIBRTMP = NO ; ;
--without-research) SRS_RESEARCH = NO ; ;
--without-utest) SRS_UTEST = NO ; ;
--without-gperf) SRS_GPERF = NO ; ;
--without-gmc) SRS_GPERF_MC = NO ; ;
2016-01-08 05:58:19 +00:00
--without-gmd) SRS_GPERF_MD = NO ; ;
2014-04-01 08:06:32 +00:00
--without-gmp) SRS_GPERF_MP = NO ; ;
--without-gcp) SRS_GPERF_CP = NO ; ;
--without-gprof) SRS_GPROF = NO ; ;
2019-12-25 05:17:49 +00:00
--without-arm-ubuntu12) SRS_CROSS_BUILD = NO ; ;
--without-mips-ubuntu12) SRS_CROSS_BUILD = NO ; ;
2014-04-04 03:36:22 +00:00
2014-04-01 08:06:32 +00:00
--jobs) SRS_JOBS = ${ value } ; ;
2019-12-25 07:46:58 +00:00
--extra-flags) SRS_EXTRA_CFLAGS = ${ value } ; ;
2014-04-01 08:06:32 +00:00
--prefix) SRS_PREFIX = ${ value } ; ;
--static) SRS_STATIC = YES ; ;
2014-07-23 06:37:54 +00:00
--log-verbose) SRS_LOG_VERBOSE = YES ; ;
--log-info) SRS_LOG_INFO = YES ; ;
--log-trace) SRS_LOG_TRACE = YES ; ;
2019-02-02 13:42:03 +00:00
--gcov) SRS_GCOV = YES ; ;
2014-04-04 03:36:22 +00:00
2014-04-16 06:14:48 +00:00
--x86-x64) SRS_X86_X64 = YES ; ;
2015-09-22 05:52:14 +00:00
--x86-64) SRS_X86_X64 = YES ; ;
2015-03-10 04:50:27 +00:00
--osx) SRS_OSX = YES ; ;
2018-12-09 11:39:36 +00:00
--allow-osx) SRS_ALLOW_OSX = YES ; ;
2019-12-25 05:17:49 +00:00
--arm) SRS_CROSS_BUILD = YES ; ;
--mips) SRS_CROSS_BUILD = YES ; ;
2014-04-01 08:06:32 +00:00
--pi) SRS_PI = YES ; ;
2014-06-19 03:22:24 +00:00
--cubie) SRS_CUBIE = YES ; ;
2014-04-16 06:14:48 +00:00
--dev) SRS_DEV = YES ; ;
2014-06-21 03:41:00 +00:00
--fast-dev) SRS_FAST_DEV = YES ; ;
2014-06-29 02:50:58 +00:00
--demo) SRS_DEMO = YES ; ;
2014-04-16 06:14:48 +00:00
--fast) SRS_FAST = YES ; ;
2014-04-18 07:13:52 +00:00
--disable-all) SRS_DISABLE_ALL = YES ; ;
2014-04-16 06:14:48 +00:00
--pure-rtmp) SRS_PURE_RTMP = YES ; ;
2014-06-08 05:03:03 +00:00
--full) SRS_ENABLE_ALL = YES ; ;
2014-04-16 06:27:34 +00:00
--use-sys-ssl) SRS_USE_SYS_SSL = YES ; ;
2015-06-13 07:45:25 +00:00
--memory-watch) SRS_MEM_WATCH = YES ; ;
2014-11-08 10:33:15 +00:00
--export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT = ${ value } ; ;
--export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE = ${ value } ; ;
2017-03-25 07:40:28 +00:00
--without-valgrind) SRS_VALGRIND = NO ; ;
2013-11-27 14:41:58 +00:00
2017-01-23 09:43:59 +00:00
--with-http-callback) SRS_HTTP_CALLBACK = YES ; ;
--with-http-api) SRS_HTTP_API = YES ; ;
--with-http-server) SRS_HTTP_SERVER = YES ; ;
2017-02-11 05:29:53 +00:00
--with-hls) SRS_HLS = YES ; ;
2017-02-11 09:27:40 +00:00
--with-dvr) SRS_DVR = YES ; ;
2017-01-23 09:43:59 +00:00
--without-http-callback) SRS_HTTP_CALLBACK = NO ; ;
--without-http-api) SRS_HTTP_API = NO ; ;
--without-http-server) SRS_HTTP_SERVER = NO ; ;
2017-02-11 05:29:53 +00:00
--without-hls) SRS_HLS = NO ; ;
2017-02-11 09:27:40 +00:00
--without-dvr) SRS_DVR = NO ; ;
2017-01-23 09:43:59 +00:00
2013-11-27 14:41:58 +00:00
*)
echo " $0 : error: invalid option \" $option \" "
exit 1
; ;
esac
2014-04-16 05:24:00 +00:00
}
2013-11-27 14:41:58 +00:00
2014-04-16 06:14:48 +00:00
function parse_user_option_to_value_and_option( ) {
case " $option " in
-*= *)
2019-12-25 09:52:51 +00:00
value = ` echo " $option " | sed -e 's|[-_a-zA-Z0-9/]*=||' `
option = ` echo " $option " | sed -e 's|=[-_a-zA-Z0-9/. ]*||' `
2014-04-16 06:14:48 +00:00
; ;
*) value = "" ; ;
esac
}
2014-03-16 12:16:42 +00:00
#####################################################################################
2014-04-16 05:24:00 +00:00
# parse preset options
2014-03-16 12:16:42 +00:00
#####################################################################################
2014-04-16 05:24:00 +00:00
opt =
for option
do
opt = " $opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"` "
2014-04-16 06:14:48 +00:00
parse_user_option_to_value_and_option
2014-04-16 05:24:00 +00:00
parse_user_option
done
2014-04-16 06:14:48 +00:00
if [ $help = yes ] ; then
show_help
exit 0
fi
function apply_user_presets( ) {
2014-07-23 06:37:54 +00:00
# always set the log level for all presets.
SRS_LOG_VERBOSE = NO
SRS_LOG_INFO = NO
SRS_LOG_TRACE = YES
2014-04-16 06:14:48 +00:00
# set default preset if not specifies
2019-12-25 05:17:49 +00:00
if [ [ $SRS_PURE_RTMP = = NO && $SRS_FAST = = NO && $SRS_DISABLE_ALL = = NO && $SRS_ENABLE_ALL = = NO && \
$SRS_DEV = = NO && $SRS_FAST_DEV = = NO && $SRS_DEMO = = NO && $SRS_PI = = NO && $SRS_CUBIE = = NO && \
$SRS_X86_X64 = = NO && $SRS_OSX = = NO \
] ] ; then
SRS_X86_X64 = YES; opt = " --x86-x64 $opt " ;
2014-05-04 10:38:08 +00:00
fi
2014-04-07 07:26:21 +00:00
2014-04-16 06:14:48 +00:00
# all disabled.
2014-04-18 07:13:52 +00:00
if [ $SRS_DISABLE_ALL = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = NO
2014-04-18 07:13:52 +00:00
SRS_LIBRTMP = NO
SRS_RESEARCH = NO
SRS_UTEST = NO
SRS_STATIC = NO
fi
2014-06-08 05:03:03 +00:00
# all enabled.
if [ $SRS_ENABLE_ALL = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = YES
2014-06-08 05:03:03 +00:00
SRS_LIBRTMP = YES
SRS_RESEARCH = YES
SRS_UTEST = YES
SRS_STATIC = NO
fi
2014-04-18 07:13:52 +00:00
# only rtmp vp6
2014-04-16 06:14:48 +00:00
if [ $SRS_FAST = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = NO
2014-04-16 06:14:48 +00:00
SRS_LIBRTMP = NO
SRS_RESEARCH = NO
SRS_UTEST = NO
SRS_STATIC = NO
fi
2014-04-16 05:24:00 +00:00
2014-04-16 06:14:48 +00:00
# only ssl for RTMP with complex handshake.
if [ $SRS_PURE_RTMP = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = NO
2014-04-16 06:14:48 +00:00
SRS_LIBRTMP = NO
SRS_RESEARCH = NO
SRS_UTEST = NO
SRS_STATIC = NO
fi
2014-03-16 12:16:42 +00:00
2014-04-16 06:14:48 +00:00
# defaults for x86/x64
if [ $SRS_X86_X64 = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = YES
2014-04-16 06:14:48 +00:00
SRS_LIBRTMP = YES
SRS_RESEARCH = NO
SRS_UTEST = YES
SRS_STATIC = NO
fi
2015-03-10 04:50:27 +00:00
# for osx(darwin)
if [ $SRS_OSX = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = YES
2015-03-10 04:50:27 +00:00
SRS_LIBRTMP = YES
SRS_RESEARCH = NO
2015-09-17 03:41:23 +00:00
SRS_UTEST = YES
2015-03-10 04:50:27 +00:00
SRS_STATIC = NO
2017-06-13 08:20:00 +00:00
# valgrind is not supported by macOS sierra, read
# https://stackoverflow.com/questions/40650338/valgrind-on-macos-sierra
SRS_VALGRIND = NO
2015-03-10 04:50:27 +00:00
fi
2014-04-16 06:14:48 +00:00
# if dev specified, open features if possible.
if [ $SRS_DEV = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = YES
2014-04-16 06:14:48 +00:00
SRS_LIBRTMP = YES
SRS_RESEARCH = YES
SRS_UTEST = YES
SRS_STATIC = NO
fi
2014-06-21 03:41:00 +00:00
# if fast dev specified, open main server features.
if [ $SRS_FAST_DEV = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = YES
2014-06-21 03:41:00 +00:00
SRS_LIBRTMP = NO
SRS_RESEARCH = NO
SRS_UTEST = NO
SRS_STATIC = NO
fi
2014-10-18 05:58:23 +00:00
2014-06-29 02:50:58 +00:00
# for srs demo
if [ $SRS_DEMO = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = YES
2014-06-29 02:50:58 +00:00
SRS_LIBRTMP = YES
SRS_RESEARCH = NO
SRS_UTEST = YES
SRS_STATIC = NO
fi
2014-04-16 06:14:48 +00:00
# if raspberry-pi specified, open ssl/hls/static features
if [ $SRS_PI = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = YES
2014-04-21 07:46:29 +00:00
SRS_LIBRTMP = YES
2014-04-16 06:14:48 +00:00
SRS_RESEARCH = NO
SRS_UTEST = NO
2014-04-21 07:17:45 +00:00
SRS_STATIC = NO
2014-04-16 06:14:48 +00:00
fi
2014-06-19 03:22:24 +00:00
# if cubieboard specified, open features except ffmpeg/nginx.
if [ $SRS_CUBIE = YES ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = YES
2014-06-19 03:22:24 +00:00
SRS_LIBRTMP = YES
SRS_RESEARCH = NO
SRS_UTEST = NO
SRS_STATIC = NO
fi
2014-04-16 06:14:48 +00:00
}
apply_user_presets
2014-03-30 04:31:50 +00:00
2014-04-16 05:24:00 +00:00
#####################################################################################
# parse detail feature options
#####################################################################################
for option
do
2014-04-16 06:14:48 +00:00
parse_user_option_to_value_and_option
2014-04-16 05:24:00 +00:00
parse_user_option
done
2014-04-16 06:14:48 +00:00
function apply_user_detail_options( ) {
# if transcode/ingest specified, requires the ffmpeg stub classes.
SRS_FFMPEG_STUB = NO
if [ $SRS_TRANSCODE = YES ] ; then SRS_FFMPEG_STUB = YES; fi
if [ $SRS_INGEST = YES ] ; then SRS_FFMPEG_STUB = YES; fi
2014-04-16 05:24:00 +00:00
2017-01-23 09:43:59 +00:00
# Always enable HTTP utilies.
2017-02-11 05:29:53 +00:00
if [ $SRS_HTTP_CORE = NO ] ; then SRS_HTTP_CORE = YES; echo -e " ${ YELLOW } [WARN] Always enable HTTP utilies. ${ BLACK } " ; fi
2018-12-22 12:45:25 +00:00
if [ $SRS_STREAM_CASTER = NO ] ; then SRS_STREAM_CASTER = YES; echo -e " ${ YELLOW } [WARN] Always enable StreamCaster. ${ BLACK } " ; fi
2018-12-22 12:30:13 +00:00
if [ $SRS_INGEST = NO ] ; then SRS_INGEST = YES; echo -e " ${ YELLOW } [WARN] Always enable Ingest. ${ BLACK } " ; fi
2018-12-22 12:03:40 +00:00
if [ $SRS_SSL = NO ] ; then SRS_SSL = YES; echo -e " ${ YELLOW } [WARN] Always enable SSL. ${ BLACK } " ; fi
2018-12-22 11:58:36 +00:00
if [ $SRS_STAT = NO ] ; then SRS_STAT = YES; echo -e " ${ YELLOW } [WARN] Always enable Statistic. ${ BLACK } " ; fi
2018-12-22 11:48:55 +00:00
if [ $SRS_TRANSCODE = NO ] ; then SRS_TRANSCODE = YES; echo -e " ${ YELLOW } [WARN] Always enable Transcode. ${ BLACK } " ; fi
2017-02-11 05:29:53 +00:00
if [ $SRS_HTTP_CALLBACK = NO ] ; then SRS_HTTP_CALLBACK = YES; echo -e " ${ YELLOW } [WARN] Always enable HTTP callback. ${ BLACK } " ; fi
if [ $SRS_HTTP_SERVER = NO ] ; then SRS_HTTP_SERVER = YES; echo -e " ${ YELLOW } [WARN] Always enable HTTP server. ${ BLACK } " ; fi
if [ $SRS_HTTP_API = NO ] ; then SRS_HTTP_API = YES; echo -e " ${ YELLOW } [WARN] Always enable HTTP API. ${ BLACK } " ; fi
if [ $SRS_HLS = NO ] ; then SRS_HLS = YES; echo -e " ${ YELLOW } [WARN] Always enable HLS. ${ BLACK } " ; fi
2017-02-11 09:27:40 +00:00
if [ $SRS_DVR = NO ] ; then SRS_DVR = YES; echo -e " ${ YELLOW } [WARN] Always enable DVR. ${ BLACK } " ; fi
2014-03-04 04:45:41 +00:00
2014-04-16 06:14:48 +00:00
# parse the jobs for make
if [ [ "" -eq SRS_JOBS ] ] ; then
export SRS_JOBS = "--jobs=1"
else
export SRS_JOBS = " --jobs= ${ SRS_JOBS } "
fi
2014-11-08 07:31:21 +00:00
2014-11-08 10:33:15 +00:00
# if specified export single file, export project first.
if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ] ; then
SRS_EXPORT_LIBRTMP_PROJECT = $SRS_EXPORT_LIBRTMP_SINGLE
fi
2014-11-08 07:31:21 +00:00
# disable almost all features for export srs-librtmp.
2014-11-08 10:33:15 +00:00
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ] ; then
2015-03-12 03:15:15 +00:00
SRS_HDS = NO
2014-11-08 07:31:21 +00:00
SRS_SSL = NO
SRS_TRANSCODE = NO
2018-12-22 11:48:55 +00:00
SRS_HTTP_CALLBACK = NO
2014-11-08 07:31:21 +00:00
SRS_INGEST = NO
SRS_STAT = NO
2015-01-24 06:52:52 +00:00
SRS_STREAM_CASTER = NO
2014-11-08 07:31:21 +00:00
SRS_LIBRTMP = YES
SRS_RESEARCH = YES
SRS_UTEST = NO
SRS_GPERF = NO
SRS_GPERF_MC = NO
2016-01-08 05:58:19 +00:00
SRS_GPERF_MD = NO
2014-11-08 07:31:21 +00:00
SRS_GPERF_MP = NO
SRS_GPERF_CP = NO
SRS_GPROF = NO
SRS_STATIC = NO
fi
2014-04-16 06:14:48 +00:00
}
apply_user_detail_options
function regenerate_options( ) {
# save all config options to macro to write to auto headers file
SRS_AUTO_USER_CONFIGURE = " $opt "
# regenerate the options for default values.
2015-03-12 03:15:15 +00:00
SRS_AUTO_CONFIGURE = " --prefix= ${ SRS_PREFIX } "
2014-04-16 06:14:48 +00:00
if [ $SRS_HLS = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-hls " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-hls " ; fi
2015-03-12 03:15:15 +00:00
if [ $SRS_HDS = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-hds " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-hds " ; fi
2014-04-16 06:14:48 +00:00
if [ $SRS_DVR = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-dvr " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-dvr " ; fi
if [ $SRS_SSL = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-ssl " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-ssl " ; fi
if [ $SRS_TRANSCODE = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-transcode " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-transcode " ; fi
if [ $SRS_INGEST = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-ingest " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-ingest " ; fi
2014-08-17 14:19:52 +00:00
if [ $SRS_STAT = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-stat " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-stat " ; fi
2014-04-16 06:14:48 +00:00
if [ $SRS_HTTP_CALLBACK = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-http-callback " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-http-callback " ; fi
if [ $SRS_HTTP_SERVER = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-http-server " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-http-server " ; fi
2015-01-24 06:52:52 +00:00
if [ $SRS_STREAM_CASTER = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-stream-caster " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-stream-caster " ; fi
2014-04-16 06:14:48 +00:00
if [ $SRS_HTTP_API = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-http-api " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-http-api " ; fi
if [ $SRS_LIBRTMP = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-librtmp " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-librtmp " ; fi
if [ $SRS_RESEARCH = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-research " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-research " ; fi
if [ $SRS_UTEST = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-utest " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-utest " ; fi
if [ $SRS_GPERF = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-gperf " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-gperf " ; fi
if [ $SRS_GPERF_MC = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-gmc " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-gmc " ; fi
2016-01-08 05:58:19 +00:00
if [ $SRS_GPERF_MD = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-gmd " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-gmd " ; fi
2014-04-16 06:14:48 +00:00
if [ $SRS_GPERF_MP = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-gmp " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-gmp " ; fi
if [ $SRS_GPERF_CP = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-gcp " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-gcp " ; fi
if [ $SRS_GPROF = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --with-gprof " ; else SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --without-gprof " ; fi
if [ $SRS_STATIC = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --static " ; fi
2014-07-23 06:37:54 +00:00
if [ $SRS_LOG_VERBOSE = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --log-verbose " ; fi
if [ $SRS_LOG_INFO = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --log-info " ; fi
if [ $SRS_LOG_TRACE = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --log-trace " ; fi
2019-02-02 13:42:03 +00:00
if [ $SRS_GCOV = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gcov " ; fi
2019-12-25 07:46:58 +00:00
if [ [ $SRS_EXTRA_CFLAGS != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --extra-flags=\\\" $SRS_EXTRA_CFLAGS \\\" " ; fi
2016-12-07 04:09:39 +00:00
echo " User config: $SRS_AUTO_USER_CONFIGURE "
echo " Detail config: ${ SRS_AUTO_CONFIGURE } "
2014-04-16 06:14:48 +00:00
}
regenerate_options
2013-11-27 14:41:58 +00:00
2014-02-28 06:38:27 +00:00
#####################################################################################
# check user options
#####################################################################################
2014-04-16 06:14:48 +00:00
function check_option_conflicts( ) {
2019-12-25 05:17:49 +00:00
if [ $SRS_CROSS_BUILD = YES ] ; then
echo "We don't support crossbuild for ARM/MIPS, please directly build it on ARM/MIPS server."
exit -1
fi
if [ $SRS_OSX = YES ] ; then
echo "We don't support OSX, please use docker https://github.com/ossrs/srs-docker"
exit -1
fi
2019-12-25 10:29:07 +00:00
if [ [ $SRS_NGINX = = YES ] ] ; then
echo "Don't support building NGINX, please use docker https://github.com/ossrs/srs-docker"
exit -1
fi
if [ [ $SRS_FFMPEG_TOOL = = YES ] ] ; then
echo "Don't support building FFMPEG, please use docker https://github.com/ossrs/srs-docker"
exit -1
fi
2019-12-25 05:17:49 +00:00
# TODO: FIXME: check more os.
2014-04-16 06:14:48 +00:00
__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
2016-01-08 05:58:19 +00:00
if [ $SRS_GPERF_MD = YES ] ; then echo "gperf-md depends on gperf, see: ./configure --help" ; __check_ok = NO; fi
2014-04-16 06:14:48 +00:00
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
2014-03-07 07:40:55 +00:00
fi
2015-05-27 02:23:40 +00:00
if [ [ $SRS_GPERF_MC = YES && $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
2014-04-16 06:14:48 +00:00
# generate the group option: SRS_GPERF
__gperf_slow = NO
if [ $SRS_GPERF_MC = YES ] ; then SRS_GPERF = YES; __gperf_slow = YES; fi
2016-01-08 05:58:19 +00:00
if [ $SRS_GPERF_MD = YES ] ; then SRS_GPERF = YES; __gperf_slow = YES; fi
2014-04-16 06:14:48 +00:00
if [ $SRS_GPERF_MP = YES ] ; then SRS_GPERF = YES; __gperf_slow = YES; fi
if [ $SRS_GPERF_CP = YES ] ; then SRS_GPERF = YES; __gperf_slow = YES; fi
if [ $__gperf_slow = YES ] ; then if [ $SRS_GPROF = YES ] ; then
echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help" ; __check_ok = NO;
fi fi
2014-04-15 08:07:25 +00:00
2014-04-16 06:14:48 +00:00
# check variable neccessary
2015-03-12 03:15:15 +00:00
if [ $SRS_HDS = RESERVED ] ; then echo "you must specifies the hds, see: ./configure --help" ; __check_ok = NO; fi
2014-04-16 06:14:48 +00:00
if [ $SRS_SSL = RESERVED ] ; then echo "you must specifies the ssl, see: ./configure --help" ; __check_ok = NO; fi
2015-01-24 06:52:52 +00:00
if [ $SRS_STREAM_CASTER = RESERVED ] ; then echo "you must specifies the stream-caster, see: ./configure --help" ; __check_ok = NO; fi
2014-04-16 06:14:48 +00:00
if [ $SRS_LIBRTMP = RESERVED ] ; then echo "you must specifies the librtmp, 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 = RESERVED ] ; then echo "you must specifies the gperf, 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
2016-01-08 05:58:19 +00:00
if [ $SRS_GPERF_MD = RESERVED ] ; then echo "you must specifies the gperf-md, see: ./configure --help" ; __check_ok = NO; fi
2014-04-16 06:14:48 +00:00
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 [ $SRS_GPROF = RESERVED ] ; then echo "you must specifies the gprof, see: ./configure --help" ; __check_ok = NO; fi
if [ [ -z $SRS_PREFIX ] ] ; then echo "you must specifies the prefix, see: ./configure --prefix" ; __check_ok = NO; fi
if [ $__check_ok = NO ] ; then
exit 1;
fi
2018-11-11 08:24:00 +00:00
2018-12-09 11:39:36 +00:00
if [ [ $SRS_OSX = = YES && $SRS_ALLOW_OSX = = NO ] ] ; then
2018-11-11 08:24:00 +00:00
macOSVersion = ` sw_vers -productVersion`
macOSVersionMajor = ` echo $macOSVersion | awk -F '.' '{print $1}' `
macOSVersionMinor = ` echo $macOSVersion | awk -F '.' '{print $2}' `
if [ [ $macOSVersionMajor -ge 10 && $macOSVersionMinor -ge 14 ] ] ; then
echo " macOS $macOSVersion is not supported, read https://github.com/ossrs/srs/issues/1250 "
exit -1
fi
fi
2014-04-16 06:14:48 +00:00
}
check_option_conflicts