@ -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,19 +199,124 @@ 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
}
SED = "sed_utility" && echo " SED is $SED "
function _srs_link_file( )
{
tmp_dir = $1 ; if [ [ $tmp_dir != *'/' ] ] ; then tmp_dir += '/' ; fi
tmp_dest = $2 ; if [ [ $tmp_dest != *'/' ] ] ; then tmp_dest += '/' ; fi
tmp_prefix = $3 ; if [ [ $tmp_prefix != *'/' ] ] ; then tmp_prefix += '/' ; fi
echo " LINK files at dir: $tmp_dir , dest: $tmp_dest , prefix: $tmp_prefix , pwd: `pwd` "
for file in ` ( cd $tmp_dir && find . -maxdepth 1 -type f ! -name '*.o' ! -name '*.d' ! -name '*.log' ) ` ; do
basefile = ` basename $file ` &&
#echo "ln -sf ${tmp_prefix}${tmp_dir}$basefile ${tmp_dest}$basefile" &&
ln -sf ${ tmp_prefix } ${ tmp_dir } $basefile ${ tmp_dest } $basefile ;
done
}
#####################################################################################
# check the os.
#####################################################################################
@ -220,7 +326,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
@ -232,29 +338,49 @@ fi
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ] ; then
# check the cross build flag file, if flag changed, need to rebuild the st.
_ST_MAKE = linux-debug && _ST_EXTRA_CFLAGS = "-DMD_HAVE_EPOLL"
_ST_MAKE = linux-debug && _ST_EXTRA_CFLAGS = "-DMD_HAVE_EPOLL" && _ST_LD = ${ SRS_TOOL_LD } && _ST_OBJ = "LINUX_*"
if [ [ $SRS_VALGRIND = = YES ] ] ; then
_ST_EXTRA_CFLAGS = " $_ST_EXTRA_CFLAGS -DMD_VALGRIND "
fi
# for osx, use darwin for st, donot use epoll.
if [ [ $SRS_OSX = = YES ] ] ; then
_ST_MAKE = darwin-debug && _ST_EXTRA_CFLAGS = "-DMD_HAVE_KQUEUE" && _ST_LD = ${ SRS_TOOL_CC } && _ST_OBJ = "DARWIN_*"
fi
# Pass the global extra flags.
if [ [ $SRS_EXTRA_FLAGS != '' ] ] ; then
_ST_EXTRA_CFLAGS = " $_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS "
fi
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
if [ [ -f ${ SRS_OBJS } /st/libst.a ] ] ; then
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } / st/libst.a ] ] ; then
echo "The state-threads is ok." ;
else
echo "Building state-threads." ;
(
rm -rf ${ SRS_OBJS } /st-srs && cd ${ SRS_OBJS } &&
ln -sf ../3rdparty/st-srs && cd st-srs &&
make clean && make ${ _ST_MAKE } EXTRA_CFLAGS = " ${ _ST_EXTRA_CFLAGS } " \
CC = ${ SRS_TOOL_CC } AR = ${ SRS_TOOL_AR } LD = ${ SRS_TOOL_LD } RANDLIB = ${ SRS_TOOL_RANDLIB } &&
cd .. && rm -f st && ln -sf st-srs/obj st
rm -rf ${ SRS_OBJS } /${ SRS_PLATFORM } /st-srs && mkdir -p ${ SRS_OBJS } /${ SRS_PLATFORM } /st-srs &&
# Create a hidden directory .src
cd ${ SRS_OBJS } /${ SRS_PLATFORM } /st-srs && ln -sf ../../../3rdparty/st-srs .src &&
# Link source files under .src
_srs_link_file .src/ ./ ./ &&
for dir in ` ( cd .src && find . -maxdepth 1 -type d| grep '\./' ) ` ; do
dir = ` basename $dir ` && mkdir -p $dir && _srs_link_file .src/$dir / $dir / ../
done &&
# Link source files under .src/xxx, the first child dir.
for dir in ` ( cd .src && find . -maxdepth 1 -type d| grep '\./' | grep -v Linux| grep -v Darwin) ` ; do
mkdir -p $dir &&
for file in ` ( cd .src/$dir && find . -maxdepth 1 -type f ! -name '*.o' ! -name '*.d' ) ` ; do
ln -sf ../.src/$dir /$file $dir /$file ;
done ;
done &&
# Build source code.
make ${ _ST_MAKE } EXTRA_CFLAGS = " ${ _ST_EXTRA_CFLAGS } " \
CC = ${ SRS_TOOL_CC } AR = ${ SRS_TOOL_AR } LD = ${ _ST_LD } RANDLIB = ${ SRS_TOOL_RANDLIB } &&
cd .. && rm -f st && ln -sf st-srs/${ _ST_OBJ } st
)
fi
# check status
ret = $? ; if [ [ $ret -ne 0 ] ] ; then echo " Build state-threads failed, ret= $ret " ; exit $ret ; fi
# Always update the links.
( cd ${ SRS_OBJS } && rm -rf st && ln -sf ${ SRS_PLATFORM } /st-srs/${ _ST_OBJ } st)
if [ ! -f ${ SRS_OBJS } /st/libst.a ] ; then echo "Build state-threads static lib failed." ; exit -1; fi
fi
@ -269,7 +395,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
echo "Building srtp2." ;
(
rm -rf ${ SRS_OBJS } /srtp2 && cd ${ SRS_OBJS } &&
unzip -q ../3rdparty/libsrtp-2.0.0.zip && cd libsrtp-2.0.0 &&
rm -rf libsrtp-2.0.0 && unzip -q ../3rdparty/libsrtp-2.0.0.zip && cd libsrtp-2.0.0 &&
./configure --prefix= ` pwd ` /_release && make ${ SRS_JOBS } && make install &&
cd .. && rm -f srtp2 && ln -sf libsrtp-2.0.0/_release srtp2
)
@ -328,19 +454,19 @@ fi
# cherrypy for http hooks callback, CherryPy-3.2.4
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ] ; then
if [ [ -f ${ SRS_OBJS } /CherryPy-3.2.4/setup.py ] ] ; then
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } / CherryPy-3.2.4/setup.py ] ] ; then
echo "CherryPy-3.2.4 is ok." ;
else
echo "Installing CherryPy-3.2.4" ;
(
rm -rf ${ SRS_OBJS } /CherryPy-3.2.4 && cd ${ SRS_OBJS } &&
unzip -q ../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
rm -rf ${ SRS_OBJS } /CherryPy-3.2.4 && cd ${ SRS_OBJS } /${ SRS_PLATFORM } &&
unzip -q ../../ 3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
python setup.py install --user
)
fi
# check status
ret = $? ; if [ [ $ret -ne 0 ] ] ; then echo " build CherryPy-3.2.4 failed, ret= $ret " ; exit $ret ; fi
if [ ! -f ${ SRS_OBJS } /CherryPy-3.2.4/setup.py ] ; then echo "build CherryPy-3.2.4 failed." ; exit -1; fi
if [ ! -f ${ SRS_OBJS } /${ SRS_PLATFORM } / CherryPy-3.2.4/setup.py ] ; then echo "build CherryPy-3.2.4 failed." ; exit -1; fi
echo "Link players to cherrypy static-dir"
rm -rf research/api-server/static-dir/players &&
@ -373,21 +499,26 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
OPENSSL_CONFIG = "./Configure linux-armv4"
else
# If not crossbuild, try to use exists libraries.
if [ [ -f /usr/local/lib64/libssl.a && ! -f ${ SRS_OBJS } /openssl/lib/libssl.a ] ] ; then
( mkdir -p ${ SRS_OBJS } /openssl/lib && cd ${ SRS_OBJS } /openssl/lib &&
if [ [ -f /usr/local/lib64/libssl.a && ! -f ${ SRS_OBJS } /${ SRS_PLATFORM } / openssl/lib/libssl.a ] ] ; then
( mkdir -p ${ SRS_OBJS } /${ SRS_PLATFORM } / openssl/lib && cd ${ SRS_OBJS } /${ SRS_PLATFORM } /openssl/lib &&
ln -sf /usr/local/lib64/libssl.a && ln -sf /usr/local/lib64/libcrypto.a)
( mkdir -p ${ SRS_OBJS } /openssl/include && cd ${ SRS_OBJS } /openssl/include &&
( mkdir -p ${ SRS_OBJS } /${ SRS_PLATFORM } / openssl/include && cd ${ SRS_OBJS } /${ SRS_PLATFORM } /openssl/include &&
ln -sf /usr/local/include/openssl)
fi
fi
# Which lib we use.
OPENSSL_LIB = "openssl-1.1.0e/_release"
if [ [ ! -f ${ SRS_OBJS } /${ SRS_PLATFORM } /${ OPENSSL_LIB } /lib/libssl.a ] ] ; then
OPENSSL_LIB = "openssl"
fi
# cross build not specified, if exists flag, need to rebuild for no-arm platform.
if [ [ -f ${ SRS_OBJS } /openssl/lib/libssl.a ] ] ; then
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } / openssl/lib/libssl.a ] ] ; then
echo "Openssl-1.1.0e is ok." ;
else
echo "Building openssl-1.1.0e." ;
(
rm -rf ${ SRS_OBJS } /openssl-1.1.0e && cd ${ SRS_OBJS } &&
unzip -q ../3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e &&
rm -rf ${ SRS_OBJS } /${ SRS_PLATFORM } / openssl-1.1.0e && cd ${ SRS_OBJS } /${ SRS_PLATFORM } &&
unzip -q ../../ 3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e &&
${ OPENSSL_CONFIG } --prefix= ` pwd ` /_release $OPENSSL_OPTIONS &&
make CC = ${ SRS_TOOL_CC } AR = " ${ SRS_TOOL_AR } -rs " LD = ${ SRS_TOOL_LD } RANDLIB = ${ SRS_TOOL_RANDLIB } ${ SRS_JOBS } && make install_sw &&
cd .. && rm -rf openssl && ln -sf openssl-1.1.0e/_release openssl
@ -395,26 +526,53 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
fi
# check status
ret = $? ; if [ [ $ret -ne 0 ] ] ; then echo " Build openssl-1.1.0e failed, ret= $ret " ; exit $ret ; fi
# Always update the links.
( cd ${ SRS_OBJS } && rm -rf openssl && ln -sf ${ SRS_PLATFORM } /${ OPENSSL_LIB } openssl)
if [ ! -f ${ SRS_OBJS } /openssl/lib/libssl.a ] ; then echo "Build openssl-1.1.0e failed." ; exit -1; fi
fi
#####################################################################################
# srtp
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ] ; then
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } /srtp2/lib/libsrtp2.a ] ] ; then
echo "The srtp2 is ok." ;
else
echo "Building srtp2." ;
(
rm -rf ${ SRS_OBJS } /srtp2 && cd ${ SRS_OBJS } /${ SRS_PLATFORM } &&
rm -rf libsrtp-2.0.0 && unzip -q ../../3rdparty/libsrtp-2.0.0.zip && cd libsrtp-2.0.0 &&
./configure --prefix= ` pwd ` /_release && make ${ SRS_JOBS } && make install &&
cd .. && rm -f srtp2 && ln -sf libsrtp-2.0.0/_release srtp2
)
fi
# check status
ret = $? ; if [ [ $ret -ne 0 ] ] ; then echo " Build srtp2 failed, ret= $ret " ; exit $ret ; fi
# Always update the links.
( cd ${ SRS_OBJS } && rm -f srtp2 && ln -sf ${ SRS_PLATFORM } /libsrtp-2.0.0/_release srtp2)
if [ ! -f ${ SRS_OBJS } /srtp2/lib/libsrtp2.a ] ; then echo "Build srtp2 static lib failed." ; exit -1; fi
fi
#####################################################################################
# libopus, for WebRTC to transcode AAC with Opus.
#####################################################################################
if [ [ $SRS_EXPORT_LIBRTMP_PROJECT = = NO && $SRS_RTC = = YES ] ] ; then
if [ [ -f ${ SRS_OBJS } /opus/lib/libopus.a ] ] ; then
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } / opus/lib/libopus.a ] ] ; then
echo "The opus-1.3.1 is ok." ;
else
echo "Building opus-1.3.1." ;
(
rm -rf ${ SRS_OBJS } /opus-1.3.1 && cd ${ SRS_OBJS } &&
tar xf ../3rdparty/opus-1.3.1.tar.gz && cd opus-1.3.1 &&
rm -rf ${ SRS_OBJS } /${ SRS_PLATFORM } / opus-1.3.1 && cd ${ SRS_OBJS } /${ SRS_PLATFORM } &&
tar xf ../../ 3rdparty/opus-1.3.1.tar.gz && cd opus-1.3.1 &&
./configure --prefix= ` pwd ` /_release --enable-static --disable-shared && make ${ SRS_JOBS } && make install
cd .. && rm -rf opus && ln -sf opus-1.3.1/_release opus
)
fi
# check status
ret = $? ; if [ [ $ret -ne 0 ] ] ; then echo " Build opus-1.3.1 failed, ret= $ret " ; exit $ret ; fi
# Always update the links.
( cd ${ SRS_OBJS } && rm -f opus && ln -sf ${ SRS_PLATFORM } /opus-1.3.1/_release opus)
if [ ! -f ${ SRS_OBJS } /opus/lib/libopus.a ] ; then echo "Build opus-1.3.1 failed." ; exit -1; fi
fi
@ -426,15 +584,32 @@ if [[ $SRS_EXPORT_LIBRTMP_PROJECT == NO && $SRS_RTC == YES ]]; then
if [ [ $SRS_NASM = = NO ] ] ; then
FFMPEG_OPTIONS = "--disable-asm --disable-x86asm --disable-inline-asm"
fi
if [ [ -f ${ SRS_OBJS } /ffmpeg/lib/libavcodec.a ] ] ; then
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } / ffmpeg/lib/libavcodec.a ] ] ; then
echo "The ffmpeg-4.2-fit is ok." ;
else
echo "Building ffmpeg-4.2-fit." ;
(
rm -rf ${ SRS_OBJS } /ffmpeg-4.2-fit && cd ${ SRS_OBJS } && ABS_OBJS = ` pwd ` &&
ln -sf ../3rdparty/ffmpeg-4.2-fit && cd ffmpeg-4.2-fit &&
rm -rf ${ SRS_OBJS } /${ SRS_PLATFORM } /ffmpeg-4.2-fit && mkdir -p ${ SRS_OBJS } /${ SRS_PLATFORM } /ffmpeg-4.2-fit &&
# Create a hidden directory .src
cd ${ SRS_OBJS } /${ SRS_PLATFORM } /ffmpeg-4.2-fit && ABS_OBJS = ` ( cd .. && pwd ) ` && ln -sf ../../../3rdparty/ffmpeg-4.2-fit .src &&
# Link source files under .src
_srs_link_file .src/ ./ ./ &&
for dir in ` ( cd .src && find . -maxdepth 1 -type d| grep '\./' ) ` ; do
dir = ` basename $dir ` && mkdir -p $dir && _srs_link_file .src/$dir / $dir / ../ &&
for dir2 in ` ( cd .src/$dir && find . -maxdepth 1 -type d| grep '\./' ) ` ; do
dir2 = ` basename $dir2 ` && mkdir -p $dir /$dir2 && _srs_link_file .src/$dir /$dir2 / $dir /$dir2 / ../../ &&
for dir3 in ` ( cd .src/$dir /$dir2 && find . -maxdepth 1 -type d| grep '\./' ) ` ; do
dir3 = ` basename $dir3 ` && mkdir -p $dir /$dir2 /$dir3 && _srs_link_file .src/$dir /$dir2 /$dir3 / $dir /$dir2 /$dir3 / ../../../;
done
done
done &&
# We should remove some files(in .gitignore) to keep them in local generated.
( cd ffbuild && rm -f config.fate config.log config.mak config.sh .config) &&
( cd libavutil && rm -f lib.version libavutil.version ffversion.h avconfig.h) &&
( rm -rf doc && rm -f config.asm config.h libavcodec/libavcodec.version libswresample/libswresample.version) &&
# Build source code.
PKG_CONFIG_PATH = $ABS_OBJS /opus/lib/pkgconfig ./configure \
--prefix= ` pwd ` /_release \
--prefix= ` pwd ` /${ SRS_PLATFORM } / _release \
--pkg-config-flags= "--static" --extra-libs= -lpthread --extra-libs= -lm ${ FFMPEG_OPTIONS } \
--disable-programs --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages \
--disable-avdevice --disable-avformat --disable-swscale --disable-postproc --disable-avfilter --disable-network \
@ -444,11 +619,13 @@ if [[ $SRS_EXPORT_LIBRTMP_PROJECT == NO && $SRS_RTC == YES ]]; then
--enable-decoder= aac --enable-decoder= aac_fixed --enable-decoder= aac_latm --enable-decoder= libopus --enable-encoder= aac \
--enable-encoder= opus --enable-encoder= libopus --enable-libopus &&
make ${ SRS_JOBS } && make install &&
cd .. && rm -rf ffmpeg && ln -sf ffmpeg-4.2-fit/_release ffmpeg
cd .. && rm -rf ffmpeg && ln -sf ffmpeg-4.2-fit/${ SRS_PLATFORM } / _release ffmpeg
)
fi
# check status
ret = $? ; if [ [ $ret -ne 0 ] ] ; then echo " Build ffmpeg-4.2-fit failed, ret= $ret " ; exit $ret ; fi
# Always update the links.
( cd ${ SRS_OBJS } && rm -f ffmpeg && ln -sf ${ SRS_PLATFORM } /ffmpeg-4.2-fit/${ SRS_PLATFORM } /_release ffmpeg)
if [ ! -f ${ SRS_OBJS } /ffmpeg/lib/libavcodec.a ] ; then echo "Build ffmpeg-4.2-fit failed." ; exit -1; fi
fi
@ -456,16 +633,19 @@ fi
# live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2.
#####################################################################################
# Always link the ffmpeg tools if exists.
if [ [ -f /usr/local/bin/ffmpeg && ! -f ${ SRS_OBJS } /ffmpeg/bin/ffmpeg ] ] ; then
mkdir -p ${ SRS_OBJS } /ffmpeg/bin && ln -sf /usr/local/bin/ffmpeg ${ SRS_OBJS } /ffmpeg/bin/ffmpeg
if [ [ -f /usr/local/bin/ffmpeg && ! -f ${ SRS_OBJS } /${ SRS_PLATFORM } /ffmpeg/bin/ffmpeg ] ] ; then
mkdir -p ${ SRS_OBJS } /${ SRS_PLATFORM } /ffmpeg/bin &&
ln -sf /usr/local/bin/ffmpeg ${ SRS_OBJS } /${ SRS_PLATFORM } /ffmpeg/bin/ffmpeg
fi
if [ $SRS_FFMPEG_TOOL = YES ] ; then
if [ [ -f ${ SRS_OBJS } /ffmpeg/bin/ffmpeg ] ] ; then
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } / ffmpeg/bin/ffmpeg ] ] ; then
echo "ffmpeg-4.1 is ok." ;
else
echo "no ffmpeg -4.1 found, please run in docker ossrs/srs:dev ";
echo "no ffmpeg found, please use srs-docker or --without-ffmpeg ";
exit -1;
fi
# Always update the links.
( cd ${ SRS_OBJS } && rm -rf ffmpeg && ln -sf ${ SRS_PLATFORM } /ffmpeg)
fi
#####################################################################################
@ -513,18 +693,20 @@ fi
# build utest code
#####################################################################################
if [ $SRS_UTEST = YES ] ; then
if [ [ -f ${ SRS_OBJS } /gtest/include/gtest/gtest.h ] ] ; then
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } / gtest/include/gtest/gtest.h ] ] ; then
echo "The gtest-1.6.0 is ok." ;
else
echo "Build gtest-1.6.0" ;
(
rm -rf ${ SRS_OBJS } /gtest-1.6.0 && cd ${ SRS_OBJS } &&
unzip -q ../3rdparty/gtest-1.6.0.zip &&
rm -rf ${ SRS_OBJS } /${ SRS_PLATFORM } / gtest-1.6.0 && cd ${ SRS_OBJS } /${ SRS_PLATFORM } &&
unzip -q ../../ 3rdparty/gtest-1.6.0.zip &&
rm -rf gtest && ln -sf gtest-1.6.0 gtest
)
fi
# check status
ret = $? ; if [ [ $ret -ne 0 ] ] ; then echo " Build gtest-1.6.0 failed, ret= $ret " ; exit $ret ; fi
# Always update the links.
( cd ${ SRS_OBJS } && rm -rf gtest && ln -sf ${ SRS_PLATFORM } /gtest-1.6.0 gtest)
if [ ! -f ${ SRS_OBJS } /gtest/include/gtest/gtest.h ] ; then echo "Build gtest-1.6.0 failed." ; exit -1; fi
fi
@ -532,13 +714,13 @@ fi
# build gperf code
#####################################################################################
if [ $SRS_GPERF = YES ] ; then
if [ [ -f ${ SRS_OBJS } /gperf/bin/pprof ] ] ; then
if [ [ -f ${ SRS_OBJS } /${ SRS_PLATFORM } / gperf/bin/pprof ] ] ; then
echo "The gperftools-2.1 is ok." ;
else
echo "Build gperftools-2.1" ;
(
rm -rf ${ SRS_OBJS } /gperftools-2.1 && cd ${ SRS_OBJS } &&
unzip -q ../3rdparty/gperftools-2.1.zip && cd gperftools-2.1 &&
rm -rf ${ SRS_OBJS } /${ SRS_PLATFORM } / gperftools-2.1 && cd ${ SRS_OBJS } /${ SRS_PLATFORM } &&
unzip -q ../../ 3rdparty/gperftools-2.1.zip && cd gperftools-2.1 &&
./configure --prefix= ` pwd ` /_release --enable-frame-pointers && make ${ SRS_JOBS } && make install &&
cd .. && rm -rf gperf && ln -sf gperftools-2.1/_release gperf &&
rm -rf pprof && ln -sf gperf/bin/pprof pprof
@ -546,10 +728,7 @@ if [ $SRS_GPERF = YES ]; then
fi
# check status
ret = $? ; if [ [ $ret -ne 0 ] ] ; then echo " Build gperftools-2.1 failed, ret= $ret " ; exit $ret ; fi
# Always update the links.
( cd ${ SRS_OBJS } && rm -rf pprof && ln -sf ${ SRS_PLATFORM } /gperf/bin/pprof pprof)
if [ ! -f ${ SRS_OBJS } /gperf/bin/pprof ] ; then echo "Build gperftools-2.1 failed." ; exit -1; fi
fi
#####################################################################################
# generated the test script
#####################################################################################
rm -rf ${ SRS_OBJS } /srs.test && ln -sf ` pwd ` /scripts/srs.test objs/srs.test