From 255a0a75e7512e7214ba4b7cc400b4f0408ab6c7 Mon Sep 17 00:00:00 2001 From: Johnny Date: Mon, 30 Jan 2023 14:48:16 +0800 Subject: [PATCH] fix(sync-point): fix cherry pick from "For #2532: Windows: Replace ln by cp for windows. v5.0.87 (#3246)" --- trunk/auto/auto_headers.sh | 28 +++ trunk/auto/depends.sh | 466 ++++++++++++++----------------------- trunk/auto/modules.sh | 4 +- trunk/auto/options.sh | 231 ++++++++++-------- trunk/auto/summary.sh | 2 +- trunk/configure | 31 ++- trunk/scripts/package.sh | 14 +- 7 files changed, 379 insertions(+), 397 deletions(-) diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index ab633b5cf95..5f564b3962d 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -87,6 +87,18 @@ else srs_undefine_macro "SRS_FFMPEG_FIT" $SRS_AUTO_HEADERS_H fi +if [[ $SRS_FFMPEG_OPUS == YES ]]; then + srs_define_macro "SRS_FFMPEG_OPUS" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_FFMPEG_OPUS" $SRS_AUTO_HEADERS_H +fi + +if [[ $SRS_H265 == YES ]]; then + srs_define_macro "SRS_H265" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_H265" $SRS_AUTO_HEADERS_H +fi + if [[ $SRS_SIMULATOR == YES ]]; then srs_define_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H else @@ -114,6 +126,12 @@ else srs_undefine_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H fi +if [[ $SRS_APM == YES ]]; then + srs_define_macro "SRS_APM" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_APM" $SRS_AUTO_HEADERS_H +fi + if [[ $SRS_UTEST == YES ]]; then srs_define_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H else @@ -153,6 +171,16 @@ if [[ $SRS_GPERF_CP == YES ]]; then else srs_undefine_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H fi +if [ $SRS_SANITIZER == YES ]; then + srs_define_macro "SRS_SANITIZER" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_SANITIZER" $SRS_AUTO_HEADERS_H +fi +if [ $SRS_SANITIZER_LOG == YES ]; then + srs_define_macro "SRS_SANITIZER_LOG" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_SANITIZER_LOG" $SRS_AUTO_HEADERS_H +fi ##################################################################################### # for embeded. diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 208e7440840..03f1fb3e0f2 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -11,285 +11,6 @@ ##################################################################################### ##################################################################################### -##################################################################################### -# utilities -##################################################################################### -function require_sudoer() { - sudo echo "" >/dev/null 2>&1 - - ret=$?; if [[ 0 -ne $ret ]]; then - echo "\"$1\" require sudoer failed. ret=$ret"; - exit $ret; - fi -} - -##################################################################################### -# for Ubuntu, auto install tools by apt-get -##################################################################################### -function Ubuntu_prepare() { - if [[ $OS_IS_UBUNTU != YES ]]; then return 0; fi - echo "Installing tools for Ubuntu." - - gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing gcc." - require_sudoer "sudo apt-get install -y --force-yes gcc" - sudo apt-get install -y --force-yes gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The gcc is installed." - fi - - g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing g++." - require_sudoer "sudo apt-get install -y --force-yes g++" - sudo apt-get install -y --force-yes g++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The g++ is installed." - fi - - make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing make." - require_sudoer "sudo apt-get install -y --force-yes make" - sudo apt-get install -y --force-yes make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The make is installed." - fi - - patch --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing patch." - require_sudoer "sudo apt-get install -y --force-yes patch" - sudo apt-get install -y --force-yes patch; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The patch is installed." - fi - - unzip --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing unzip." - require_sudoer "sudo apt-get install -y --force-yes unzip" - sudo apt-get install -y --force-yes unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The unzip is installed." - fi - - if [[ $SRS_VALGRIND == YES ]]; then - valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing valgrind." - require_sudoer "sudo apt-get install -y --force-yes valgrind" - sudo apt-get install -y --force-yes valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The valgrind is installed." - fi - fi - - if [[ $SRS_VALGRIND == YES ]]; then - if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then - echo "Installing valgrind-dev." - require_sudoer "sudo apt-get install -y --force-yes valgrind-dbg" - sudo apt-get install -y --force-yes valgrind-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The valgrind-dev is installed." - fi - fi - - if [[ $SRS_SRT == YES ]]; then - echo "SRT enable, install depend tools" - tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing tcl." - require_sudoer "sudo apt-get install -y --force-yes tcl" - sudo apt-get install -y --force-yes tcl; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The tcl is installed." - fi - - cmake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing cmake." - require_sudoer "sudo apt-get install -y --force-yes cmake" - sudo apt-get install -y --force-yes cmake; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The cmake is installed." - fi - fi - - pkg-config --version >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing pkg-config." - require_sudoer "sudo apt-get install -y --force-yes pkg-config" - sudo apt-get install -y --force-yes pkg-config; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The pkg-config is installed." - fi - - echo "Tools for Ubuntu are installed." - return 0 -} -# donot prepare tools, for srs-librtmp depends only gcc and g++. -Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for ubuntu failed, ret=$ret"; exit $ret; fi - -##################################################################################### -# for Centos, auto install tools by yum -##################################################################################### -function Centos_prepare() { - if [[ $OS_IS_CENTOS != YES ]]; then return 0; fi - echo "Installing tools for Centos." - - gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing gcc." - require_sudoer "sudo yum install -y gcc" - sudo yum install -y gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The gcc is installed." - fi - - g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing gcc-c++." - require_sudoer "sudo yum install -y gcc-c++" - sudo yum install -y gcc-c++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The gcc-c++ is installed." - fi - - make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing make." - require_sudoer "sudo yum install -y make" - sudo yum install -y make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The make is installed." - fi - - patch --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing patch." - require_sudoer "sudo yum install -y patch" - sudo yum install -y patch; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The patch is installed." - fi - - unzip --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing unzip." - require_sudoer "sudo yum install -y unzip" - sudo yum install -y unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The unzip is installed." - fi - - if [[ $SRS_VALGRIND == YES ]]; then - valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing valgrind." - require_sudoer "sudo yum install -y valgrind" - sudo yum install -y valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The valgrind is installed." - fi - fi - - if [[ $SRS_VALGRIND == YES ]]; then - if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then - echo "Installing valgrind-devel." - require_sudoer "sudo yum install -y valgrind-devel" - sudo yum install -y valgrind-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The valgrind-devel is installed." - fi - fi - - if [[ $SRS_SRT == YES ]]; then - echo "SRT enable, install depend tools" - tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing tcl." - require_sudoer "sudo yum install -y tcl" - sudo yum install -y tcl; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The tcl is installed." - fi - - cmake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing cmake." - require_sudoer "sudo yum install -y cmake" - sudo yum install -y cmake; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "The cmake is installed." - fi - fi - - pkg-config --version --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Please install pkg-config"; exit -1; - fi - - echo "Tools for Centos are installed." - return 0 -} -# donot prepare tools, for srs-librtmp depends only gcc and g++. -Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for CentOS failed, ret=$ret"; exit $ret; fi - -##################################################################################### -# For OSX, auto install tools by brew -##################################################################################### -function OSX_prepare() { - if [[ $OS_IS_OSX != YES ]]; 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 "The embeded(arm/mips) is invalid for OSX" - return 1 - fi - - # Requires the osx when darwin detected - if [[ $OS_IS_OSX == YES && $SRS_OSX != YES ]]; then - echo "OSX detected, please use: ./configure --osx" - exit 1 - fi - - echo "OSX detected, install tools if needed" - - brew --version >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Please install brew at https://brew.sh/" - exit $ret - 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 - - pkg-config --version >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Please install pkg-config"; exit -1; - fi - - if [[ $SRS_SRT == YES ]]; then - echo "SRT enable, install depend tools" - tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing tcl." - echo "brew install tcl." - brew install tcl; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "install tcl success" - fi - - cmake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then - echo "Installing cmake." - echo "brew install cmake." - brew install cmake; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi - echo "install cmake success" - fi - fi - - echo "OSX install tools success" - return 0 -} -# donot prepare tools, for srs-librtmp depends only gcc and g++. -OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "OSX prepare failed, ret=$ret"; exit $ret; fi - ##################################################################################### # Check OS and CPU architectures. ##################################################################################### @@ -314,13 +35,145 @@ if [[ ! -z $OS_IS_X86_64 ]]; then echo -n ", OS_IS_X86_64: $OS_IS_X86_64"; fi if [[ ! -z $OS_IS_RISCV ]]; then echo -n ", OS_IS_RISCV: $OS_IS_RISCV"; fi echo "" +##################################################################################### +# Check dependency tools. +##################################################################################### +if [[ $SRS_OSX == YES ]]; then + brew --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + echo "Please install brew at https://brew.sh/"; exit $ret; + fi +fi +# Check perl, which is depended by automake for building libopus etc. +perl --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install perl by:" + echo " yum install -y perl" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install perl by:" + echo " apt install -y perl" + else + echo "Please install perl" + fi + exit $ret; +fi +gcc --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install gcc by:" + echo " yum install -y gcc" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install gcc by:" + echo " apt install -y gcc" + else + echo "Please install gcc" + fi + exit $ret; +fi +g++ --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install g++ by:" + echo " yum install -y gcc-c++" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install g++ by:" + echo " apt install -y g++" + else + echo "Please install gcc-c++" + fi + exit $ret; +fi +make --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install make by:" + echo " yum install -y make" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install make by:" + echo " apt install -y make" + else + echo "Please install make" + fi + exit $ret; +fi +patch --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install patch by:" + echo " yum install -y patch" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install patch by:" + echo " apt install -y patch" + else + echo "Please install patch" + fi + exit $ret; +fi +unzip -v >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install unzip by:" + echo " yum install -y unzip" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install unzip by:" + echo " apt install -y unzip" + else + echo "Please install unzip" + fi + exit $ret; +fi +if [[ $SRS_VALGRIND == YES ]]; then + valgrind --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + echo "Please install valgrind"; exit $ret; + fi + if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then + echo "Please install valgrind-dev"; exit $ret; + fi +fi +# Check tclsh, which is depended by SRT. +if [[ $SRS_SRT == YES ]]; then + tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install tclsh by:" + echo " yum install -y tcl" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install tclsh by:" + echo " apt install -y tclsh" + else + echo "Please install tclsh" + fi + exit $ret; + fi + cmake --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install cmake by:" + echo " yum install -y cmake" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install cmake by:" + echo " apt install -y cmake" + else + echo "Please install cmake" + fi + exit $ret; + fi +fi +pkg-config --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + echo "Please install pkg-config"; exit $ret; +fi +which ls >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then + if [[ $OS_IS_CENTOS == YES ]]; then + echo "Please install which by:" + echo " yum install -y which" + elif [[ $OS_IS_UBUNTU == YES ]]; then + echo "Please install which by:" + echo " apt install -y which" + else + echo "Please install which" + fi + exit $ret; +fi + ##################################################################################### # Try to load cache if exists /usr/local/srs-cache ##################################################################################### # Use srs-cache from base image. # See https://github.com/ossrs/dev-docker/blob/ubuntu20-cache/Dockerfile if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/srs/trunk" ]]; then - SOURCE_DIR=$(ls -d /usr/local/srs-cache/srs/trunk/objs/Platform-* 2>/dev/null|head -n 1) + SOURCE_DIR=$(ls -d /usr/local/srs-cache/srs/trunk/objs/Platform-SRS${SRS_MAJOR}-* 2>/dev/null|head -n 1) if [[ -d $SOURCE_DIR ]]; then TARGET_DIR=${SRS_OBJS}/${SRS_PLATFORM} && echo "Build from cache, source=$SOURCE_DIR, target=$TARGET_DIR" && @@ -331,6 +184,44 @@ if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/ fi fi +##################################################################################### +# Check for address sanitizer, see https://github.com/google/sanitizers +##################################################################################### +if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then + echo 'int main() { return 0; }' > ${SRS_OBJS}/test_sanitizer.c && + gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 ${SRS_OBJS}/test_sanitizer.c \ + -o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1; + ret=$?; rm -rf ${SRS_OBJS}/test_sanitizer* + if [[ $ret -ne 0 ]]; then + echo "Please install libasan, see https://github.com/google/sanitizers"; + if [[ $OS_IS_CENTOS == YES ]]; then echo " sudo yum install -y libasan"; fi + exit $ret; + fi +fi + +if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES && $SRS_SANITIZER_STATIC == NO ]]; then + echo 'int main() { return 0; }' > ${SRS_OBJS}/test_sanitizer.c && + gcc -fsanitize=address -fno-omit-frame-pointer -static-libasan -g -O0 ${SRS_OBJS}/test_sanitizer.c \ + -o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1; + ret=$?; rm -rf ${SRS_OBJS}/test_sanitizer* + if [[ $ret -eq 0 ]]; then + echo "link static-libasan" + SRS_SANITIZER_STATIC=YES + fi +fi + +if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES && $SRS_SANITIZER_LOG == NO ]]; then + echo "#include " > ${SRS_OBJS}/test_sanitizer.c && + echo "int main() { return 0; }" >> ${SRS_OBJS}/test_sanitizer.c && + gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 ${SRS_OBJS}/test_sanitizer.c \ + -o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1; + ret=$?; rm -rf ${SRS_OBJS}/test_sanitizer* + if [[ $ret -eq 0 ]]; then + echo "libasan api found ok!"; + SRS_SANITIZER_LOG=YES + fi +fi + ##################################################################################### # state-threads ##################################################################################### @@ -537,7 +428,7 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then #OPENSSL_OPTIONS="-no-shared -no-threads" OPENSSL_CONFIG="./Configure -w" OPENSSL_AR="$SRS_TOOL_AR" - OPENSSL_CANDIDATE="openssl-openssl-3.0.7" && OPENSSL_UNZIP="tar xf ../../../tools/extras/$OPENSSL_CANDIDATE.tar.gz" + OPENSSL_CANDIDATE="openssl-openssl-3.0.7" && OPENSSL_UNZIP="tar xf ${SRS_WORKDIR}/../tools/extras/$OPENSSL_CANDIDATE.tar.gz -C ${SRS_OBJS}/${SRS_PLATFORM}/" fi # @@ -558,11 +449,13 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then ${SRS_OBJS}/openssl && ${OPENSSL_UNZIP} && ( - rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_CANDIDATE} && cd ${SRS_OBJS}/${SRS_PLATFORM} && - ${OPENSSL_UNZIP} && cd $OPENSSL_CANDIDATE && ${OPENSSL_CONFIG} --prefix=`pwd`/_release $OPENSSL_OPTIONS && - make CC=${SRS_TOOL_CC} AR="${OPENSSL_AR}" LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} ${SRS_JOBS} && make install_sw && - cd .. && rm -rf openssl && ln -sf $OPENSSL_CANDIDATE/_release openssl + cd ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_CANDIDATE} && + ${OPENSSL_CONFIG} --prefix=`pwd`/_release $OPENSSL_OPTIONS ) + make -C ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_CANDIDATE} CC=${SRS_TOOL_CC} AR="${OPENSSL_AR}" \ + LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} ${SRS_JOBS} && + make -C ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_CANDIDATE} install_sw && + echo "The $OPENSSL_CANDIDATE is ok." fi # yum install perl-IPC-Cmd perl-Data-Dumper @@ -572,6 +465,9 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then ln -s ${OPENSSL_RELEASE}/lib64 ${OPENSSL_RELEASE}/lib fi + cp -rf ${OPENSSL_RELEASE} ${SRS_OBJS}/${SRS_PLATFORM}/3rdpatry/openssl && + cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdpatry/openssl ${SRS_OBJS}/ + # Which lib we use. OPENSSL_LIB="$OPENSSL_CANDIDATE/_release" if [[ ! -f ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_LIB}/lib/libssl.a ]]; then diff --git a/trunk/auto/modules.sh b/trunk/auto/modules.sh index 6fab725a547..ab25a42b4df 100755 --- a/trunk/auto/modules.sh +++ b/trunk/auto/modules.sh @@ -78,7 +78,7 @@ MODULE_OBJS=() for item in ${MODULE_FILES[*]}; do CPP_FILE="${MODULE_DIR}/${item}.cpp" if [[ ! -f ${CPP_FILE} ]]; then CPP_FILE="${MODULE_DIR}/${item}.cc"; fi - OBJ_FILE="${SRS_OBJS_DIR}/${MODULE_DIR}/${item}.o" + OBJ_FILE="${SRS_OBJS}/${MODULE_DIR}/${item}.o" OBJ_DIR=$(dirname ${OBJ_FILE}) if [[ ! -d ${OBJ_DIR} ]]; then mkdir -p ${OBJ_DIR}; fi MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}" @@ -94,7 +94,7 @@ for item in ${MODULE_FILES[*]}; do C_FILE="${MODULE_DIR}/${item}.c" if [[ ! -f ${C_FILE} ]]; then C_FILE="${MODULE_DIR}/${item}.C"; fi - OBJ_FILE="${SRS_OBJS_DIR}/${MODULE_DIR}/${item}.o" + OBJ_FILE="${SRS_OBJS}/${MODULE_DIR}/${item}.o" OBJ_DIR=$(dirname ${OBJ_FILE}) if [[ ! -d ${OBJ_DIR} ]]; then mkdir -p ${OBJ_DIR}; fi MODULE_OBJS="${MODULE_OBJS[@]} ${C_FILE}" diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 58f88a362db..3f0e0d35502 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -7,6 +7,8 @@ SRS_HDS=NO SRS_SRT=YES SRS_RTC=YES SRS_OPTIMIZE= # -o +SRS_H265=NO +SRS_GB28181=NO SRS_CXX11=YES SRS_CXX14=NO SRS_BACKTRACE=YES @@ -37,10 +39,14 @@ SRS_FFMPEG_STUB=NO SRS_FFMPEG_TOOL=NO # FFmpeg fit is the source code for RTC, to transcode audio or video in SRS. SRS_FFMPEG_FIT=RESERVED +# Whether use FFmpeg native opus codec for RTC. If not, use libopus instead. +SRS_FFMPEG_OPUS=NO # arguments SRS_PREFIX=/usr/local/srs SRS_DEFAULT_CONFIG=conf/srs.conf SRS_JOBS=1 +# If enabled, force to use SRS_JOBS for make on linux, however you're able to overwrite by -jN on macOS. +SRS_FORCE_MAKE_JOBS=YES SRS_STATIC=NO # If enabled, link shared libraries for libst.so which uses MPL license. # See https://ossrs.net/lts/zh-cn/license#state-threads @@ -53,6 +59,8 @@ SRS_SHARED_SRT=NO SRS_SHARED_FFMPEG=NO # whether enable the gcov SRS_GCOV=NO +# Whether enable cloud logging and APM(Application Performance Monitor). +SRS_APM=NO # whether enable the log verbose/info/trace level. # always enable the warn/error level. SRS_LOG_VERBOSE=NO @@ -65,8 +73,9 @@ SRS_LOG_LEVEL_V2=YES # Experts options. SRS_USE_SYS_SSL=NO # Use system ssl(-lssl) if required. SRS_VALGRIND=NO -SRS_SANITIZER=YES +SRS_SANITIZER=NO SRS_SANITIZER_STATIC=NO +SRS_SANITIZER_LOG=NO SRS_BUILD_TAG= # Set the object files tag name. SRS_CLEAN=YES # Whether do "make clean" when configure. SRS_SIMULATOR=NO # Whether enable RTC simulate API. @@ -111,41 +120,62 @@ SRS_DEBUG=NO SRS_DEBUG_STATS=NO ##################################################################################### -# menu +function apply_system_options() { + OS_IS_OSX=$(uname -s |grep -q Darwin && echo YES) + OS_IS_LINUX=$(uname -s |grep -q Linux && echo YES) + OS_IS_CYGWIN=$(uname -s |grep -q CYGWIN && echo YES) + + OS_IS_CENTOS=$(yum --version >/dev/null 2>&1 && echo YES) + # For Debian, we think it's ubuntu also. + # For example, the wheezy/sid which is debian armv7 linux, can not identified by uname -v. + OS_IS_UBUNTU=$(apt-get --version >/dev/null 2>&1 && echo YES) + OS_IS_LOONGSON=$(uname -r |grep -q loongson && echo YES) + + # Use gcc to detect the CPU arch. + gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "Please install gcc"; exit 1; fi + OS_IS_LOONGARCH64=$(gcc -dM -E - /dev/null || echo 1); fi + if [[ $OS_IS_LINUX == YES || $OS_IS_CYGWIN == YES ]]; then + SRS_JOBS=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1) + fi +} +apply_system_options + +##################################################################################### +# Show help menu. ##################################################################################### function show_help() { cat << END -Presets: - --cross-build Enable cross-build, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD) - --osx Enable build for OSX/Darwin AppleOS. Default: $(value2switch $SRS_OSX) - -Features: +Configure to generate Makefile. -h, --help Print this message and exit 0. +Features: --https=on|off Whether enable HTTPS client and server. Default: $(value2switch $SRS_HTTPS) - --hds=on|off Whether build the hds streaming, mux RTMP to F4M/F4V files. Default: $(value2switch $SRS_HDS) - --cherrypy=on|off Whether install CherryPy for demo api-server. Default: $(value2switch $SRS_CHERRYPY) --utest=on|off Whether build the utest. Default: $(value2switch $SRS_UTEST) --srt=on|off Whether build the SRT. Default: $(value2switch $SRS_SRT) --rtc=on|off Whether build the WebRTC. Default: $(value2switch $SRS_RTC) + --gb28181=on|off Whether build the GB28181. Default: $(value2switch $SRS_GB28181) --cxx11=on|off Whether enable the C++11. Default: $(value2switch $SRS_CXX11) --cxx14=on|off Whether enable the C++14. Default: $(value2switch $SRS_CXX14) - --backtrace=on|off Whether show backtrace when crashing. Default: $(value2switch $SRS_BACKTRACE) --ffmpeg-fit=on|off Whether enable the FFmpeg fit(source code). Default: $(value2switch $SRS_FFMPEG_FIT) + --ffmpeg-opus=on|off Whether enable the FFmpeg native opus codec. Default: $(value2switch $SRS_FFMPEG_OPUS) + --apm=on|off Whether enable cloud logging and APM(Application Performance Monitor). Default: $(value2switch $SRS_APM) + --h265=on|off Whether build the HEVC(H.265) support. Default: $(value2switch $SRS_H265) --prefix= The absolute installation path. Default: $SRS_PREFIX - --config= The default config file for SRS. Default: $SRS_DEFAULT_CONFIG - --gcov=on|off Whether enable the GCOV compiler options. Default: $(value2switch $SRS_GCOV) - --debug=on|off Whether enable the debug code, may hurt performance. Default: $(value2switch $SRS_DEBUG) - --debug-stats=on|off Whether enable the debug stats, may hurt performance. Default: $(value2switch $SRS_DEBUG_STATS) --jobs[=N] Allow N jobs at once; infinite jobs with no arg. Default: $SRS_JOBS - --log-verbose=on|off Whether enable the log verbose level. Default: $(value2switch $SRS_LOG_VERBOSE) - --log-info=on|off Whether enable the log info level. Default: $(value2switch $SRS_LOG_INFO) - --log-trace=on|off Whether enable the log trace level. Default: $(value2switch $SRS_LOG_TRACE) - --log-level_v2=on|off Whether use v2.0 log level definition, see log4j specs. Default: $(value2switch $SRS_LOG_LEVEL_V2) + --config= The default config file for SRS. Default: $SRS_DEFAULT_CONFIG -Performance: @see https://blog.csdn.net/win_lin/article/details/53503869 +Performance: @see https://ossrs.net/lts/zh-cn/docs/v5/doc/performance --valgrind=on|off Whether build valgrind for memory check. Default: $(value2switch $SRS_VALGRIND) --gperf=on|off Whether build SRS with gperf tools(no gmd/gmc/gmp/gcp, with tcmalloc only). Default: $(value2switch $SRS_GPERF) --gmc=on|off Whether build memory check with gperf tools. Default: $(value2switch $SRS_GPERF_MC) @@ -153,9 +183,9 @@ Performance: @see https://blog.csdn.net/win_lin/article/details/5 --gmp=on|off Whether build memory profile with gperf tools. Default: $(value2switch $SRS_GPERF_MP) --gcp=on|off Whether build cpu profile with gperf tools. Default: $(value2switch $SRS_GPERF_CP) --gprof=on|off Whether build SRS with gprof(GNU profile tool). Default: $(value2switch $SRS_GPROF) - --sanitizer=on|off Whether build SRS with address sanitizer. Default: $(value2switch $SRS_SANITIZER) - --sanitizer-static=on|off Whether build SRS with static libasan. Default: $(value2switch $SRS_SANITIZER_STATIC) - + --sanitizer=on|off Whether build SRS with address sanitizer(asan). Default: $(value2switch $SRS_SANITIZER) + --sanitizer-static=on|off Whether build SRS with static libasan(asan). Default: $(value2switch $SRS_SANITIZER_STATIC) + --sanitizer-log=on|off Whether hijack the log for libasan(asan). Default: $(value2switch $SRS_SANITIZER_LOG) --nasm=on|off Whether build FFMPEG for RTC with nasm. Default: $(value2switch $SRS_NASM) --srtp-nasm=on|off Whether build SRTP with ASM(openssl-asm), requires RTC and openssl-1.0.*. Default: $(value2switch $SRS_SRTP_ASM) @@ -169,6 +199,7 @@ Toolchain options: --extra-flags= Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS. Cross Build options: @see https://ossrs.net/lts/zh-cn/docs/v4/doc/arm#ubuntu-cross-build-srs + --cross-build Enable cross-build, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD) --cpu= Toolchain: Select the minimum required CPU for cross-build. For example: --cpu=24kc --arch= Toolchain: Select architecture for cross-build. For example: --arch=aarch64 --host= Toolchain: Cross-compile to build programs to run on HOST. For example: --host=aarch64-linux-gnu @@ -185,18 +216,33 @@ Experts: --simulator=on|off RTC: Whether enable network simulator. Default: $(value2switch $SRS_SIMULATOR) --generate-objs=on|off RTC: Whether generate objs and quit. Default: $(value2switch $SRS_GENERATE_OBJS) --build-tag= Set the build object directory suffix. + --debug=on|off Whether enable the debug code, may hurt performance. Default: $(value2switch $SRS_DEBUG) + --debug-stats=on|off Whether enable the debug stats, may hurt performance. Default: $(value2switch $SRS_DEBUG_STATS) + --gcov=on|off Whether enable the GCOV for coverage. Default: $(value2switch $SRS_GCOV) + --log-verbose=on|off Whether enable the log verbose level. Default: $(value2switch $SRS_LOG_VERBOSE) + --log-info=on|off Whether enable the log info level. Default: $(value2switch $SRS_LOG_INFO) + --log-trace=on|off Whether enable the log trace level. Default: $(value2switch $SRS_LOG_TRACE) + --log-level_v2=on|off Whether use v2.0 log level definition, see log4j specs. Default: $(value2switch $SRS_LOG_LEVEL_V2) + --backtrace=on|off Whether show backtrace when crashing. Default: $(value2switch $SRS_BACKTRACE) -Workflow: - 1. Apply "Presets". if not specified, use default preset. - 2. Apply "Features", "Performance" and others. user specified option will override the preset. - 3. Check configs and generate Makefile. - -Remark: - 1. For performance, read https://blog.csdn.net/win_lin/article/details/53503869 - +Deprecated: + --hds=on|off Whether build the hds streaming, mux RTMP to F4M/F4V files. Default: $(value2switch $SRS_HDS) + --cherrypy=on|off Whether install CherryPy for demo api-server. Default: $(value2switch $SRS_CHERRYPY) + --osx Enable build for OSX/Darwin AppleOS. Deprecated for automatically detecting the OS. + --x86-64 Enable build for __x86_64 systems. Deprecated for automatically detecting the OS. + --x86-x64 Enable build for __x86_64 systems. Deprecated for automatically detecting the OS. + --cygwin64 Use cygwin64 to build for Windows. Deprecated for automatically detecting the OS. + --nginx Build nginx tool. Deprecated for not depends on it. + --ffmpeg Build FFmpeg tool. Deprecated for not build it, user should do it. + +For example: + ./configure END } +##################################################################################### +# Parse user options +##################################################################################### function parse_user_option() { # Ignore the options. if [[ $option == '--demo' || $option == '--dev' || $option == '--fast-dev' || $option == '--pi' @@ -230,10 +276,11 @@ function parse_user_option() { # Parse options to variables. case "$option" in - -h) help=yes ;; - --help) help=yes ;; + -h) help=YES ;; + --help) help=YES ;; --jobs) SRS_JOBS=${value} ;; + --force-make-jobs) SRS_FORCE_MAKE_JOBS=${value} ;; --prefix) SRS_PREFIX=${value} ;; --config) SRS_DEFAULT_CONFIG=${value} ;; @@ -250,8 +297,6 @@ function parse_user_option() { --extra-flags) SRS_EXTRA_FLAGS=${value} ;; --build-tag) SRS_BUILD_TAG=${value} ;; - --osx) SRS_OSX=YES ;; - --without-srtp-nasm) SRS_SRTP_ASM=NO ;; --with-srtp-nasm) SRS_SRTP_ASM=YES ;; --srtp-nasm) SRS_SRTP_ASM=$(switch2value $value) ;; @@ -282,12 +327,14 @@ function parse_user_option() { --with-stream-caster) SRS_STREAM_CASTER=YES ;; --stream-caster) SRS_STREAM_CASTER=$(switch2value $value) ;; + --stream-converter) SRS_STREAM_CASTER=$(switch2value $value) ;; --with-utest) SRS_UTEST=YES ;; --without-utest) SRS_UTEST=NO ;; --utest) SRS_UTEST=$(switch2value $value) ;; --cherrypy) SRS_CHERRYPY=$(switch2value $value) ;; --gcov) SRS_GCOV=$(switch2value $value) ;; + --apm) SRS_APM=$(switch2value $value) ;; --with-srt) SRS_SRT=YES ;; --without-srt) SRS_SRT=NO ;; @@ -300,6 +347,9 @@ function parse_user_option() { --simulator) SRS_SIMULATOR=$(switch2value $value) ;; --generate-objs) SRS_GENERATE_OBJS=$(switch2value $value) ;; --ffmpeg-fit) SRS_FFMPEG_FIT=$(switch2value $value) ;; + --ffmpeg-opus) SRS_FFMPEG_OPUS=$(switch2value $value) ;; + --h265) SRS_H265=$(switch2value $value) ;; + --gb28181) SRS_GB28181=$(switch2value $value) ;; --cxx11) SRS_CXX11=$(switch2value $value) ;; --cxx14) SRS_CXX14=$(switch2value $value) ;; @@ -335,6 +385,7 @@ function parse_user_option() { --sanitizer) SRS_SANITIZER=$(switch2value $value) ;; --sanitizer-static) SRS_SANITIZER_STATIC=$(switch2value $value) ;; + --sanitizer-log) SRS_SANITIZER_LOG=$(switch2value $value) ;; --use-sys-ssl) SRS_USE_SYS_SSL=YES ;; --sys-ssl) SRS_USE_SYS_SSL=$(switch2value $value) ;; @@ -361,6 +412,8 @@ function parse_user_option() { --enable-cross-compile) SRS_CROSS_BUILD=YES ;; # Deprecated, might be removed in future. + --osx) SRS_OSX=YES ;; + --cygwin64) SRS_CYGWIN64=YES ;; --x86-x64) SRS_X86_X64=YES ;; --x86-64) SRS_X86_X64=YES ;; --with-nginx) SRS_NGINX=YES ;; @@ -408,35 +461,6 @@ function switch2value() { fi } -##################################################################################### -function apply_system_options() { - OS_IS_OSX=$(uname -s |grep -q Darwin && echo YES) - OS_IS_LINUX=$(uname -s |grep -q Linux && echo YES) - OS_IS_CYGWIN=$(uname -s |grep -q CYGWIN && echo YES) - - OS_IS_CENTOS=$(yum --version >/dev/null 2>&1 && echo YES) - # For Debian, we think it's ubuntu also. - # For example, the wheezy/sid which is debian armv7 linux, can not identified by uname -v. - OS_IS_UBUNTU=$(apt-get --version >/dev/null 2>&1 && echo YES) - OS_IS_LOONGSON=$(uname -r |grep -q loongson && echo YES) - - # Use gcc to detect the CPU arch. - gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "Please install gcc"; exit 1; fi - OS_IS_LOONGARCH64=$(gcc -dM -E - /dev/null || echo 1); fi - if [[ $OS_IS_LINUX == YES || $OS_IS_CYGWIN == YES ]]; then - SRS_JOBS=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1) - fi -} -apply_system_options - -##################################################################################### -# parse preset options -##################################################################################### opt= for option @@ -446,6 +470,9 @@ do parse_user_option done +##################################################################################### +# Apply auto options +##################################################################################### function apply_auto_options() { if [[ $SRS_CROSS_BUILD == YES ]]; then if [[ $SRS_CROSS_BUILD_PREFIX != "" && $SRS_CROSS_BUILD_HOST == "" ]]; then @@ -478,6 +505,17 @@ function apply_auto_options() { if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then SRS_FFMPEG_FIT=YES fi + if [[ $SRS_CROSS_BUILD == YES && $SRS_FFMPEG_OPUS != YES ]]; then + echo "Enable FFmpeg native opus for cross building" + SRS_FFMPEG_OPUS=YES + fi + + # Enable asan, but disable for Centos + # @see https://github.com/ossrs/srs/issues/3347 + if [[ $SRS_SANITIZER == NO && $OS_IS_CENTOS != YES ]]; then + echo "Enable asan by auto options." + SRS_SANITIZER=YES + fi # If enable gperf, disable sanitizer. if [[ $SRS_GPERF == YES && $SRS_SANITIZER == YES ]]; then @@ -505,47 +543,42 @@ function apply_auto_options() { export SRS_JOBS="--jobs=${SRS_JOBS}" fi } +apply_auto_options if [[ $help == YES ]]; then - apply_auto_options show_help exit 0 fi ##################################################################################### -# apply options +# Apply detail options ##################################################################################### - function apply_detail_options() { # Always enable HTTP utilies. - if [ $SRS_HTTP_CORE = NO ]; then SRS_HTTP_CORE=YES; echo -e "${YELLOW}[WARN] Always enable HTTP utilies.${BLACK}"; fi - if [ $SRS_STREAM_CASTER = NO ]; then SRS_STREAM_CASTER=YES; echo -e "${YELLOW}[WARN] Always enable StreamCaster.${BLACK}"; fi - if [ $SRS_INGEST = NO ]; then SRS_INGEST=YES; echo -e "${YELLOW}[WARN] Always enable Ingest.${BLACK}"; fi - if [ $SRS_SSL = NO ]; then SRS_SSL=YES; echo -e "${YELLOW}[WARN] Always enable SSL.${BLACK}"; fi - if [ $SRS_STAT = NO ]; then SRS_STAT=YES; echo -e "${YELLOW}[WARN] Always enable Statistic.${BLACK}"; fi - if [ $SRS_TRANSCODE = NO ]; then SRS_TRANSCODE=YES; echo -e "${YELLOW}[WARN] Always enable Transcode.${BLACK}"; fi - 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 - if [ $SRS_DVR = NO ]; then SRS_DVR=YES; echo -e "${YELLOW}[WARN] Always enable DVR.${BLACK}"; fi - - # parse the jobs for make - if [[ "" -eq SRS_JOBS ]]; then - export SRS_JOBS="--jobs=1" - else - export SRS_JOBS="--jobs=${SRS_JOBS}" - fi + if [[ $SRS_HTTP_CORE == NO ]]; then SRS_HTTP_CORE=YES; echo -e "${YELLOW}[WARN] Always enable HTTP utilies.${BLACK}"; fi + if [[ $SRS_STREAM_CASTER == NO ]]; then SRS_STREAM_CASTER=YES; echo -e "${YELLOW}[WARN] Always enable StreamConverter.${BLACK}"; fi + if [[ $SRS_INGEST == NO ]]; then SRS_INGEST=YES; echo -e "${YELLOW}[WARN] Always enable Ingest.${BLACK}"; fi + if [[ $SRS_SSL == NO ]]; then SRS_SSL=YES; echo -e "${YELLOW}[WARN] Always enable SSL.${BLACK}"; fi + if [[ $SRS_STAT == NO ]]; then SRS_STAT=YES; echo -e "${YELLOW}[WARN] Always enable Statistic.${BLACK}"; fi + if [[ $SRS_TRANSCODE == NO ]]; then SRS_TRANSCODE=YES; echo -e "${YELLOW}[WARN] Always enable Transcode.${BLACK}"; fi + 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 + if [[ $SRS_DVR == NO ]]; then SRS_DVR=YES; echo -e "${YELLOW}[WARN] Always enable DVR.${BLACK}"; fi } -apply_auto_options apply_detail_options +##################################################################################### +# Regenerate options for tracing. +##################################################################################### function regenerate_options() { # save all config options to macro to write to auto headers file SRS_AUTO_USER_CONFIGURE=`echo $opt` # regenerate the options for default values. SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --config=$SRS_DEFAULT_CONFIG" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --osx=$(value2switch $SRS_OSX)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --hls=$(value2switch $SRS_HLS)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --hds=$(value2switch $SRS_HDS)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --dvr=$(value2switch $SRS_DVR)" @@ -560,17 +593,20 @@ function regenerate_options() { SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --stat=$(value2switch $SRS_STAT)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --http-callback=$(value2switch $SRS_HTTP_CALLBACK)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --http-server=$(value2switch $SRS_HTTP_SERVER)" - SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --stream-caster=$(value2switch $SRS_STREAM_CASTER)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --stream-converter=$(value2switch $SRS_STREAM_CASTER)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --http-api=$(value2switch $SRS_HTTP_API)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --utest=$(value2switch $SRS_UTEST)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cherrypy=$(value2switch $SRS_CHERRYPY)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srt=$(value2switch $SRS_SRT)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=$(value2switch $SRS_RTC)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --h265=$(value2switch $SRS_H265)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=$(value2switch $SRS_GB28181)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=$(value2switch $SRS_SIMULATOR)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=$(value2switch $SRS_CXX11)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=$(value2switch $SRS_CXX14)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --backtrace=$(value2switch $SRS_BACKTRACE)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ffmpeg-fit=$(value2switch $SRS_FFMPEG_FIT)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ffmpeg-opus=$(value2switch $SRS_FFMPEG_OPUS)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=$(value2switch $SRS_NASM)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=$(value2switch $SRS_SRTP_ASM)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --clean=$(value2switch $SRS_CLEAN)" @@ -589,6 +625,7 @@ function regenerate_options() { SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace=$(value2switch $SRS_LOG_TRACE)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-level_v2=$(value2switch $SRS_LOG_LEVEL_V2)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcov=$(value2switch $SRS_GCOV)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --apm=$(value2switch $SRS_APM)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --debug=$(value2switch $SRS_DEBUG)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --debug-stats=$(value2switch $SRS_DEBUG_STATS)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cross-build=$(value2switch $SRS_CROSS_BUILD)" @@ -610,7 +647,7 @@ function regenerate_options() { regenerate_options ##################################################################################### -# check user options +# Check conflicted options ##################################################################################### function check_option_conflicts() { if [[ $SRS_TOOL_CC == '' || $SRS_TOOL_CXX == '' || $SRS_TOOL_AR == '' || $SRS_TOOL_LD == '' || $SRS_TOOL_RANDLIB == '' ]]; then @@ -653,16 +690,16 @@ function check_option_conflicts() { fi fi # check variable neccessary - if [ $SRS_HDS = RESERVED ]; then echo "you must specifies the hds, see: ./configure --help"; __check_ok=NO; fi - if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi - if [ $SRS_STREAM_CASTER = RESERVED ]; then echo "you must specifies the stream-caster, 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 - if [ $SRS_GPERF_MD = RESERVED ]; then echo "you must specifies the gperf-md, 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 [ $SRS_GPROF = RESERVED ]; then echo "you must specifies the gprof, see: ./configure --help"; __check_ok=NO; fi + if [[ $SRS_HDS == RESERVED ]]; then echo "you must specifies the hds, see: ./configure --help"; __check_ok=NO; fi + if [[ $SRS_SSL == RESERVED ]]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi + if [[ $SRS_STREAM_CASTER == RESERVED ]]; then echo "you must specifies the stream-converter, 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 + if [[ $SRS_GPERF_MD == RESERVED ]]; then echo "you must specifies the gperf-md, 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 [[ $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; diff --git a/trunk/auto/summary.sh b/trunk/auto/summary.sh index 0170eb9a7b6..6a27fb18b31 100755 --- a/trunk/auto/summary.sh +++ b/trunk/auto/summary.sh @@ -45,7 +45,7 @@ echo -e " | ${SrsIngestSummaryColor}About ingester, please read https:// echo -e " | ${SrsHttpCallbackSummaryColor}About http-callback, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/http-callback\${BLACK}" echo -e " | ${SrsHttpServerSummaryColor}Aoubt http-server, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/http-server\${BLACK}" echo -e " | ${SrsHttpApiSummaryColor}About http-api, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/http-api\${BLACK}" -echo -e " | ${SrsStreamCasterSummaryColor}About stream-caster, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/streamer\${BLACK}" +echo -e " | ${SrsStreamConverterSummaryColor}About stream-caster, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/streamer\${BLACK}" echo -e " | ${SrsValgrindSummaryColor}About VALGRIND, please read https://github.com/ossrs/state-threads/issues/2\${BLACK}" echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" echo -e "\${GREEN}binaries, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/install\${BLACK}" diff --git a/trunk/configure b/trunk/configure index 58f54c0bab5..ede19a2b190 100755 --- a/trunk/configure +++ b/trunk/configure @@ -502,15 +502,22 @@ SRS_PREFIX=${SRS_PREFIX} SRS_DEFAULT_CONFIG=${SRS_DEFAULT_CONFIG} __REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX) -JOBS=\$(shell echo \$(MAKEFLAGS)| grep -qE '\-j[0-9]+' || echo " ${SRS_JOBS}") -default: server - -all: _default +SRS_FORCE_MAKE_JOBS=${SRS_FORCE_MAKE_JOBS} +END +if [[ $SRS_FORCE_MAKE_JOBS == YES ]]; then + cat << END >> ${SRS_MAKEFILE} +JOBS=\$(shell echo \$(MAKEFLAGS)| grep -qE '\-j[0-9]+' || echo " ${SRS_JOBS}") END +fi # the real entry for all platform: cat << END >> ${SRS_MAKEFILE} + +default: server + +all: _default + _default: server srs_ingest_hls utest $__mdefaults help: @@ -587,13 +594,15 @@ ffmpeg: END +# Generate Makefile entry for srs-server. cat << END >> ${SRS_MAKEFILE} server: _prepare_dir - @echo "Build the SRS server" + @echo "Build the SRS server, JOBS=\${JOBS}, FORCE_MAKE_JOBS=${SRS_FORCE_MAKE_JOBS}" \$(MAKE)\$(JOBS) -f ${SRS_OBJS}/Makefile srs @bash objs/_srs_build_summary.sh END + # generate all modules entry for SRS_MODULE in ${SRS_MODULES[*]}; do . $SRS_WORKDIR/auto/reset_module.sh && . $SRS_MODULE/config @@ -692,13 +701,23 @@ fi if [[ $SRS_STREAM_CASTER == YES ]]; then echo -e "${YELLOW}Experiment: StreamConverter is enabled.${BLACK}" else - echo -e "${GREEN}Note: StreamCaster is disabled.${BLACK}" + echo -e "${GREEN}Note: StreamConverter is disabled.${BLACK}" fi if [[ $SRS_HDS == YES ]]; then echo -e "${YELLOW}Experiment: HDS is enabled.${BLACK}" else echo -e "${GREEN}Warning: HDS is disabled.${BLACK}" fi +if [[ $SRS_GB28181 == YES ]]; then + echo -e "${YELLOW}Experiment: GB28181 is enabled. https://github.com/ossrs/srs/issues/3176${BLACK}" +else + echo -e "${GREEN}Warning: GB28181 is disabled.${BLACK}" +fi +if [[ $SRS_H265 == YES ]]; then + echo -e "${YELLOW}Experiment: HEVC/H.265 is enabled. https://github.com/ossrs/srs/issues/465${BLACK}" +else + echo -e "${GREEN}Warning: HEVC/H.265 is disabled.${BLACK}" +fi if [[ $SRS_SRT == YES ]]; then echo -e "${YELLOW}Experiment: SRT is enabled. https://github.com/ossrs/srs/issues/1147${BLACK}" else diff --git a/trunk/scripts/package.sh b/trunk/scripts/package.sh index 7e3c19ed90b..436165cf896 100755 --- a/trunk/scripts/package.sh +++ b/trunk/scripts/package.sh @@ -19,6 +19,8 @@ EMBEDED=NO JOBS=1 # SRS_TAG= +# +OPTIONS= ################################################################################## ################################################################################## @@ -47,8 +49,8 @@ do --tag) SRS_TAG=$value ;; *) - echo "$0: error: invalid option \"$option\", @see $0 --help" - exit 1 + OPTIONS="${OPTIONS} ${option}=${value}" + echo "Apply option ${option}=${value}" ;; esac done @@ -125,22 +127,22 @@ ok_msg "start build srs, ARM: $ARM, MIPS: $MIPS, PI: $PI, X86_64: $X86_X64, JOBS if [ $ARM = YES ]; then ( cd $work_dir && - ./configure --arm --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} && make + ./configure --arm --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} ${OPTIONS} && make ) >> $log 2>&1 elif [ $MIPS = YES ]; then ( cd $work_dir && - ./configure --mips --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} && make + ./configure --mips --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} ${OPTIONS} && make ) >> $log 2>&1 elif [ $PI = YES ]; then ( cd $work_dir && - ./configure --pi --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} && make + ./configure --pi --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} ${OPTIONS} && make ) >> $log 2>&1 elif [ $X86_X64 = YES ]; then ( cd $work_dir && - ./configure --x86-x64 --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} && make + ./configure --x86-x64 --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} ${OPTIONS} && make ) >> $log 2>&1 else failed_msg "invalid option, must be --x86-x64/--arm/--mips/--pi, see --help"; exit 1;