1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00

RTC: Remove export srs-librtmp support

This commit is contained in:
winlin 2020-05-27 14:20:40 +08:00
parent b8ab6ef6ce
commit a3388bf624
7 changed files with 400 additions and 687 deletions

View file

@ -49,11 +49,7 @@ fi
if [ $SRS_CUBIE = YES ]; then if [ $SRS_CUBIE = YES ]; then
srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H
fi 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 echo "#undef SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
fi
echo "" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H

View file

@ -113,9 +113,7 @@ function Ubuntu_prepare()
return 0 return 0
} }
# donot prepare tools, for srs-librtmp depends only gcc and g++. # 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 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 # for Centos, auto install tools by yum
@ -191,9 +189,7 @@ function Centos_prepare()
return 0 return 0
} }
# donot prepare tools, for srs-librtmp depends only gcc and g++. # 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 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 # For OSX, auto install tools by brew
@ -277,9 +273,7 @@ function OSX_prepare()
return 0 return 0
} }
# donot prepare tools, for srs-librtmp depends only gcc and g++. # 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 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 # 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, # directly build on arm/mips, for example, pi or cubie,
# export srs-librtmp # export srs-librtmp
# others is invalid. # 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 if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then
echo "Your OS `uname -s` is not supported." echo "Your OS `uname -s` is not supported."
exit 1 exit 1
@ -336,7 +330,6 @@ fi
##################################################################################### #####################################################################################
# state-threads # state-threads
##################################################################################### #####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# check the cross build flag file, if flag changed, need to rebuild the st. # 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" _ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-O0" && _ST_LD=${SRS_TOOL_LD} && _ST_OBJ="LINUX_`uname -r`_DBG"
if [[ $SRS_VALGRIND == YES ]]; then if [[ $SRS_VALGRIND == YES ]]; then
@ -390,7 +383,6 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# Always update the links. # Always update the links.
(cd ${SRS_OBJS} && rm -rf st && ln -sf ${SRS_PLATFORM}/st-srs/${_ST_OBJ} st) (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 if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "Build state-threads static lib failed."; exit -1; fi
fi
##################################################################################### #####################################################################################
# nginx for HLS, nginx-1.5.0 # nginx for HLS, nginx-1.5.0
@ -404,12 +396,9 @@ function write_nginx_html5()
END END
} }
# create the nginx dir, for http-server if not build nginx # create the nginx dir, for http-server if not build nginx
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
mkdir -p ${SRS_OBJS}/nginx mkdir -p ${SRS_OBJS}/nginx
fi
# the demo dir. # the demo dir.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# create forward dir # create forward dir
mkdir -p ${SRS_OBJS}/nginx/html/live && mkdir -p ${SRS_OBJS}/nginx/html/live &&
mkdir -p ${SRS_OBJS}/nginx/html/forward/live mkdir -p ${SRS_OBJS}/nginx/html/forward/live
@ -435,12 +424,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# nginx.html to detect whether nginx is alive # nginx.html to detect whether nginx is alive
echo "Nginx is ok." > ${SRS_OBJS}/nginx/html/nginx.html echo "Nginx is ok." > ${SRS_OBJS}/nginx/html/nginx.html
fi
##################################################################################### #####################################################################################
# cherrypy for http hooks callback, CherryPy-3.2.4 # cherrypy for http hooks callback, CherryPy-3.2.4
##################################################################################### #####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# Detect python or python2 # Detect python or python2
python --version >/dev/null 2>&1 && SYS_PYTHON=python; python --version >/dev/null 2>&1 && SYS_PYTHON=python;
python2 --version >/dev/null 2>&1 && SYS_PYTHON=python2; python2 --version >/dev/null 2>&1 && SYS_PYTHON=python2;
@ -471,7 +458,6 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/forward && mkdir -p `pwd`/${SRS_OBJS}/nginx/html/forward &&
ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/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 ret=$?; if [[ $ret -ne 0 ]]; then echo "Warning: Ignore error to link players to cherrypy static-dir."; fi
fi
##################################################################################### #####################################################################################
# openssl, for rtmp complex handshake and HLS encryption. # openssl, for rtmp complex handshake and HLS encryption.
@ -547,7 +533,6 @@ fi
##################################################################################### #####################################################################################
# srtp # 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.* # For openssl-1.1.*, we should disable SRTP ASM, because SRTP only works with openssl-1.0.*
if [[ $SRS_SRTP_ASM == YES ]]; then if [[ $SRS_SRTP_ASM == YES ]]; then
echo " #include <openssl/ssl.h> " > ${SRS_OBJS}/_tmp_srtp_asm_detect.c echo " #include <openssl/ssl.h> " > ${SRS_OBJS}/_tmp_srtp_asm_detect.c
@ -584,12 +569,11 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# Always update the links. # Always update the links.
(cd ${SRS_OBJS} && rm -rf srtp2 && ln -sf ${SRS_PLATFORM}/libsrtp-2.0.0/_release srtp2) (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 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. # 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 if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/opus/lib/libopus.a ]]; then
echo "The opus-1.3.1 is ok."; echo "The opus-1.3.1 is ok.";
else else
@ -611,7 +595,7 @@ fi
##################################################################################### #####################################################################################
# ffmpeg-fix, for WebRTC to transcode AAC with Opus. # 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="" FFMPEG_OPTIONS=""
# If disable nasm, disable all ASMs. # If disable nasm, disable all ASMs.
@ -710,7 +694,6 @@ fi
##################################################################################### #####################################################################################
# build research code, librtmp # build research code, librtmp
##################################################################################### #####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
if [ $SRS_RESEARCH = YES ]; then if [ $SRS_RESEARCH = YES ]; then
mkdir -p ${SRS_OBJS}/research mkdir -p ${SRS_OBJS}/research
@ -720,7 +703,6 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
(cd research/ffempty && make ${SRS_JOBS} && mv ffempty ../../${SRS_OBJS_DIR}/research) (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 ret=$?; if [[ $ret -ne 0 ]]; then echo "Build research/ffempty failed, ret=$ret"; exit $ret; fi
fi fi
fi
if [[ $SRS_LIBRTMP == YES ]]; then if [[ $SRS_LIBRTMP == YES ]]; then
mkdir -p ${SRS_OBJS}/research mkdir -p ${SRS_OBJS}/research

View file

@ -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

View file

@ -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)

View file

@ -194,8 +194,6 @@ Experts:
--sys-ssl=on|off Do not compile ssl, use system ssl(-lssl) if required. --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-st Use link shared libraries for ST which uses MPL license.
--use-shared-srt Use link shared libraries for SRT 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. --build-tag=<TAG> Set the build object directory suffix.
--with-clean Configure SRS and do make clean if possible. --with-clean Configure SRS and do make clean if possible.
--without-clean Configure SRS and never make clean even 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 specified export single file, export project first.
if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then
SRS_EXPORT_LIBRTMP_PROJECT=$SRS_EXPORT_LIBRTMP_SINGLE echo "Not support --export-librtmp-single"
exit -1
fi fi
# disable almost all features for export srs-librtmp. # disable almost all features for export srs-librtmp.
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
SRS_HDS=NO echo "Not support --export-librtmp-project"
SRS_SSL=NO exit -1
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
fi fi
if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then

View file

@ -24,7 +24,6 @@ SrsGperfCPSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPERF_CP = YES ]; then
SrsGprofSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi SrsGprofSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
SrsValgrindSummaryColor="\${YELLOW}(Disabled) "; if [ $SRS_VALGRIND = YES ]; then SrsValgrindSummaryColor="\${GREEN}"; 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 #!/bin/bash
@ -58,22 +57,4 @@ echo "You can:"
echo " ./objs/srs -c conf/srs.conf" echo " ./objs/srs -c conf/srs.conf"
echo " to start the srs server, with config conf/srs.conf." echo " to start the srs server, with config conf/srs.conf."
END 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

71
trunk/configure vendored
View file

@ -96,10 +96,6 @@ CppStd="-ansi"
if [[ $SRS_SRT == YES ]]; then if [[ $SRS_SRT == YES ]]; then
CppStd="-std=c++11" CppStd="-std=c++11"
fi fi
# for library compile
if [[ $SRS_EXPORT_LIBRTMP_PROJECT == YES ]]; then
LibraryCompile=" -fPIC"
fi
# performance of gprof # performance of gprof
SrsGprof=""; SrsGprofLink=""; if [ $SRS_GPROF = YES ]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi SrsGprof=""; SrsGprofLink=""; if [ $SRS_GPROF = YES ]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi
# performance of gperf # performance of gperf
@ -244,7 +240,7 @@ fi
# #
#Service Module, for both Server and Client Modules. #Service Module, for both Server and Client Modules.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then # TODO: FIXME: Remove service module, https://github.com/ossrs/srs/issues/1535#issuecomment-633907655
MODULE_ID="SERVICE" MODULE_ID="SERVICE"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL") MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot}) ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot})
@ -257,10 +253,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
DEFINES="" DEFINES=""
SERVICE_INCS="src/service"; MODULE_DIR=${SERVICE_INCS} . auto/modules.sh SERVICE_INCS="src/service"; MODULE_DIR=${SERVICE_INCS} . auto/modules.sh
SERVICE_OBJS="${MODULE_OBJS[@]}" SERVICE_OBJS="${MODULE_OBJS[@]}"
fi
# #
#App Module, for SRS server only. #App Module, for SRS server only.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="APP" MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE") MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot} ${LibGperfRoot}) ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot} ${LibGperfRoot})
@ -294,7 +288,6 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
done done
APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh
APP_OBJS="${MODULE_OBJS[@]}" APP_OBJS="${MODULE_OBJS[@]}"
fi
# #
#LIBS Module, build libsrs.a for static link. #LIBS Module, build libsrs.a for static link.
MODULE_ID="LIBS" MODULE_ID="LIBS"
@ -305,7 +298,6 @@ LIBS_INCS="src/libs"; MODULE_DIR=${LIBS_INCS} . auto/modules.sh
LIBS_OBJS="${MODULE_OBJS[@]}" LIBS_OBJS="${MODULE_OBJS[@]}"
# #
#Server Module, for SRS only. #Server Module, for SRS only.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="SERVER" MODULE_ID="SERVER"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE" "APP") MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE" "APP")
if [[ $SRS_SRT == YES ]]; then if [[ $SRS_SRT == YES ]]; then
@ -321,10 +313,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_FILES=("srs_main_server") MODULE_FILES=("srs_main_server")
SERVER_INCS="src/main"; MODULE_DIR=${SERVER_INCS} . auto/modules.sh SERVER_INCS="src/main"; MODULE_DIR=${SERVER_INCS} . auto/modules.sh
SERVER_OBJS="${MODULE_OBJS[@]}" SERVER_OBJS="${MODULE_OBJS[@]}"
fi
# #
#Main Module, for app from modules. #Main Module, for app from modules.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="MAIN" MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE") MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot}) ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
@ -341,14 +331,12 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
done done
MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh
MAIN_OBJS="${MODULE_OBJS[@]}" MAIN_OBJS="${MODULE_OBJS[@]}"
fi
##################################################################################### #####################################################################################
# Binaries, main entrances, link the module and its depends modules, # Binaries, main entrances, link the module and its depends modules,
# then link to a binary, for example, objs/srs # then link to a binary, for example, objs/srs
# #
# Disable SRS application for exporting librtmp. # Disable SRS application for exporting librtmp.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# all main entrances # all main entrances
MAIN_ENTRANCES=("srs_main_server") MAIN_ENTRANCES=("srs_main_server")
for SRS_MODULE in ${SRS_MODULES[*]}; do for SRS_MODULE in ${SRS_MODULES[*]}; do
@ -391,7 +379,6 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
if [[ 0 -eq ${#SRS_MODULE_MAIN[@]} ]]; then continue; fi if [[ 0 -eq ${#SRS_MODULE_MAIN[@]} ]]; then continue; fi
BUILD_KEY="$SRS_MODULE_NAME" APP_MAIN="${SRS_MODULE_MAIN[0]}" APP_NAME="$SRS_MODULE_NAME" . auto/apps.sh BUILD_KEY="$SRS_MODULE_NAME" APP_MAIN="${SRS_MODULE_MAIN[0]}" APP_NAME="$SRS_MODULE_NAME" . auto/apps.sh
done done
fi
# srs librtmp # srs librtmp
if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_LIBRTMP = YES ]; then
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${LIBS_OBJS[@]}" MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${LIBS_OBJS[@]}"
@ -558,54 +545,25 @@ done
echo "" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} echo "" >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
# if export librtmp, donot build the srs server. # if export librtmp, donot build the srs server.
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
server: _prepare_dir
@echo "Ingore srs(simple rtmp server) for srs-librtmp"
END
else
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
server: _prepare_dir server: _prepare_dir
@echo "Build the srs(simple rtmp server) over ST(state-threads)" @echo "Build the srs(simple rtmp server) over ST(state-threads)"
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs \$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs
END END
fi
# generate all modules entry # generate all modules entry
for SRS_MODULE in ${SRS_MODULES[*]}; do for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config . $SRS_MODULE/config
# if export librtmp, donot build the bravo-ingest. # if export librtmp, donot build the bravo-ingest.
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
$SRS_MODULE_NAME: _prepare_dir server
@echo "Ingore the $SRS_MODULE_NAME for srs-librtmp"
END
else
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
$SRS_MODULE_NAME: _prepare_dir server $SRS_MODULE_NAME: _prepare_dir server
@echo "Build the $SRS_MODULE_NAME over SRS" @echo "Build the $SRS_MODULE_NAME over SRS"
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} $SRS_MODULE_NAME \$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} $SRS_MODULE_NAME
END END
fi
done done
# disable install entry for srs-librtmp # disable install entry for srs-librtmp
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
uninstall:
@echo "Disable uninstall for srs-librtmp"
install-api:
@echo "Disable install-api for srs-librtmp"
install:
@echo "Disable install for srs-librtmp"
END
else
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
uninstall: uninstall:
@echo "rmdir \$(SRS_PREFIX)" @echo "rmdir \$(SRS_PREFIX)"
@ -666,7 +624,6 @@ install:
@echo "@see: https://github.com/ossrs/srs/wiki/v3_CN_LinuxService" @echo "@see: https://github.com/ossrs/srs/wiki/v3_CN_LinuxService"
END END
fi
# generate srs-librtmp entry # generate srs-librtmp entry
if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_LIBRTMP = YES ]; then
@ -718,15 +675,12 @@ echo 'Configure ok! '
# when configure success, prepare build # when configure success, prepare build
##################################################################################### #####################################################################################
# create objs/logs for ffmpeg to write log. # create objs/logs for ffmpeg to write log.
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
mkdir -p ${SRS_OBJS}/logs mkdir -p ${SRS_OBJS}/logs
fi
##################################################################################### #####################################################################################
# configure summary # configure summary
##################################################################################### #####################################################################################
# summary # summary
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
echo "" echo ""
echo "Configure summary:" echo "Configure summary:"
echo " ${SRS_AUTO_USER_CONFIGURE}" echo " ${SRS_AUTO_USER_CONFIGURE}"
@ -845,7 +799,6 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
for SRS_MODULE in ${SRS_MODULES[*]}; do for SRS_MODULE in ${SRS_MODULES[*]}; do
echo -e "${GREEN}Enable module: $SRS_MODULE${BLACK}" echo -e "${GREEN}Enable module: $SRS_MODULE${BLACK}"
done done
fi
##################################################################################### #####################################################################################
# Do cleanup when configure done. # Do cleanup when configure done.
@ -858,7 +811,6 @@ fi
##################################################################################### #####################################################################################
# next step # next step
##################################################################################### #####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
echo "" echo ""
echo "You can run 3rdparty applications:" echo "You can run 3rdparty applications:"
if [ $SRS_HTTP_CALLBACK = YES ]; then if [ $SRS_HTTP_CALLBACK = YES ]; then
@ -868,23 +820,4 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
echo "You can build SRS:" echo "You can build SRS:"
echo "\" make \" to build the srs(simple rtmp server)." echo "\" make \" to build the srs(simple rtmp server)."
echo "\" make help \" to get the usage of make" echo "\" make help \" to get the usage of make"
else
# for srs-librtmp single file,
# package the whole project to srs_librtmp.h and srs_librtmp.cpp
if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then
echo "Packaging the whole project to srs_librtmp.h and srs_librtmp.cpp"
. $SRS_EXPORT_LIBRTMP_SINGLE/auto/generate-srs-librtmp-single.sh
echo -e "${GREEN}Please use the srs-librtmp files: ${BLACK}"
echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/srs_librtmp.h ${BLACK}"
echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/srs_librtmp.cpp ${BLACK}"
echo -e "${GREEN} $SRS_EXPORT_LIBRTMP_PROJECT/example.c ${BLACK}"
echo -e "${GREEN}To compile the example: ${BLACK}"
echo -e "${GREEN} cd $SRS_EXPORT_LIBRTMP_PROJECT && $SRS_SINGLE_LIBRTMP_COMPILE ${BLACK}"
# for srs-librtmp project.
else
echo -e "${GREEN}Please use the srs-librtmp project: ${BLACK}"
echo -e "${GREEN} cd $SRS_EXPORT_LIBRTMP_PROJECT && make ${BLACK}"
fi
# Change to experiment.
echo -e "${YELLOW}Warning: Notice srs-librtmp is deprecated and maybe removed in future.${BLACK}"
fi