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

SRT: Build SRT from source by SRS. 4.0.115

This commit is contained in:
hondaxiao 2021-05-15 19:18:39 +08:00 committed by winlin
parent 262f0fc8c8
commit 90f1b482ab
115 changed files with 44513 additions and 19 deletions

View file

@ -102,6 +102,23 @@ function Ubuntu_prepare()
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"
@ -181,6 +198,23 @@ function Centos_prepare()
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
@ -278,6 +312,23 @@ function OSX_prepare()
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."
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
}
@ -689,16 +740,34 @@ fi
# SRT module, https://github.com/ossrs/srs/issues/1147#issuecomment-577469119
#####################################################################################
if [[ $SRS_SRT == YES ]]; then
if [[ -f /usr/local/lib64/libsrt.a && ! -f ${SRS_OBJS}/srt/lib/libsrt.a ]]; then
mkdir -p ${SRS_OBJS}/srt/lib && ln -sf /usr/local/lib64/libsrt.a ${SRS_OBJS}/srt/lib/libsrt.a
mkdir -p ${SRS_OBJS}/srt/include && ln -sf /usr/local/include/srt ${SRS_OBJS}/srt/include/
fi
if [[ -f ${SRS_OBJS}/srt/lib/libsrt.a ]]; then
echo "libsrt-1.4.1 is ok.";
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/srt/lib/libsrt.a ]]; then
echo "libsrt-1-fit is ok.";
else
echo "no libsrt, please run in docker ossrs/srs:srt or build from source https://github.com/ossrs/srs/issues/1147#issuecomment-577469119";
exit -1;
echo "Build srt-1-fit"
(
if [[ ! -d ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib/pkgconfig ]]; then
echo "OpenSSL pkgconfig no found, build srt-1-fit failed.";
exit -1;
fi
# Always disable c++11 for libsrt, because only the srt-app requres it.
LIBSRT_OPTIONS="--disable-app --enable-shared=0 --enable-static --enable-c++11=0"
# Start build libsrt.
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/srt-1-fit && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
cp -R ../../3rdparty/srt-1-fit srt-1-fit && cd srt-1-fit &&
PKG_CONFIG_PATH=../openssl/lib/pkgconfig ./configure --prefix=`pwd`/_release $LIBSRT_OPTIONS &&
make ${SRS_JOBS} && make install &&
cd .. && rm -rf srt && ln -sf srt-1-fit/_release srt &&
# If exists lib64 of libsrt, link it to lib
if [[ -d srt/lib64 ]]; then
cd srt && ln -sf lib64 lib
fi
)
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build srt-1-fit failed, ret=$ret"; exit $ret; fi
fi
# Always update the links.
(cd ${SRS_OBJS}/${SRS_PLATFORM} && rm -rf srt && ln -sf srt-1-fit/_release srt)
(cd ${SRS_OBJS} && rm -rf srt && ln -sf ${SRS_PLATFORM}/srt-1-fit/_release srt)
if [ ! -f ${SRS_OBJS}/srt/lib/libsrt.a ]; then echo "Build srt-1-fit failed."; exit -1; fi
fi
#####################################################################################

View file

@ -447,12 +447,13 @@ function apply_detail_options() {
SRS_X86_X64=YES; opt="--x86-x64 $opt";
fi
# Enable c++11 for SRT.
# The SRT code in SRS requires c++11, although we build libsrt without c++11.
# TODO: FIXME: Remove c++11 code in SRT of SRS.
if [[ $SRS_SRT == YES ]]; then
SRS_CXX11=YES
fi
# Enable FFmpeg fit for RTC to trancode audio from AAC to OPUS, if user has't disabled it.
# Enable FFmpeg fit for RTC to transcode audio from AAC to OPUS, if user enabled it.
if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then
SRS_FFMPEG_FIT=YES
fi