1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge 4.0release

This commit is contained in:
winlin 2020-03-28 17:46:47 +08:00
commit c2b02f86fa
22 changed files with 441 additions and 88 deletions

View file

@ -149,6 +149,11 @@ if [ $SRS_CROSS_BUILD = YES ]; then
else
srs_undefine_macro "SRS_AUTO_CROSSBUILD" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_OSX = YES ]; then
srs_define_macro "SRS_AUTO_OSX" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_OSX" $SRS_AUTO_HEADERS_H
fi
# prefix
echo "" >> $SRS_AUTO_HEADERS_H

View file

@ -118,6 +118,7 @@ function Ubuntu_prepare()
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for ubuntu failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# for Centos, auto install tools by yum
#####################################################################################
@ -198,14 +199,105 @@ function Centos_prepare()
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for CentOS failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# For OSX, auto install tools by brew
#####################################################################################
OS_IS_OSX=NO
function OSX_prepare()
{
uname -s|grep Darwin >/dev/null 2>&1
ret=$?; if [[ 0 -ne $ret ]]; then
if [ $SRS_OSX = YES ]; then
echo "OSX check failed, actual is `uname -s`"
exit 1;
fi
return 0;
fi
# cross build for arm, install the cross build tool chain.
if [ $SRS_CROSS_BUILD = YES ]; then
echo "embeded(arm/mips) is invalid for OSX"
return 1
fi
OS_IS_OSX=YES
echo "OSX detected, install tools if needed"
# requires the osx when os
if [ $OS_IS_OSX = YES ]; then
if [ $SRS_OSX = NO ]; then
echo "OSX detected, must specifies the --osx"
exit 1
fi
fi
brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install brew"
echo "ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\""
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install brew success"
fi
gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install gcc"
echo "brew install gcc"
brew install gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install gcc success"
fi
g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install gcc-c++"
echo "brew install gcc-c++"
brew install gcc-c++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install gcc-c++ success"
fi
make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install make"
echo "brew install make"
brew install make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install make success"
fi
patch --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install patch"
echo "brew install patch"
brew install patch; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install patch success"
fi
unzip --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install unzip"
echo "brew install unzip"
brew install unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install unzip success"
fi
echo "OSX install tools success"
return 0
}
# donot prepare tools, for srs-librtmp depends only gcc and g++.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "OSX prepare failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# for Centos, auto install tools by yum
#####################################################################################
# We must use a bash function instead of variable.
function sed_utility() {
sed -i "$@"
if [ $OS_IS_OSX = YES ]; then
sed -i '' "$@"
else
sed -i "$@"
fi
ret=$?; if [[ $ret -ne 0 ]]; then
echo "sed -i \"$@\""
if [ $OS_IS_OSX = YES ]; then
echo "sed -i '' \"$@\""
else
echo "sed -i \"$@\""
fi
return $ret
fi
}
@ -220,7 +312,7 @@ SED="sed_utility" && echo "SED is $SED"
# directly build on arm/mips, for example, pi or cubie,
# export srs-librtmp
# others is invalid.
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then
echo "Your OS `uname -s` is not supported."
exit 1

View file

@ -23,7 +23,7 @@ SRS_NGINX=NO
SRS_FFMPEG_TOOL=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=YES
SRS_UTEST=NO
SRS_GPERF=NO # Performance test: tcmalloc
SRS_GPERF_MC=NO # Performance test: gperf memory check
SRS_GPERF_MD=NO # Performance test: gperf memory defence
@ -210,10 +210,6 @@ Remark:
END
}
function ignore_option() {
echo "ignore option \"$option\""
}
function parse_user_option() {
case "$option" in
-h) help=yes ;;
@ -307,16 +303,16 @@ function parse_user_option() {
--with-hls) SRS_HLS=YES ;;
--with-dvr) SRS_DVR=YES ;;
--without-stream-caster) ignore_option ;;
--without-ingest) ignore_option ;;
--without-ssl) ignore_option ;;
--without-stat) ignore_option ;;
--without-transcode) ignore_option ;;
--without-http-callback) ignore_option ;;
--without-http-server) ignore_option ;;
--without-http-api) ignore_option ;;
--without-hls) ignore_option ;;
--without-dvr) ignore_option ;;
--without-stream-caster) echo "ignore option \"$option\"" ;;
--without-ingest) echo "ignore option \"$option\"" ;;
--without-ssl) echo "ignore option \"$option\"" ;;
--without-stat) echo "ignore option \"$option\"" ;;
--without-transcode) echo "ignore option \"$option\"" ;;
--without-http-callback) echo "ignore option \"$option\"" ;;
--without-http-server) echo "ignore option \"$option\"" ;;
--without-http-api) echo "ignore option \"$option\"" ;;
--without-hls) echo "ignore option \"$option\"" ;;
--without-dvr) echo "ignore option \"$option\"" ;;
*)
echo "$0: error: invalid option \"$option\""
@ -407,7 +403,7 @@ function apply_user_presets() {
SRS_HDS=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=YES
SRS_UTEST=NO
SRS_STATIC=NO
fi
@ -434,7 +430,7 @@ function apply_user_presets() {
SRS_HDS=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=YES
SRS_UTEST=NO
SRS_STATIC=NO
fi
@ -587,16 +583,16 @@ function check_option_conflicts() {
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
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
if [[ $SRS_OSX == YES && $SRS_UTEST == YES ]]; then
echo "Mac does not support utest."; exit -1;
fi
# TODO: FIXME: check more os.