@ -54,8 +54,6 @@ SRS_GCOV=NO
SRS_LOG_VERBOSE = NO
SRS_LOG_INFO = NO
SRS_LOG_TRACE = NO
# The extra c/c++ flags to build SRS. Note that we also pass to ST as EXTRA_CFLAGS.
SRS_EXTRA_CFLAGS =
#
################################################################
# experts
@ -77,7 +75,6 @@ SRS_VALGRIND=NO
SRS_X86_X64 = NO
# for osx system
SRS_OSX = NO
SRS_ALLOW_OSX = NO
# dev, open all features for dev, no gperf/prof/arm.
SRS_DEV = NO
# dev, open main server feature for dev, no utest/research/librtmp
@ -98,8 +95,14 @@ SRS_DISABLE_ALL=NO
SRS_ENABLE_ALL = NO
#
#####################################################################################
# We don't support crossbuild for ARM/MIPS, please directly build it on ARM/MIPS server .
# Toolchain crossbuild for ARM or MIPS .
SRS_CROSS_BUILD = NO
SRS_TOOL_CC = gcc
SRS_TOOL_CXX = g++
SRS_TOOL_AR = ar
SRS_TOOL_LD = ld
SRS_TOOL_RANDLIB = randlib
SRS_EXTRA_FLAGS =
#####################################################################################
# menu
@ -107,106 +110,84 @@ SRS_CROSS_BUILD=NO
function show_help( ) {
cat << END
Options:
-h, --help print this message
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
--with-hds enable hds streaming, mux RTMP to F4M/F4V files.
--with-nginx enable delivery HTTP stream with nginx.
--with-stream-caster enable stream caster to serve other stream over other protocol.
--with-ffmpeg enable transcoding tool ffmpeg.
--with-transcode enable transcoding features.
--with-ingest enable ingest features.
--with-stat enable the data statistic, for http api.
--with-librtmp enable srs-librtmp, library for client.
--with-research build the research tools.
--with-utest build the utest for SRS.
--with-gperf build SRS with gperf tools( no gmd/gmc/gmp/gcp, with tcmalloc only) .
https://blog.csdn.net/win_lin/article/details/53503869
--with-gmc build memory check for SRS with gperf tools.
--with-gmd build memory defense( corrupt memory) 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.
--with-gprof build SRS with gprof( GNU profile tool) .
--with-arm-ubuntu12 cross build SRS on ubuntu12 for armhf( v7cpu) .
--with-mips-ubuntu12 cross build SRS on ubuntu12 for mips.
--without-ssl disable rtmp complex handshake.
--without-hds disable hds, the adobe http dynamic streaming.
--without-nginx disable delivery HTTP stream with nginx.
--without-stream-caster disable stream caster, only listen and serve RTMP/HTTP.
--without-ffmpeg disable the ffmpeg transcode tool feature.
--without-transcode disable the transcoding feature.
--without-ingest disable the ingest feature.
--without-stat disable the data statistic feature.
--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.
--without-gperf do not build SRS with gperf tools( without tcmalloc and gmd/gmc/gmp/gcp) .
--without-gmc do not build memory check for SRS with gperf tools.
--without-gmd do not build memory defense 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.
--without-gprof do not build srs with gprof( GNU profile tool) .
--without-arm-ubuntu12 do not cross build srs on ubuntu12 for armhf( v7cpu) .
--without-mips-ubuntu12 do not cross build srs on ubuntu12 for mips.
Presets:
--x86-64, --x86-x64 [ default] For x86/x64 cpu, common pc and servers.
--arm Enable crossbuild for ARM, should also set bellow toolchain options.
--mips Enable crossbuild for MIPS
Features:
-h, --help Print this message and exit 0.
--with-ssl Enable rtmp complex handshake, requires openssl-devel installed.
--with-hds Enable hds streaming, mux RTMP to F4M/F4V files.
--with-stream-caster Enable stream caster to serve other stream over other protocol.
--with-stat Enable the data statistic, for http api.
--with-librtmp Enable srs-librtmp, library for client.
--with-research Build the research tools.
--with-utest Build the utest for SRS.
--without-ssl Disable rtmp complex handshake.
--without-hds Disable hds, the adobe http dynamic streaming.
--without-stream-caster Disable stream caster, only listen and serve RTMP/HTTP.
--without-stat Disable the data statistic feature.
--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.
--prefix= <path> The absolute installation path for srs. Default: $SRS_PREFIX
--static Whether add '-static' to link options.
--gcov Whether enable the GCOV compiler options.
--jobs[ = N] Allow N jobs at once; infinite jobs with no arg.
used for make in the configure, for example, to make ffmpeg.
--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.
Used for make in the configure, for example, to make ffmpeg.
--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.
Performance: @see https://blog.csdn.net/win_lin/article/details/53503869
--with-valgrind Support valgrind for memory check.
--with-gperf Build SRS with gperf tools( no gmd/gmc/gmp/gcp, with tcmalloc only) .
--with-gmc Build memory check for SRS with gperf tools.
--with-gmd Build memory defense( corrupt memory) 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.
--with-gprof Build SRS with gprof( GNU profile tool) .
--without-valgrind Do not support valgrind for memory check.
--without-gperf Do not build SRS with gperf tools( without tcmalloc and gmd/gmc/gmp/gcp) .
--without-gmc Do not build memory check for SRS with gperf tools.
--without-gmd Do not build memory defense 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.
--without-gprof Do not build srs with gprof( GNU profile tool) .
Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuecomment-576078411
--arm Enable crossbuild for ARM.
--mips Enable crossbuild for MIPS.
--cc= <CC> Use c compiler CC, default is gcc.
--cxx= <CXX> Use c++ compiler CXX, default is g++.
--ar= <AR> Use archive tool AR, default is ar.
--ld= <LD> Use linker tool LD, default is ld.
--randlib= <RANDLIB> Use randlib tool RANDLIB, default is randlib.
--extra-flags= <EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
Presets:
--x86-x64 [ default] for x86/x64 cpu, common pc and servers.
--osx for osx( darwin) system to build SRS.
--pi for raspberry-pi( directly build) , open features hls/ssl/static.
--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
--fast the most fast compile, nothing, only support vp6 RTMP.
--pure-rtmp only support RTMP with ssl.
--disable-all disable all features, only support vp6 RTMP.
--dev for dev, open all features, no nginx/gperf/gprof/arm.
--fast-dev for dev fast compile, the RTMP server, without librtmp/utest/research.
--demo for srs demo, @see: https://github.com/ossrs/srs/wiki/v1_CN_SampleDemo
--full enable all features, no gperf/gprof/arm.
--x86-64 alias for --x86-x64.
Toolchain options:
--extra-flags= <EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Pass to ST as EXTRA_CFLAGS.
Recomment to enable:
--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.
Conflicts:
1. --with-gmc vs --with-gmp:
@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html
2. --with-gperf/gmc/gmp vs --with-gprof:
gperftools not compatible with gprof.
The gperftools not compatible with gprof.
3. --arm vs --with-ffmpeg/gperf/gmc/gmp/gprof:
t he complex tools not available for arm.
The complex tools not available for arm.
Experts:
--use-sys-ssl donot compile ssl, use system ssl( -lssl) if required.
--memory-watch enable memory watch to detect memory leaking( hurts performance) .
--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.
--with-valgrind support valgrind for memory check.
--without-valgrind donot support valgrind for memory check.
--use-sys-ssl Do not compile ssl, use system ssl( -lssl) if required.
--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.
Workflow:
1. a pply "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 .
1. Apply "Presets" . if not specified, use default preset.
2. Apply "Features" , "Performance" and others. user specified option will override the preset.
3. Check conflicts, fail if exists conflicts.
4. Generate Makefile.
Remark:
1. For performance improving, read https://blog.csdn.net/win_lin/article/details/53503869
@ -238,15 +219,10 @@ function parse_user_option() {
--with-gprof) SRS_GPROF = YES ; ;
--with-arm-ubuntu12) SRS_CROSS_BUILD = YES ; ;
--with-mips-ubuntu12) SRS_CROSS_BUILD = YES ; ;
--without-ssl) SRS_SSL = NO ; ;
--without-hds) SRS_HDS = NO ; ;
--without-nginx) SRS_NGINX = NO ; ;
--without-ffmpeg) SRS_FFMPEG_TOOL = NO ; ;
--without-transcode) SRS_TRANSCODE = NO ; ;
--without-ingest) SRS_INGEST = NO ; ;
--without-stat) SRS_STAT = NO ; ;
--without-stream-caster) SRS_STREAM_CASTER = NO ; ;
--without-librtmp) SRS_LIBRTMP = NO ; ;
--without-research) SRS_RESEARCH = NO ; ;
--without-utest) SRS_UTEST = NO ; ;
@ -260,20 +236,26 @@ function parse_user_option() {
--without-mips-ubuntu12) SRS_CROSS_BUILD = NO ; ;
--jobs) SRS_JOBS = ${ value } ; ;
--extra-flags) SRS_EXTRA_CFLAGS = ${ value } ; ;
--prefix) SRS_PREFIX = ${ value } ; ;
--static) SRS_STATIC = YES ; ;
--log-verbose) SRS_LOG_VERBOSE = YES ; ;
--log-info) SRS_LOG_INFO = YES ; ;
--log-trace) SRS_LOG_TRACE = YES ; ;
--gcov) SRS_GCOV = YES ; ;
--arm) SRS_CROSS_BUILD = YES ; ;
--mips) SRS_CROSS_BUILD = YES ; ;
--cc) SRS_TOOL_CC = ${ value } ; ;
--cxx) SRS_TOOL_CXX = ${ value } ; ;
--ar) SRS_TOOL_AR = ${ value } ; ;
--ld) SRS_TOOL_LD = ${ value } ; ;
--randlib) SRS_TOOL_RANDLIB = ${ value } ; ;
--extra-flags) SRS_EXTRA_FLAGS = ${ value } ; ;
--x86-x64) SRS_X86_X64 = YES ; ;
--x86-64) SRS_X86_X64 = YES ; ;
--osx) SRS_OSX = YES ; ;
--allow-osx) SRS_ALLOW_OSX = YES ; ;
--arm) SRS_CROSS_BUILD = YES ; ;
--mips) SRS_CROSS_BUILD = YES ; ;
--allow-osx) SRS_OSX = YES ; ;
--pi) SRS_PI = YES ; ;
--cubie) SRS_CUBIE = YES ; ;
--dev) SRS_DEV = YES ; ;
@ -296,11 +278,19 @@ function parse_user_option() {
--with-http-server) SRS_HTTP_SERVER = YES ; ;
--with-hls) SRS_HLS = YES ; ;
--with-dvr) SRS_DVR = YES ; ;
--without-http-callback) SRS_HTTP_CALLBACK = NO ; ;
--without-http-api) SRS_HTTP_API = NO ; ;
--without-http-server) SRS_HTTP_SERVER = NO ; ;
--without-hls) SRS_HLS = NO ; ;
--without-dvr) SRS_DVR = NO ; ;
--without-stream-caster) ; &
--without-ingest) ; &
--without-ssl) ; &
--without-stat) ; &
--without-transcode) ; &
--without-http-callback) ; &
--without-http-server) ; &
--without-http-api) ; &
--without-hls) ; &
--without-dvr)
echo " ignore option \" $option \" "
; ;
*)
echo " $0 : error: invalid option \" $option \" "
@ -313,7 +303,7 @@ function parse_user_option_to_value_and_option() {
case " $option " in
-*= *)
value = ` echo " $option " | sed -e 's|[-_a-zA-Z0-9/]*=||' `
option = ` echo " $option " | sed -e 's|=[-_a-zA-Z0-9/. ]*||'`
option = ` echo " $option " | sed -e 's|=[-_a-zA-Z0-9/. + ]*||'`
; ;
*) value = "" ; ;
esac
@ -345,7 +335,7 @@ function apply_user_presets() {
# set default preset if not specifies
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 \
$SRS_X86_X64 = = NO && $SRS_OSX = = NO && $SRS_CROSS_BUILD = = NO \
] ] ; then
SRS_X86_X64 = YES; opt = " --x86-x64 $opt " ;
fi
@ -439,6 +429,14 @@ function apply_user_presets() {
SRS_UTEST = NO
SRS_STATIC = NO
fi
# if crossbuild, disable research and librtmp.
if [ [ $SRS_CROSS_BUILD = = YES ] ] ; then
SRS_LIBRTMP = NO
SRS_RESEARCH = NO
SRS_UTEST = NO
SRS_STATIC = NO
fi
}
apply_user_presets
@ -535,7 +533,12 @@ SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"
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
if [ $SRS_GCOV = YES ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --gcov " ; fi
if [ [ $SRS_EXTRA_CFLAGS != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --extra-flags=\\\" $SRS_EXTRA_CFLAGS \\\" " ; fi
if [ [ $SRS_EXTRA_FLAGS != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --extra-flags=\\\" $SRS_EXTRA_FLAGS \\\" " ; fi
if [ [ $SRS_TOOL_CC != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --cc= $SRS_TOOL_CC " ; fi
if [ [ $SRS_TOOL_CXX != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --cxx= $SRS_TOOL_CXX " ; fi
if [ [ $SRS_TOOL_AR != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ar= $SRS_TOOL_AR " ; fi
if [ [ $SRS_TOOL_LD != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --ld= $SRS_TOOL_LD " ; fi
if [ [ $SRS_TOOL_RANDLIB != '' ] ] ; then SRS_AUTO_CONFIGURE = " ${ SRS_AUTO_CONFIGURE } --randlib= $SRS_TOOL_RANDLIB " ; fi
echo " User config: $SRS_AUTO_USER_CONFIGURE "
echo " Detail config: ${ SRS_AUTO_CONFIGURE } "
}
@ -545,24 +548,24 @@ regenerate_options
# check user options
#####################################################################################
function check_option_conflicts( ) {
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
if [ [ $SRS_TOOL_CC = = '' || $SRS_TOOL_CXX = = '' || $SRS_TOOL_AR = = '' || $SRS_TOOL_LD = = '' || $SRS_TOOL_RANDLIB = = '' ] ] ; then
echo " No crossbuild tools, cc: $SRS_TOOL_CC , cxx: $SRS_TOOL_CXX , ar: $SRS_TOOL_AR , ld: $SRS_TOOL_LD , randlib: $SRS_TOOL_RANDLIB " ; exit -1
fi
if [ [ $SRS_CROSS_BUILD = = YES && ( $SRS_TOOL_CC = = 'gcc' || $SRS_TOOL_CXX = = 'g++' || $SRS_TOOL_AR = = 'ar' ) ] ] ; then
echo " For crossbuild, must not use default toolchain, cc: $SRS_TOOL_CC , cxx: $SRS_TOOL_CXX , ar: $SRS_TOOL_AR " ; 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
echo "We don't support OSX, please use docker https://github.com/ossrs/srs-docker" ; exit -1
fi
if [ [ $SRS_NGINX = = YES ] ] ; then
echo "Don't support building NGINX, please use docker https://github.com/ossrs/srs-docker"
exit -1
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
echo "Don't support building FFMPEG, please use docker https://github.com/ossrs/srs-docker" ; exit -1
fi
# TODO: FIXME: check more os.
@ -608,15 +611,5 @@ function check_option_conflicts() {
if [ $__check_ok = NO ] ; then
exit 1;
fi
if [ [ $SRS_OSX = = YES && $SRS_ALLOW_OSX = = NO ] ] ; then
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
}
check_option_conflicts