Merge branch 'srs.master'

pull/133/head
winlin 10 years ago
commit c4dacdb7f6

@ -1,7 +1,8 @@
# generate the binary # generate the binary
# #
# params: # params:
# $SRS_OBJS the objs directory. ie. objs # $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile # $SRS_MAKEFILE the makefile name. ie. Makefile
# #
# $MAIN_ENTRANCES array, disable all except the $APP_MAIN itself. ie. ["srs_main_server" "srs_main_bandcheck"] # $MAIN_ENTRANCES array, disable all except the $APP_MAIN itself. ie. ["srs_main_server" "srs_main_bandcheck"]
@ -14,7 +15,7 @@
FILE=${SRS_OBJS}/${SRS_MAKEFILE} FILE=${SRS_OBJS}/${SRS_MAKEFILE}
APP_TARGET="${SRS_OBJS}/${APP_NAME}" APP_TARGET="${SRS_OBJS_DIR}/${APP_NAME}"
echo "generate app ${APP_NAME} depends..."; echo "generate app ${APP_NAME} depends...";
@ -45,7 +46,7 @@ for item in ${MODULE_OBJS[*]}; do
continue; continue;
fi fi
OBJ_FILE=${SRS_OBJS}/$item OBJ_FILE=${SRS_OBJS_DIR}/$item
OBJ_FILE="${OBJ_FILE%.*}.o" OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE} echo -n "${OBJ_FILE} " >> ${FILE}
done done
@ -76,7 +77,7 @@ for item in ${MODULE_OBJS[*]}; do
continue; continue;
fi fi
OBJ_FILE=${SRS_OBJS}/$item OBJ_FILE=${SRS_OBJS_DIR}/$item
OBJ_FILE="${OBJ_FILE%.*}.o" OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE} echo -n "${OBJ_FILE} " >> ${FILE}
done done

@ -582,21 +582,23 @@ fi
##################################################################################### #####################################################################################
# build research code, librtmp # build research code, librtmp
##################################################################################### #####################################################################################
if [ $SRS_RESEARCH = YES ]; then if [ $SRS_EXPORT_LIBRTMP = NO ]; then
mkdir -p ${SRS_OBJS}/research if [ $SRS_RESEARCH = YES ]; then
mkdir -p ${SRS_OBJS}/research
(cd research/hls && make ${SRS_JOBS} && mv ts_info ../../${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 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}/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
# librtmp # librtmp
(cd research/librtmp && mkdir -p objs && ln -sf `pwd`/objs ../../${SRS_OBJS}/research/librtmp) (cd ${SRS_WORKDIR}/research/librtmp && mkdir -p objs && ln -sf `pwd`/objs ../../${SRS_OBJS_DIR}/research/librtmp)
ret=$?; if [[ $ret -ne 0 ]]; then echo "link research/librtmp failed, ret=$ret"; exit $ret; fi ret=$?; if [[ $ret -ne 0 ]]; then echo "link research/librtmp failed, ret=$ret"; exit $ret; fi
fi fi

@ -1,7 +1,8 @@
# generate the library for static link. # generate the library for static link.
# #
# params: # params:
# $SRS_OBJS the objs directory. ie. objs # $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile # $SRS_MAKEFILE the makefile name. ie. Makefile
# #
# $BUILD_KEY a string indicates the build key for Makefile. ie. dump # $BUILD_KEY a string indicates the build key for Makefile. ie. dump
@ -10,7 +11,7 @@
FILE=${SRS_OBJS}/${SRS_MAKEFILE} FILE=${SRS_OBJS}/${SRS_MAKEFILE}
LIB_TARGET="${SRS_OBJS}/${LIB_NAME}" LIB_TARGET="${SRS_OBJS_DIR}/${LIB_NAME}"
LIB_TAGET_STATIC="${LIB_TARGET}.a" LIB_TAGET_STATIC="${LIB_TARGET}.a"
echo "generate lib ${LIB_NAME} depends..." echo "generate lib ${LIB_NAME} depends..."
@ -29,14 +30,14 @@ for item in ${MODULE_OBJS[*]}; do
continue; continue;
fi fi
OBJ_FILE=${SRS_OBJS}/$item OBJ_FILE=${SRS_OBJS_DIR}/$item
OBJ_FILE="${OBJ_FILE%.*}.o" OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE} echo -n "${OBJ_FILE} " >> ${FILE}
done done
echo "" >> ${FILE} echo "" >> ${FILE}
# build header file # build header file
echo -n " @bash auto/generate_header.sh ${SRS_OBJS}" >> ${FILE} echo -n " @bash auto/generate_header.sh ${SRS_OBJS_DIR}" >> ${FILE}
echo "" >> ${FILE} echo "" >> ${FILE}
# archive librtmp.a # archive librtmp.a
@ -49,14 +50,14 @@ for item in ${MODULE_OBJS[*]}; do
continue; continue;
fi fi
OBJ_FILE=${SRS_OBJS}/$item OBJ_FILE=${SRS_OBJS_DIR}/$item
OBJ_FILE="${OBJ_FILE%.*}.o" OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE} echo -n "${OBJ_FILE} " >> ${FILE}
done done
echo "" >> ${FILE} echo "" >> ${FILE}
# parent Makefile, to create module output dir before compile it. # parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS}/include" >> ${SRS_MAKEFILE} echo " mkdir -p ${SRS_OBJS_DIR}/include" >> ${SRS_MAKEFILE}
echo " mkdir -p ${SRS_OBJS}/lib" >> ${SRS_MAKEFILE} echo " mkdir -p ${SRS_OBJS_DIR}/lib" >> ${SRS_MAKEFILE}
echo -n "generate lib ${LIB_NAME} ok"; echo '!'; echo -n "generate lib ${LIB_NAME} ok"; echo '!';

@ -1,7 +1,8 @@
# generate the module info to Makefile # generate the module info to Makefile
# #
# params: # params:
# $SRS_OBJS the objs directory. ie. objs # $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile # $SRS_MAKEFILE the makefile name. ie. Makefile
# #
# $MODULE_DIR the module dir. ie. src/os/linux # $MODULE_DIR the module dir. ie. src/os/linux
@ -73,7 +74,7 @@ echo "# OBJ for ${MODULE_ID}, each object file" >> ${FILE}
MODULE_OBJS=() MODULE_OBJS=()
for item in ${MODULE_FILES[*]}; do for item in ${MODULE_FILES[*]}; do
CPP_FILE="${MODULE_DIR}/${item}.cpp" CPP_FILE="${MODULE_DIR}/${item}.cpp"
OBJ_FILE="${SRS_OBJS}/${MODULE_DIR}/${item}.o" OBJ_FILE="${SRS_OBJS_DIR}/${MODULE_DIR}/${item}.o"
MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}" MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}"
if [ -f ${CPP_FILE} ]; then if [ -f ${CPP_FILE} ]; then
echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE} echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE}
@ -84,6 +85,6 @@ done
echo "" >> ${FILE} echo "" >> ${FILE}
# parent Makefile, to create module output dir before compile it. # parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS}/${MODULE_DIR}" >> ${SRS_MAKEFILE} echo " mkdir -p ${SRS_OBJS_DIR}/${MODULE_DIR}" >> ${SRS_MAKEFILE}
echo -n "generate module ${MODULE_ID} ok"; echo '!'; echo -n "generate module ${MODULE_ID} ok"; echo '!';

@ -58,6 +58,8 @@ SRS_LOG_TRACE=RESERVED
# experts # experts
# donot compile ssl, use system ssl(-lssl) if required. # donot compile ssl, use system ssl(-lssl) if required.
SRS_USE_SYS_SSL=NO SRS_USE_SYS_SSL=NO
# export the srs-librtmp to specified path, NO to disable it.
SRS_EXPORT_LIBRTMP=NO
# #
################################################################ ################################################################
# presets # presets
@ -182,6 +184,7 @@ Conflicts:
Experts: Experts:
--use-sys-ssl donot compile ssl, use system ssl(-lssl) if required. --use-sys-ssl donot compile ssl, use system ssl(-lssl) if required.
--export-librtmp=<path> export srs-librtmp to specified path.
Workflow: Workflow:
1. apply "Presets". if not specified, use default preset. 1. apply "Presets". if not specified, use default preset.
@ -263,6 +266,7 @@ function parse_user_option() {
--full) SRS_ENABLE_ALL=YES ;; --full) SRS_ENABLE_ALL=YES ;;
--use-sys-ssl) SRS_USE_SYS_SSL=YES ;; --use-sys-ssl) SRS_USE_SYS_SSL=YES ;;
--export-librtmp) SRS_EXPORT_LIBRTMP=${value} ;;
*) *)
echo "$0: error: invalid option \"$option\"" echo "$0: error: invalid option \"$option\""
@ -696,6 +700,31 @@ function apply_user_detail_options() {
else else
export SRS_JOBS="--jobs=${SRS_JOBS}" export SRS_JOBS="--jobs=${SRS_JOBS}"
fi fi
# disable almost all features for export srs-librtmp.
if [ $SRS_EXPORT_LIBRTMP != NO ]; then
SRS_HLS=NO
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=NO
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_PARSER=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=YES
SRS_RESEARCH=YES
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
} }
apply_user_detail_options apply_user_detail_options

@ -0,0 +1,100 @@
#!/bin/bash
# colorful summary
SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi
SrsDvrSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_DVR = YES ]; then SrsDvrSummaryColor="\${GREEN}"; fi
SrsNginxSummaryColor="\${GREEN}{disabled} "; if [ $SRS_NGINX = YES ]; then SrsNginxSummaryColor="\${GREEN}"; fi
SrsSslSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\${GREEN}"; fi
SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG_TOOL = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi
SrsTranscodeSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_TRANSCODE = YES ]; then SrsTranscodeSummaryColor="\${GREEN}"; fi
SrsIngestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_INGEST = YES ]; then SrsIngestSummaryColor="\${GREEN}"; fi
SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi
SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi
SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi
SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi
SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi
SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi
SrsUtestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\${GREEN}"; fi
SrsGperfSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\${GREEN}"; fi
SrsGperfMCSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\${YELLOW}"; fi
SrsGperfMPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\${YELLOW}"; fi
SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
#!/bin/bash
#####################################################################################
# linux shell color support.
RED="\\${RED}"
GREEN="\\${GREEN}"
YELLOW="\\${YELLOW}"
BLACK="\\${BLACK}"
echo -e "\${GREEN}build summary:\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsGperfSummaryColor}gperf @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_GPERF\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}gmc @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}gmc: gperf memory check\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/console.conf # start gmc\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}gmp @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}gmp: gperf memory profile\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}rm -f gperf.srs.gmp*; ./objs/srs -c conf/console.conf # start gmp\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmp\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gmp* # to analysis memory profile\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}gcp @see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}gcp: gperf cpu profile\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}rm -f gperf.srs.gcp*; ./objs/srs -c conf/console.conf # start gcp\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}killall -2 srs # or CTRL+C to stop gcp\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gcp* # to analysis cpu profile\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsGprofSummaryColor}gprof @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_GPROF\${BLACK}"
echo -e " |${SrsGprofSummaryColor}gprof: GNU profile tool, @see: http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/console.conf # start gprof\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp\${BLACK}"
echo -e " |${SrsLibrtmpSummaryColor}librtmp: ./objs/include, ./objs/lib, the srs-librtmp library\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}simple handshake: publish/play stream with simple handshake to server\${BLACK}"
echo -e " | ${SrsLibrtmpSSLSummaryColor}complex handshake: it's not required for client, recommend disable it\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp, the srs-librtmp client sample\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_ingest_flv\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_ingest_rtmp\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_detect_rtmp\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx: sudo ./objs/nginx/sbin/nginx\${BLACK}"
echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMPHandshake\${BLACK}"
echo -e " | ${SrsSslSummaryColor}ssl: support RTMP complex handshake for client required, for instance, flash\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: transcode, mux, ingest tool\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: ./objs/ffmpeg/bin/ffmpeg\${BLACK}"
echo -e " | ${SrsTranscodeSummaryColor}transcode @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG\${BLACK}"
echo -e " | ${SrsTranscodeSummaryColor}transcode: support transcoding RTMP stream\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}ingest @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}ingest: support ingest file/stream/device then push to SRS by RTMP stream\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}http-callback @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}http-callback: support http callback for authentication and event injection\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}http-server @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}http-server: support http server to delivery http stream\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build\${BLACK}"
echo "you can:"
echo " ./objs/srs -c conf/srs.conf"
echo " to start the srs server, with config conf/srs.conf."
END

@ -1,7 +1,8 @@
# generate utest Makefile # generate utest Makefile
# #
# params: # params:
# $SRS_OBJS the objs directory. ie. objs # $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile # $SRS_MAKEFILE the makefile name. ie. Makefile
# #
# $APP_NAME the app name to output. ie. srs_utest # $APP_NAME the app name to output. ie. srs_utest
@ -17,10 +18,10 @@ mkdir -p ${SRS_OBJS}/utest
# trunk of srs, which contains the src dir, relative to objs/utest, it's trunk # trunk of srs, which contains the src dir, relative to objs/utest, it's trunk
SRS_TRUNK_PREFIX=../.. SRS_TRUNK_PREFIX=../..
# gest dir, relative to objs/utest, it's trunk/objs/gtest # gest dir, relative to objs/utest, it's trunk/objs/gtest
GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS}/gtest GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/gtest
cat << END > ${FILE} cat << END > ${FILE}
# user must run make the ${SRS_OBJS}/utest dir # user must run make the ${SRS_OBJS_DIR}/utest dir
# at the same dir of Makefile. # at the same dir of Makefile.
# A sample Makefile for building Google Test and using it in user # A sample Makefile for building Google Test and using it in user
@ -52,7 +53,7 @@ CXXFLAGS += -g -Wall -Wextra -O0
# All tests produced by this Makefile. Remember to add new tests you # All tests produced by this Makefile. Remember to add new tests you
# created to the list. # created to the list.
TESTS = ${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${APP_NAME} TESTS = ${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/${APP_NAME}
# All Google Test headers. Usually you shouldn't change this # All Google Test headers. Usually you shouldn't change this
# definition. # definition.
@ -129,7 +130,7 @@ echo "# Depends, the depends objects" >> ${FILE}
echo -n "SRS_UTEST_DEPS = " >> ${FILE} echo -n "SRS_UTEST_DEPS = " >> ${FILE}
for item in ${MODULE_OBJS[*]}; do for item in ${MODULE_OBJS[*]}; do
FILE_NAME=${item%.*} FILE_NAME=${item%.*}
echo -n "${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${FILE_NAME}.o " >> ${FILE} echo -n "${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/${FILE_NAME}.o " >> ${FILE}
done done
echo "" >> ${FILE}; echo "" >> ${FILE} echo "" >> ${FILE}; echo "" >> ${FILE}
# #
@ -169,12 +170,12 @@ echo "" >> ${FILE}; echo "" >> ${FILE}
# #
echo "# generate the utest binary" >> ${FILE} echo "# generate the utest binary" >> ${FILE}
cat << END >> ${FILE} cat << END >> ${FILE}
${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${APP_NAME} : \$(SRS_UTEST_DEPS) ${MODULE_OBJS} gtest_main.a ${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/${APP_NAME} : \$(SRS_UTEST_DEPS) ${MODULE_OBJS} gtest_main.a
\$(CXX) -o \$@ \$(CPPFLAGS) \$(CXXFLAGS) \$^ \$(DEPS_LIBRARIES_FILES) ${LINK_OPTIONS} \$(CXX) -o \$@ \$(CPPFLAGS) \$(CXXFLAGS) \$^ \$(DEPS_LIBRARIES_FILES) ${LINK_OPTIONS}
END END
##################################################################################### #####################################################################################
# parent Makefile, to create module output dir before compile it. # parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS}/utest" >> ${SRS_MAKEFILE} echo " mkdir -p ${SRS_OBJS_DIR}/utest" >> ${SRS_MAKEFILE}
echo -n "generate utest ok"; echo '!'; echo -n "generate utest ok"; echo '!';

299
trunk/configure vendored

@ -4,7 +4,9 @@
# the main output dir, all configure and make output are in this dir. # the main output dir, all configure and make output are in this dir.
##################################################################################### #####################################################################################
# create the main objs # create the main objs
SRS_OBJS="objs" SRS_WORKDIR="."
SRS_OBJS_DIR="objs"
SRS_OBJS="${SRS_WORKDIR}/${SRS_OBJS_DIR}"
mkdir -p ${SRS_OBJS} mkdir -p ${SRS_OBJS}
##################################################################################### #####################################################################################
@ -19,14 +21,35 @@ BLACK="\\e[0m"
# srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/...... # srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/......
# build options: SRS_JOBS # build options: SRS_JOBS
##################################################################################### #####################################################################################
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
# parse options, exit with error when parse options invalid. # parse options, exit with error when parse options invalid.
. auto/options.sh . auto/options.sh
# clean the exists # for export srs-librtmp, change target to it.
if [ $SRS_EXPORT_LIBRTMP != NO ]; then
if [[ -d ${SRS_EXPORT_LIBRTMP} ]]; then
echo -e "${RED}srs-librtmp target dir exists: ${SRS_EXPORT_LIBRTMP}. ${BLACK}"
exit 1
fi
# create target
SRS_WORKDIR=${SRS_EXPORT_LIBRTMP} && SRS_OBJS=${SRS_WORKDIR}/${SRS_OBJS_DIR} && mkdir -p ${SRS_OBJS} &&
# copy src to target
_CPT=${SRS_EXPORT_LIBRTMP}/3rdparty && mkdir -p ${_CPT} && cp 3rdparty/st-1.9.zip ${_CPT} &&
_CPT=${SRS_EXPORT_LIBRTMP}/3rdparty/patches && mkdir -p ${_CPT} && cp 3rdparty/patches/1.st.arm.patch ${_CPT} &&
_CPT=${SRS_EXPORT_LIBRTMP}/research/librtmp && mkdir -p ${_CPT} && cp research/librtmp/*.c ${_CPT} && cp research/librtmp/Makefile ${_CPT} &&
_CPT=${SRS_EXPORT_LIBRTMP}/src/core && mkdir -p ${_CPT} && cp src/core/* ${_CPT}
# check ret
ret=$?; if [[ $ret -ne 0 ]]; then echo "export src failed, ret=$ret"; exit $ret; fi
fi
# the auto generated variables.
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
# clean the exists, when not export srs-librtmp.
# do this only when the options is ok. # do this only when the options is ok.
if [[ -f Makefile ]]; then if [ $SRS_EXPORT_LIBRTMP = NO ]; then
make clean if [[ -f Makefile ]]; then
make clean
fi
fi fi
# write user options to headers # write user options to headers
@ -99,112 +122,16 @@ SrsLibrtmpSampleEntry="nossl"
if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi
# utest make entry, (cd utest; make) # utest make entry, (cd utest; make)
SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\"" SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\""
if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE))"; fi if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS_DIR}/utest; \$(MAKE))"; fi
##################################################################################### #####################################################################################
# colorful summary # generate colorful summary script
SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi . auto/summary.sh
SrsDvrSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_DVR = YES ]; then SrsDvrSummaryColor="\${GREEN}"; fi
SrsNginxSummaryColor="\${GREEN}{disabled} "; if [ $SRS_NGINX = YES ]; then SrsNginxSummaryColor="\${GREEN}"; fi
SrsSslSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\${GREEN}"; fi
SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG_TOOL = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi
SrsTranscodeSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_TRANSCODE = YES ]; then SrsTranscodeSummaryColor="\${GREEN}"; fi
SrsIngestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_INGEST = YES ]; then SrsIngestSummaryColor="\${GREEN}"; fi
SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi
SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi
SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi
SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi
SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi
SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi
SrsUtestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\${GREEN}"; fi
SrsGperfSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\${GREEN}"; fi
SrsGperfMCSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\${YELLOW}"; fi
SrsGperfMPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\${YELLOW}"; fi
SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
#!/bin/bash
#####################################################################################
# linux shell color support.
RED="\\${RED}"
GREEN="\\${GREEN}"
YELLOW="\\${YELLOW}"
BLACK="\\${BLACK}"
echo -e "\${GREEN}build summary:\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsGperfSummaryColor}gperf @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_GPERF\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}gmc @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}gmc: gperf memory check\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/console.conf # start gmc\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}gmp @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}gmp: gperf memory profile\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}rm -f gperf.srs.gmp*; ./objs/srs -c conf/console.conf # start gmp\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmp\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gmp* # to analysis memory profile\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}gcp @see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}gcp: gperf cpu profile\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}rm -f gperf.srs.gcp*; ./objs/srs -c conf/console.conf # start gcp\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}killall -2 srs # or CTRL+C to stop gcp\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gcp* # to analysis cpu profile\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsGprofSummaryColor}gprof @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_GPROF\${BLACK}"
echo -e " |${SrsGprofSummaryColor}gprof: GNU profile tool, @see: http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/console.conf # start gprof\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp\${BLACK}"
echo -e " |${SrsLibrtmpSummaryColor}librtmp: ./objs/include, ./objs/lib, the srs-librtmp library\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}simple handshake: publish/play stream with simple handshake to server\${BLACK}"
echo -e " | ${SrsLibrtmpSSLSummaryColor}complex handshake: it's not required for client, recommend disable it\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp, the srs-librtmp client sample\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_ingest_flv\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_ingest_rtmp\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_detect_rtmp\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx: sudo ./objs/nginx/sbin/nginx\${BLACK}"
echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMPHandshake\${BLACK}"
echo -e " | ${SrsSslSummaryColor}ssl: support RTMP complex handshake for client required, for instance, flash\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: transcode, mux, ingest tool\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: ./objs/ffmpeg/bin/ffmpeg\${BLACK}"
echo -e " | ${SrsTranscodeSummaryColor}transcode @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG\${BLACK}"
echo -e " | ${SrsTranscodeSummaryColor}transcode: support transcoding RTMP stream\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}ingest @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}ingest: support ingest file/stream/device then push to SRS by RTMP stream\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}http-callback @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}http-callback: support http callback for authentication and event injection\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}http-server @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}http-server: support http server to delivery http stream\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build\${BLACK}"
echo "you can:"
echo " ./objs/srs -c conf/srs.conf"
echo " to start the srs server, with config conf/srs.conf."
END
##################################################################################### #####################################################################################
# makefile # makefile
echo "generate Makefile" echo "generate Makefile"
cat << END > ${SRS_MAKEFILE} cat << END > ${SRS_WORKDIR}/${SRS_MAKEFILE}
.PHONY: default _default install install-api help clean server librtmp utest _prepare_dir .PHONY: default _default install install-api help clean server librtmp utest _prepare_dir
# install prefix. # install prefix.
@ -215,22 +142,24 @@ END
# embeded, ubuntu12, use embeded tool chain. # embeded, ubuntu12, use embeded tool chain.
if [ $SRS_EMBEDED_CPU = YES ]; then if [ $SRS_EMBEDED_CPU = YES ]; then
cat << END >> ${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
default: default:
\$(MAKE) GCC=${SrsArmGCC} CXX=${SrsArmCXX} AR=${SrsArmAR} LINK=${SrsArmCXX} _default \$(MAKE) GCC=${SrsArmGCC} CXX=${SrsArmCXX} AR=${SrsArmAR} LINK=${SrsArmCXX} _default
END END
# x86/x64, use gnu-gcc/g++ tool chain. # x86/x64, use gnu-gcc/g++ tool chain.
else else
cat << END >> ${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
default: default:
\$(MAKE) _default \$(MAKE) _default
END END
fi fi
# the real entry for all platform. # the real entry for all platform:
cat << END >> ${SRS_MAKEFILE} # the server, librtmp and utest
# where the bellow will check and disable some entry by only echo.
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
_default: server librtmp utest _default: server librtmp utest
@bash objs/_srs_build_summary.sh @bash objs/_srs_build_summary.sh
@ -246,20 +175,45 @@ help:
@echo " uninstall uninstall srs from prefix path" @echo " uninstall uninstall srs from prefix path"
clean: clean:
(cd ${SRS_OBJS}; rm -rf srs srs_utest) (cd ${SRS_OBJS_DIR}; rm -rf srs srs_utest)
(cd ${SRS_OBJS}; rm -rf src research include lib) (cd ${SRS_OBJS_DIR}; rm -rf src research include lib)
(cd ${SRS_OBJS}/utest; rm -rf *.o *.a) (cd ${SRS_OBJS_DIR}/utest; rm -rf *.o *.a)
(cd research/librtmp; make clean) (cd research/librtmp; make clean)
(cd research/api-server/static-dir; rm -rf crossdomain.xml forward live players) (cd research/api-server/static-dir; rm -rf crossdomain.xml forward live players)
END
# if export librtmp, donot build the srs server.
if [ $SRS_EXPORT_LIBRTMP != NO ]; then
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
server: _prepare_dir
@echo "donot build the srs(simple rtmp server) for srs-librtmp"
END
else
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}/${SRS_MAKEFILE} srs \$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs
END END
fi
# install entry # disable install entry for srs-librtmp
cat << END >> ${SRS_MAKEFILE} if [ $SRS_EXPORT_LIBRTMP != 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}
uninstall: uninstall:
@echo "rmdir \$(SRS_PREFIX)" @echo "rmdir \$(SRS_PREFIX)"
@rm -rf \$(SRS_PREFIX) @rm -rf \$(SRS_PREFIX)
@ -311,18 +265,20 @@ install:
@echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_LinuxService" @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_LinuxService"
END END
fi
# generate srs-librtmp entry
if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_LIBRTMP = YES ]; then
cat << END >> ${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
librtmp: server librtmp: server
@echo "build the client publish/play library." @echo "build the client publish/play library."
\$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} librtmp \$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} librtmp
@echo "build the srs-librtmp sample" @echo "build the srs-librtmp sample"
(cd research/librtmp; \$(MAKE) ${SrsLibrtmpSampleEntry}) (cd research/librtmp; \$(MAKE) ${SrsLibrtmpSampleEntry})
END END
else else
cat << END >> ${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
librtmp: server librtmp: server
@echo "srs-librtmp is disabled, ignore." @echo "srs-librtmp is disabled, ignore."
@ -330,7 +286,7 @@ END
fi fi
if [ $SRS_UTEST = YES ]; then if [ $SRS_UTEST = YES ]; then
cat << END >> ${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
utest: server utest: server
@echo "build the utest for srs" @echo "build the utest for srs"
${SrsUtestMakeEntry} ${SrsUtestMakeEntry}
@ -338,17 +294,17 @@ utest: server
END END
else else
cat << END >> ${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
utest: server utest: server
@echo "utest is disabled, ignore" @echo "utest is disabled, ignore"
END END
fi fi
cat << END >> ${SRS_MAKEFILE} cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
# the ./configure will generate it. # the ./configure will generate it.
_prepare_dir: _prepare_dir:
@mkdir -p ${SRS_OBJS} @mkdir -p ${SRS_OBJS_DIR}
END END
##################################################################################### #####################################################################################
@ -387,16 +343,16 @@ END
# library(.a): add to ModuleLibFiles if binary need the specifeid library. for example, LibSTfile # library(.a): add to ModuleLibFiles if binary need the specifeid library. for example, LibSTfile
# #
# st(state-threads) the basic network library for SRS. # st(state-threads) the basic network library for SRS.
LibSTRoot="${SRS_OBJS}/st"; LibSTfile="${LibSTRoot}/libst.a" LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a"
# hp(http-parser) the http request/url parser, for SRS to support HTTP callback. # hp(http-parser) the http request/url parser, for SRS to support HTTP callback.
LibHttpParserRoot=""; LibHttpParserfile="" LibHttpParserRoot=""; LibHttpParserfile=""
if [ $SRS_HTTP_PARSER = YES ]; then LibHttpParserRoot="${SRS_OBJS}/hp"; LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"; fi if [ $SRS_HTTP_PARSER = YES ]; then LibHttpParserRoot="${SRS_OBJS_DIR}/hp"; LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"; fi
# openssl-1.0.1f, for the RTMP complex handshake. # openssl-1.0.1f, for the RTMP complex handshake.
LibSSLRoot="";LibSSLfile="" LibSSLRoot="";LibSSLfile=""
if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS_OBJS}/openssl/include"; LibSSLfile="${SRS_OBJS}/openssl/lib/libssl.a ${SRS_OBJS}/openssl/lib/libcrypto.a"; fi fi if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS_OBJS_DIR}/openssl/include"; LibSSLfile="${SRS_OBJS_DIR}/openssl/lib/libssl.a ${SRS_OBJS_DIR}/openssl/lib/libcrypto.a"; fi fi
# gperftools-2.1, for mem check and mem/cpu profile # gperftools-2.1, for mem check and mem/cpu profile
LibGperfRoot=""; LibGperfFile="" LibGperfRoot=""; LibGperfFile=""
if [ $SRS_GPERF = YES ]; then LibGperfRoot="${SRS_OBJS}/gperf/include"; LibGperfFile="${SRS_OBJS}/gperf/lib/libtcmalloc_and_profiler.a"; fi if [ $SRS_GPERF = YES ]; then LibGperfRoot="${SRS_OBJS_DIR}/gperf/include"; LibGperfFile="${SRS_OBJS_DIR}/gperf/lib/libtcmalloc_and_profiler.a"; fi
# the link options, always use static link # the link options, always use static link
SrsLinkOptions="-ldl"; SrsLinkOptions="-ldl";
if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = YES ]; then SrsLinkOptions="${SrsLinkOptions} -lssl"; fi fi if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = YES ]; then SrsLinkOptions="${SrsLinkOptions} -lssl"; fi fi
@ -412,7 +368,7 @@ if [ $SRS_MIPS_UBUNTU12 = YES ]; then SrsLinkOptions="${SrsLinkOptions} -lgcc_eh
#Core, depends only on system apis. #Core, depends only on system apis.
MODULE_ID="CORE" MODULE_ID="CORE"
MODULE_DEPENDS=() MODULE_DEPENDS=()
ModuleLibIncs=(${SRS_OBJS}) ModuleLibIncs=(${SRS_OBJS_DIR})
MODULE_FILES=("srs_core" "srs_core_autofree") MODULE_FILES=("srs_core" "srs_core_autofree")
CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . auto/modules.sh CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . auto/modules.sh
CORE_OBJS="${MODULE_OBJS[@]}" CORE_OBJS="${MODULE_OBJS[@]}"
@ -420,7 +376,7 @@ CORE_OBJS="${MODULE_OBJS[@]}"
#Kernel, depends on core, provides error/log/config, nothing about stream information. #Kernel, depends on core, provides error/log/config, nothing about stream information.
MODULE_ID="KERNEL" MODULE_ID="KERNEL"
MODULE_DEPENDS=("CORE") MODULE_DEPENDS=("CORE")
ModuleLibIncs=(${SRS_OBJS}) ModuleLibIncs=(${SRS_OBJS_DIR})
MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_stream" "srs_kernel_buffer" MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_stream" "srs_kernel_buffer"
"srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_file" "srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_file"
"srs_kernel_consts") "srs_kernel_consts")
@ -430,57 +386,64 @@ KERNEL_OBJS="${MODULE_OBJS[@]}"
#RTMP Protocol, depends on core/kernel, provides rtmp/htttp protocol features. #RTMP Protocol, depends on core/kernel, provides rtmp/htttp protocol features.
MODULE_ID="RTMP" MODULE_ID="RTMP"
MODULE_DEPENDS=("CORE" "KERNEL") MODULE_DEPENDS=("CORE" "KERNEL")
ModuleLibIncs=(${SRS_OBJS} ${LibSSLRoot}) ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot})
MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_protocol_stack" "srs_protocol_rtmp" MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_protocol_stack" "srs_protocol_rtmp"
"srs_protocol_handshake" "srs_protocol_utility" "srs_protocol_msg_array") "srs_protocol_handshake" "srs_protocol_utility" "srs_protocol_msg_array")
RTMP_INCS="src/rtmp"; MODULE_DIR=${RTMP_INCS} . auto/modules.sh RTMP_INCS="src/rtmp"; MODULE_DIR=${RTMP_INCS} . auto/modules.sh
RTMP_OBJS="${MODULE_OBJS[@]}" RTMP_OBJS="${MODULE_OBJS[@]}"
# #
#App Module #App Module
MODULE_ID="APP" if [ $SRS_EXPORT_LIBRTMP = NO ]; then
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP") MODULE_ID="APP"
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS}) MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_st_socket" "srs_app_source" ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS_DIR})
"srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http" MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_st_socket" "srs_app_source"
"srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config" "srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http"
"srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" "srs_app_http_conn" "srs_app_http_hooks" "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config"
"srs_app_json" "srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_dvr" "srs_app_edge" "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" "srs_app_http_conn" "srs_app_http_hooks"
"srs_app_kbps" "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_avc_aac") "srs_app_json" "srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_dvr" "srs_app_edge"
APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh "srs_app_kbps" "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_avc_aac")
APP_OBJS="${MODULE_OBJS[@]}" APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh
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"
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP") MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
ModuleLibIncs=(${SRS_OBJS}) ModuleLibIncs=(${SRS_OBJS_DIR})
MODULE_FILES=("srs_librtmp" "srs_lib_simple_socket" "srs_lib_bandwidth") MODULE_FILES=("srs_librtmp" "srs_lib_simple_socket" "srs_lib_bandwidth")
LIBS_INCS="src/libs"; MODULE_DIR=${LIBS_INCS} . auto/modules.sh LIBS_INCS="src/libs"; MODULE_DIR=${LIBS_INCS} . auto/modules.sh
LIBS_OBJS="${MODULE_OBJS[@]}" LIBS_OBJS="${MODULE_OBJS[@]}"
# #
#Main Module #Main Module
MODULE_ID="MAIN" if [ $SRS_EXPORT_LIBRTMP = NO ]; then
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") MODULE_ID="MAIN"
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS} ${LibGperfRoot}) MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
MODULE_FILES=("srs_main_server") ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot})
MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh MODULE_FILES=("srs_main_server")
MAIN_OBJS="${MODULE_OBJS[@]}" MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh
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
# #
# all main entrances # disable all app when export librtmp
MAIN_ENTRANCES=("srs_main_server") if [ $SRS_EXPORT_LIBRTMP = NO ]; then
# # all main entrances
# all depends libraries MAIN_ENTRANCES=("srs_main_server")
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile}) #
# all depends objects # all depends libraries
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}" ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile})
LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}" # all depends objects
# MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
# srs: LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
# srs(simple rtmp server) over st(state-threads) #
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh # srs:
# srs(simple rtmp server) over st(state-threads)
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
fi
# srs librtmp # srs librtmp
if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_LIBRTMP = YES ]; then
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${LIBS_OBJS[@]}" MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${LIBS_OBJS[@]}"
@ -488,14 +451,16 @@ if [ $SRS_LIBRTMP = YES ]; then
fi fi
# #
# utest, the unit-test cases of srs, base on gtest1.6 # utest, the unit-test cases of srs, base on gtest1.6
MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol" if [ $SRS_UTEST = YES ]; then
"srs_utest_kernel" "srs_utest_core" "srs_utest_config" MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol"
"srs_utest_reload") "srs_utest_kernel" "srs_utest_core" "srs_utest_config"
ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibSSLRoot}) "srs_utest_reload")
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile}) ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibSSLRoot})
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile})
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]}" MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]}"
LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh
fi
echo 'configure ok! ' echo 'configure ok! '

Loading…
Cancel
Save