mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Remove export srs-librtmp support
This commit is contained in:
parent
b8ab6ef6ce
commit
a3388bf624
7 changed files with 400 additions and 687 deletions
|
@ -49,11 +49,7 @@ fi
|
|||
if [ $SRS_CUBIE = YES ]; then
|
||||
srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H
|
||||
fi
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
|
||||
echo "#define SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
|
||||
else
|
||||
echo "#undef SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
|
||||
fi
|
||||
echo "#undef SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
|
||||
|
||||
echo "" >> $SRS_AUTO_HEADERS_H
|
||||
|
||||
|
|
|
@ -113,9 +113,7 @@ function Ubuntu_prepare()
|
|||
return 0
|
||||
}
|
||||
# donot prepare tools, for srs-librtmp depends only gcc and g++.
|
||||
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
|
||||
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
|
||||
|
@ -191,9 +189,7 @@ function Centos_prepare()
|
|||
return 0
|
||||
}
|
||||
# donot prepare tools, for srs-librtmp depends only gcc and g++.
|
||||
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
|
||||
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
|
||||
|
@ -277,9 +273,7 @@ function OSX_prepare()
|
|||
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
|
||||
OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "OSX prepare failed, ret=$ret"; exit $ret; fi
|
||||
|
||||
#####################################################################################
|
||||
# for Centos, auto install tools by yum
|
||||
|
@ -326,7 +320,7 @@ function _srs_link_file()
|
|||
# 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 && $OS_IS_OSX = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
|
||||
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO ]]; then
|
||||
if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then
|
||||
echo "Your OS `uname -s` is not supported."
|
||||
exit 1
|
||||
|
@ -336,61 +330,59 @@ fi
|
|||
#####################################################################################
|
||||
# state-threads
|
||||
#####################################################################################
|
||||
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="-O0" && _ST_LD=${SRS_TOOL_LD} && _ST_OBJ="LINUX_`uname -r`_DBG"
|
||||
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_`uname -r`_DBG"
|
||||
fi
|
||||
# For UDP sendmmsg, disable it if not suppported.
|
||||
if [[ $SRS_SENDMMSG == YES ]]; then
|
||||
echo "Build ST with UDP sendmmsg support."
|
||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_HAVE_SENDMMSG -D_GNU_SOURCE"
|
||||
else
|
||||
echo "Build ST without UDP sendmmsg support."
|
||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -UMD_HAVE_SENDMMSG -U_GNU_SOURCE"
|
||||
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}/${SRS_PLATFORM}/st/libst.a ]]; then
|
||||
echo "The state-threads is ok.";
|
||||
else
|
||||
echo "Building state-threads.";
|
||||
(
|
||||
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 -rf 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
|
||||
# check the cross build flag file, if flag changed, need to rebuild the st.
|
||||
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-O0" && _ST_LD=${SRS_TOOL_LD} && _ST_OBJ="LINUX_`uname -r`_DBG"
|
||||
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_`uname -r`_DBG"
|
||||
fi
|
||||
# For UDP sendmmsg, disable it if not suppported.
|
||||
if [[ $SRS_SENDMMSG == YES ]]; then
|
||||
echo "Build ST with UDP sendmmsg support."
|
||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_HAVE_SENDMMSG -D_GNU_SOURCE"
|
||||
else
|
||||
echo "Build ST without UDP sendmmsg support."
|
||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -UMD_HAVE_SENDMMSG -U_GNU_SOURCE"
|
||||
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}/${SRS_PLATFORM}/st/libst.a ]]; then
|
||||
echo "The state-threads is ok.";
|
||||
else
|
||||
echo "Building state-threads.";
|
||||
(
|
||||
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 -rf 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
|
||||
|
||||
#####################################################################################
|
||||
# nginx for HLS, nginx-1.5.0
|
||||
|
@ -404,74 +396,68 @@ function write_nginx_html5()
|
|||
END
|
||||
}
|
||||
# create the nginx dir, for http-server if not build nginx
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||
mkdir -p ${SRS_OBJS}/nginx
|
||||
fi
|
||||
mkdir -p ${SRS_OBJS}/nginx
|
||||
|
||||
# the demo dir.
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||
# create forward dir
|
||||
mkdir -p ${SRS_OBJS}/nginx/html/live &&
|
||||
mkdir -p ${SRS_OBJS}/nginx/html/forward/live
|
||||
# create forward dir
|
||||
mkdir -p ${SRS_OBJS}/nginx/html/live &&
|
||||
mkdir -p ${SRS_OBJS}/nginx/html/forward/live
|
||||
|
||||
# generate default html pages for android.
|
||||
html_file=${SRS_OBJS}/nginx/html/live/demo.html && hls_stream=demo.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
|
||||
# generate default html pages for android.
|
||||
html_file=${SRS_OBJS}/nginx/html/live/demo.html && hls_stream=demo.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
|
||||
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
|
||||
|
||||
# copy players to nginx html dir.
|
||||
rm -rf ${SRS_OBJS}/nginx/html/players &&
|
||||
ln -sf `pwd`/research/players ${SRS_OBJS}/nginx/html/players &&
|
||||
rm -f ${SRS_OBJS}/nginx/crossdomain.xml &&
|
||||
ln -sf `pwd`/research/players/crossdomain.xml ${SRS_OBJS}/nginx/html/crossdomain.xml
|
||||
# copy players to nginx html dir.
|
||||
rm -rf ${SRS_OBJS}/nginx/html/players &&
|
||||
ln -sf `pwd`/research/players ${SRS_OBJS}/nginx/html/players &&
|
||||
rm -f ${SRS_OBJS}/nginx/crossdomain.xml &&
|
||||
ln -sf `pwd`/research/players/crossdomain.xml ${SRS_OBJS}/nginx/html/crossdomain.xml
|
||||
|
||||
# for favicon.ico
|
||||
rm -rf ${SRS_OBJS}/nginx/html/favicon.ico &&
|
||||
ln -sf `pwd`/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/favicon.ico
|
||||
# for favicon.ico
|
||||
rm -rf ${SRS_OBJS}/nginx/html/favicon.ico &&
|
||||
ln -sf `pwd`/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/favicon.ico
|
||||
|
||||
# nginx.html to detect whether nginx is alive
|
||||
echo "Nginx is ok." > ${SRS_OBJS}/nginx/html/nginx.html
|
||||
fi
|
||||
# nginx.html to detect whether nginx is alive
|
||||
echo "Nginx is ok." > ${SRS_OBJS}/nginx/html/nginx.html
|
||||
|
||||
#####################################################################################
|
||||
# cherrypy for http hooks callback, CherryPy-3.2.4
|
||||
#####################################################################################
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||
# Detect python or python2
|
||||
python --version >/dev/null 2>&1 && SYS_PYTHON=python;
|
||||
python2 --version >/dev/null 2>&1 && SYS_PYTHON=python2;
|
||||
# Install cherrypy for api server.
|
||||
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}/${SRS_PLATFORM} &&
|
||||
unzip -q ../../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
|
||||
$SYS_PYTHON setup.py install --user --prefix=''
|
||||
)
|
||||
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}/${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 &&
|
||||
ln -sf `pwd`/research/players research/api-server/static-dir/players &&
|
||||
rm -f research/api-server/static-dir/crossdomain.xml &&
|
||||
ln -sf `pwd`/research/players/crossdomain.xml research/api-server/static-dir/crossdomain.xml &&
|
||||
rm -rf research/api-server/static-dir/live &&
|
||||
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/live &&
|
||||
ln -sf `pwd`/${SRS_OBJS}/nginx/html/live research/api-server/static-dir/live &&
|
||||
rm -rf research/api-server/static-dir/forward &&
|
||||
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/forward &&
|
||||
ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/forward
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Warning: Ignore error to link players to cherrypy static-dir."; fi
|
||||
# Detect python or python2
|
||||
python --version >/dev/null 2>&1 && SYS_PYTHON=python;
|
||||
python2 --version >/dev/null 2>&1 && SYS_PYTHON=python2;
|
||||
# Install cherrypy for api server.
|
||||
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}/${SRS_PLATFORM} &&
|
||||
unzip -q ../../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
|
||||
$SYS_PYTHON setup.py install --user --prefix=''
|
||||
)
|
||||
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}/${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 &&
|
||||
ln -sf `pwd`/research/players research/api-server/static-dir/players &&
|
||||
rm -f research/api-server/static-dir/crossdomain.xml &&
|
||||
ln -sf `pwd`/research/players/crossdomain.xml research/api-server/static-dir/crossdomain.xml &&
|
||||
rm -rf research/api-server/static-dir/live &&
|
||||
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/live &&
|
||||
ln -sf `pwd`/${SRS_OBJS}/nginx/html/live research/api-server/static-dir/live &&
|
||||
rm -rf research/api-server/static-dir/forward &&
|
||||
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/forward &&
|
||||
ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/forward
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Warning: Ignore error to link players to cherrypy static-dir."; fi
|
||||
|
||||
#####################################################################################
|
||||
# openssl, for rtmp complex handshake and HLS encryption.
|
||||
|
@ -547,49 +533,47 @@ fi
|
|||
#####################################################################################
|
||||
# srtp
|
||||
#####################################################################################
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||
# For openssl-1.1.*, we should disable SRTP ASM, because SRTP only works with openssl-1.0.*
|
||||
if [[ $SRS_SRTP_ASM == YES ]]; then
|
||||
echo " #include <openssl/ssl.h> " > ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
echo " #if OPENSSL_VERSION_NUMBER >= 0x10100000L // v1.1.x " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
echo " #error \"SRTP only works with openssl-1.0.*\" " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
echo " #endif " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
${SRS_TOOL_CC} -c ${SRS_OBJS}/_tmp_srtp_asm_detect.c -I${SRS_OBJS}/openssl/include -o /dev/null >/dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
SRS_SRTP_ASM=NO && echo "Warning: Disable SRTP ASM optimization, please update docker";
|
||||
fi
|
||||
rm -f ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
fi;
|
||||
SRTP_CONFIG="echo SRTP without openssl(ASM) optimization" && SRTP_OPTIONS=""
|
||||
# If use ASM for SRTP, we enable openssl(with ASM).
|
||||
if [[ $SRS_SRTP_ASM == YES ]]; then
|
||||
echo "SRTP with openssl(ASM) optimization" &&
|
||||
SRTP_CONFIG="export PKG_CONFIG_PATH=../openssl/lib/pkgconfig" && SRTP_OPTIONS="--enable-openssl"
|
||||
# For openssl-1.1.*, we should disable SRTP ASM, because SRTP only works with openssl-1.0.*
|
||||
if [[ $SRS_SRTP_ASM == YES ]]; then
|
||||
echo " #include <openssl/ssl.h> " > ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
echo " #if OPENSSL_VERSION_NUMBER >= 0x10100000L // v1.1.x " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
echo " #error \"SRTP only works with openssl-1.0.*\" " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
echo " #endif " >> ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
${SRS_TOOL_CC} -c ${SRS_OBJS}/_tmp_srtp_asm_detect.c -I${SRS_OBJS}/openssl/include -o /dev/null >/dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
SRS_SRTP_ASM=NO && echo "Warning: Disable SRTP ASM optimization, please update docker";
|
||||
fi
|
||||
# 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 &&
|
||||
${SRTP_CONFIG} && ./configure ${SRTP_OPTIONS} --prefix=`pwd`/_release &&
|
||||
make ${SRS_JOBS} && make install &&
|
||||
cd .. && rm -rf 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 -rf 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
|
||||
rm -f ${SRS_OBJS}/_tmp_srtp_asm_detect.c
|
||||
fi;
|
||||
SRTP_CONFIG="echo SRTP without openssl(ASM) optimization" && SRTP_OPTIONS=""
|
||||
# If use ASM for SRTP, we enable openssl(with ASM).
|
||||
if [[ $SRS_SRTP_ASM == YES ]]; then
|
||||
echo "SRTP with openssl(ASM) optimization" &&
|
||||
SRTP_CONFIG="export PKG_CONFIG_PATH=../openssl/lib/pkgconfig" && SRTP_OPTIONS="--enable-openssl"
|
||||
fi
|
||||
# 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 &&
|
||||
${SRTP_CONFIG} && ./configure ${SRTP_OPTIONS} --prefix=`pwd`/_release &&
|
||||
make ${SRS_JOBS} && make install &&
|
||||
cd .. && rm -rf 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 -rf 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
|
||||
|
||||
#####################################################################################
|
||||
# libopus, for WebRTC to transcode AAC with Opus.
|
||||
#####################################################################################
|
||||
if [[ $SRS_EXPORT_LIBRTMP_PROJECT == NO && $SRS_RTC == YES ]]; then
|
||||
if [[ $SRS_RTC == YES ]]; then
|
||||
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/opus/lib/libopus.a ]]; then
|
||||
echo "The opus-1.3.1 is ok.";
|
||||
else
|
||||
|
@ -611,7 +595,7 @@ fi
|
|||
#####################################################################################
|
||||
# ffmpeg-fix, for WebRTC to transcode AAC with Opus.
|
||||
#####################################################################################
|
||||
if [[ $SRS_EXPORT_LIBRTMP_PROJECT == NO && $SRS_RTC == YES ]]; then
|
||||
if [[ $SRS_RTC == YES ]]; then
|
||||
FFMPEG_OPTIONS=""
|
||||
|
||||
# If disable nasm, disable all ASMs.
|
||||
|
@ -710,16 +694,14 @@ fi
|
|||
#####################################################################################
|
||||
# build research code, librtmp
|
||||
#####################################################################################
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||
if [ $SRS_RESEARCH = YES ]; then
|
||||
mkdir -p ${SRS_OBJS}/research
|
||||
if [ $SRS_RESEARCH = YES ]; then
|
||||
mkdir -p ${SRS_OBJS}/research
|
||||
|
||||
(cd ${SRS_WORKDIR}/research/hls && make ${SRS_JOBS} && mv ts_info ../../${SRS_OBJS_DIR}/research)
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build research/hls failed, ret=$ret"; exit $ret; fi
|
||||
(cd ${SRS_WORKDIR}/research/hls && make ${SRS_JOBS} && mv ts_info ../../${SRS_OBJS_DIR}/research)
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build research/hls failed, ret=$ret"; exit $ret; fi
|
||||
|
||||
(cd research/ffempty && make ${SRS_JOBS} && mv ffempty ../../${SRS_OBJS_DIR}/research)
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build research/ffempty failed, ret=$ret"; exit $ret; fi
|
||||
fi
|
||||
(cd research/ffempty && make ${SRS_JOBS} && mv ffempty ../../${SRS_OBJS_DIR}/research)
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build research/ffempty failed, ret=$ret"; exit $ret; fi
|
||||
fi
|
||||
|
||||
if [[ $SRS_LIBRTMP == YES ]]; then
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# when export srs-librtmp project
|
||||
# set the SRS_WORKDIR and SRS_OBJS,
|
||||
# then copy the srs-librtmp needed files.
|
||||
#
|
||||
# params:
|
||||
# $SRS_WORKDIR the work dir. ie. .
|
||||
# $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
|
||||
# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
|
||||
# $SRS_EXPORT_LIBRTMP_PROJECT the export srs-librtmp project path. ie. srs-librtmp
|
||||
#
|
||||
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
|
||||
if [[ -d ${SRS_EXPORT_LIBRTMP_PROJECT} ]]; then
|
||||
echo -e "${RED}srs-librtmp target dir exists: ${SRS_EXPORT_LIBRTMP_PROJECT}. ${BLACK}"
|
||||
exit 1
|
||||
fi
|
||||
# create target
|
||||
SRS_WORKDIR=${SRS_EXPORT_LIBRTMP_PROJECT} && SRS_OBJS=${SRS_WORKDIR}/${SRS_OBJS_DIR} && mkdir -p ${SRS_OBJS} &&
|
||||
# copy src to target
|
||||
_CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/research/librtmp && mkdir -p ${_CPT} && cp research/librtmp/*.c research/librtmp/Makefile ${_CPT} &&
|
||||
_CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/auto && mkdir -p ${_CPT} && cp auto/generate_header.sh auto/generate-srs-librtmp-single.sh ${_CPT} &&
|
||||
_CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/core && mkdir -p ${_CPT} && cp src/core/* ${_CPT} &&
|
||||
_CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/kernel && mkdir -p ${_CPT} && cp src/kernel/* ${_CPT} &&
|
||||
_CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/protocol && mkdir -p ${_CPT} && cp src/protocol/* ${_CPT} &&
|
||||
_CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/libs && mkdir -p ${_CPT} && cp src/libs/* ${_CPT}
|
||||
# check ret
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "export src failed, ret=$ret"; exit $ret; fi
|
||||
fi
|
|
@ -1,133 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# when export srs-librtmp single files
|
||||
# package the whole project to srs_librtmp.h and srs_librtmp.cpp
|
||||
#
|
||||
# params:
|
||||
# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
|
||||
# $SRS_EXPORT_LIBRTMP_SINGLE the export srs-librtmp single path. ie. srs-librtmp
|
||||
#
|
||||
|
||||
# the target dir must created
|
||||
if [[ ! -d $SRS_EXPORT_LIBRTMP_SINGLE ]]; then
|
||||
echo -e "${RED}error, target dir not created: $SRS_EXPORT_LIBRTMP_SINGLE${BLACK}"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# generate the srs_librtmp.h
|
||||
cp $SRS_EXPORT_LIBRTMP_SINGLE/src/libs/srs_librtmp.hpp $SRS_EXPORT_LIBRTMP_SINGLE/srs_librtmp.h
|
||||
|
||||
# create srs_librtmp.cpp
|
||||
FILE=$SRS_EXPORT_LIBRTMP_SINGLE/srs_librtmp.cpp
|
||||
cat << END >$FILE
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2017 OSSRS(winlin)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "srs_librtmp.h"
|
||||
|
||||
END
|
||||
# build objs auto files to cpp
|
||||
cat $SRS_EXPORT_LIBRTMP_SINGLE/$SRS_OBJS_DIR/srs_auto_headers.hpp >>$FILE
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then
|
||||
echo -e "${RED}failed to generate the srs_librtmp.cpp${BLACK}"
|
||||
exit $ret
|
||||
fi
|
||||
# module to hpp files.
|
||||
function build_module_hpp()
|
||||
{
|
||||
echo "build files ${SRS_LIBRTMP_OBJS} to $FILE"
|
||||
for item in ${SRS_LIBRTMP_OBJS[*]}; do
|
||||
FILE_NAME="${item%.*}"
|
||||
echo "// following is generated by ${FILE_NAME}.hpp" >> $FILE &&
|
||||
$SED "s|#include <srs_|//#include <srs_|g" $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.hpp &&
|
||||
cat $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.hpp >>$FILE
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then
|
||||
echo -e "${RED}failed to generate the srs_librtmp.cpp by ${FILE_NAME}.hpp. {${BLACK}"
|
||||
exit $ret
|
||||
fi
|
||||
done
|
||||
}
|
||||
SRS_LIBRTMP_OBJS="${CORE_OBJS[@]}" && build_module_hpp
|
||||
SRS_LIBRTMP_OBJS="${KERNEL_OBJS[@]}" && build_module_hpp
|
||||
SRS_LIBRTMP_OBJS="${PROTOCOL_OBJS[@]}" && build_module_hpp
|
||||
SRS_LIBRTMP_OBJS="${LIBS_OBJS[@]}" && build_module_hpp
|
||||
# module to cpp files.
|
||||
function build_module_cpp()
|
||||
{
|
||||
echo "build files ${SRS_LIBRTMP_OBJS} to $FILE"
|
||||
for item in ${SRS_LIBRTMP_OBJS[*]}; do
|
||||
FILE_NAME="${item%.*}"
|
||||
echo "// following is generated by ${FILE_NAME}.cpp" >> $FILE &&
|
||||
$SED "s|#include <srs_|//#include <srs_|g" $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.cpp &&
|
||||
cat $SRS_EXPORT_LIBRTMP_SINGLE/${FILE_NAME}.cpp >>$FILE
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then
|
||||
echo -e "${RED}failed to generate the srs_librtmp.cpp by ${FILE_NAME}.cpp. {${BLACK}"
|
||||
exit $ret
|
||||
fi
|
||||
done
|
||||
}
|
||||
SRS_LIBRTMP_OBJS="${CORE_OBJS[@]}" && build_module_cpp
|
||||
SRS_LIBRTMP_OBJS="${KERNEL_OBJS[@]}" && build_module_cpp
|
||||
SRS_LIBRTMP_OBJS="${PROTOCOL_OBJS[@]}" && build_module_cpp
|
||||
SRS_LIBRTMP_OBJS="${LIBS_OBJS[@]}" && build_module_cpp
|
||||
|
||||
# create example.cpp
|
||||
FILE=$SRS_EXPORT_LIBRTMP_SINGLE/example.c
|
||||
SRS_SINGLE_LIBRTMP_COMPILE='gcc example.c srs_librtmp.cpp -g -O0 -lstdc++ -o example'
|
||||
cat << END >$FILE
|
||||
/**
|
||||
# Example to use srs-librtmp
|
||||
# see: https://github.com/ossrs/srs/wiki/v2_CN_SrsLibrtmp
|
||||
${SRS_SINGLE_LIBRTMP_COMPILE}
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "srs_librtmp.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
srs_rtmp_t rtmp;
|
||||
|
||||
printf("Example for srs-librtmp\n");
|
||||
printf("SRS(ossrs) client librtmp library.\n");
|
||||
printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
|
||||
|
||||
rtmp = srs_rtmp_create("rtmp://ossrs.net/live/livestream");
|
||||
srs_human_trace("create rtmp success");
|
||||
srs_rtmp_destroy(rtmp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
END
|
||||
|
||||
## compile the example
|
||||
#(cd $SRS_EXPORT_LIBRTMP_SINGLE && echo "${SRS_SINGLE_LIBRTMP_COMPILE}" &&
|
||||
#`${SRS_SINGLE_LIBRTMP_COMPILE}` && ./example && rm -f example)
|
||||
#ret=$?; if [[ $ret -ne 0 ]]; then
|
||||
# echo "(cd $SRS_EXPORT_LIBRTMP_SINGLE && ${SRS_SINGLE_LIBRTMP_COMPILE} && ./example && rm -f example)"
|
||||
# echo -e "${RED}failed to compile example.${BLACK}"
|
||||
# exit $ret
|
||||
#fi
|
||||
|
||||
# clear the files for srs-librtmp project, generated by generate-srs-librtmp-project.sh
|
||||
(cd $SRS_EXPORT_LIBRTMP_SINGLE && rm -rf auto $SRS_OBJS_DIR research src Makefile)
|
|
@ -194,8 +194,6 @@ Experts:
|
|||
--sys-ssl=on|off Do not compile ssl, use system ssl(-lssl) if required.
|
||||
--use-shared-st Use link shared libraries for ST which uses MPL license.
|
||||
--use-shared-srt Use link shared libraries for SRT which uses MPL license.
|
||||
--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.
|
||||
--build-tag=<TAG> Set the build object directory suffix.
|
||||
--with-clean Configure SRS and do make clean if possible.
|
||||
--without-clean Configure SRS and never make clean even possible.
|
||||
|
@ -578,28 +576,14 @@ function apply_user_detail_options() {
|
|||
|
||||
# if specified export single file, export project first.
|
||||
if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then
|
||||
SRS_EXPORT_LIBRTMP_PROJECT=$SRS_EXPORT_LIBRTMP_SINGLE
|
||||
echo "Not support --export-librtmp-single"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
# disable almost all features for export srs-librtmp.
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
|
||||
SRS_HDS=NO
|
||||
SRS_SSL=NO
|
||||
SRS_TRANSCODE=NO
|
||||
SRS_HTTP_CALLBACK=NO
|
||||
SRS_INGEST=NO
|
||||
SRS_STAT=NO
|
||||
SRS_STREAM_CASTER=NO
|
||||
SRS_LIBRTMP=YES
|
||||
SRS_RESEARCH=YES
|
||||
SRS_UTEST=NO
|
||||
SRS_GPERF=NO
|
||||
SRS_GPERF_MC=NO
|
||||
SRS_GPERF_MD=NO
|
||||
SRS_GPERF_MP=NO
|
||||
SRS_GPERF_CP=NO
|
||||
SRS_GPROF=NO
|
||||
SRS_STATIC=NO
|
||||
echo "Not support --export-librtmp-project"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then
|
||||
|
|
|
@ -24,8 +24,7 @@ SrsGperfCPSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPERF_CP = YES ]; then
|
|||
SrsGprofSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
|
||||
SrsValgrindSummaryColor="\${YELLOW}(Disabled) "; if [ $SRS_VALGRIND = YES ]; then SrsValgrindSummaryColor="\${GREEN}"; fi
|
||||
|
||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
|
||||
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
|
||||
#!/bin/bash
|
||||
|
||||
#####################################################################################
|
||||
|
@ -58,22 +57,4 @@ echo "You can:"
|
|||
echo " ./objs/srs -c conf/srs.conf"
|
||||
echo " to start the srs server, with config conf/srs.conf."
|
||||
END
|
||||
else
|
||||
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
|
||||
#!/bin/bash
|
||||
|
||||
#####################################################################################
|
||||
# linux shell color support.
|
||||
RED="\\${RED}"
|
||||
GREEN="\\${GREEN}"
|
||||
YELLOW="\\${YELLOW}"
|
||||
BLACK="\\${BLACK}"
|
||||
|
||||
echo -e "\${BLACK}You can use srs-librtmp at:\${BLACK}"
|
||||
echo -e "\${GREEN} objs/include/srs_librtmp.h\${BLACK}"
|
||||
echo -e "\${GREEN} objs/lib/srs_librtmp.a\${BLACK}"
|
||||
echo -e "\${BLACK}Examples for srs-librtmp at:\${BLACK}"
|
||||
echo -e "\${GREEN} objs/research/librtmp\${BLACK}"
|
||||
echo -e "\${GREEN} Examples: https://github.com/ossrs/srs/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
|
||||
END
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue