From 926650840e36d97fb13290b3a39ffcb665952d6b Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 8 Nov 2014 16:45:50 +0800 Subject: [PATCH] fix #191, configure --export-librtmp. 2.0.10. --- README.md | 1 + trunk/auto/depends.sh | 133 ++++++++++++++++++++---------------- trunk/auto/libs.sh | 4 +- trunk/auto/modules.sh | 2 +- trunk/auto/summary.sh | 25 ++++++- trunk/auto/utest.sh | 2 +- trunk/configure | 14 ++-- trunk/src/core/srs_core.hpp | 2 +- 8 files changed, 111 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index ee65c1644..e873c04c5 100755 --- a/README.md +++ b/README.md @@ -228,6 +228,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History +* v2.0, 2014-11-08, fix [#191](https://github.com/winlinvip/simple-rtmp-server/issues/191), configure --export-librtmp. 2.0.10. * v2.0, 2014-11-08, fix [#66](https://github.com/winlinvip/simple-rtmp-server/issues/66), srs-librtmp support write h264 raw packet. 2.0.9. * v2.0, 2014-10-25, fix [#185](https://github.com/winlinvip/simple-rtmp-server/issues/185), AMF0 support 0x0B the date type codec. 2.0.7. * v2.0, 2014-10-24, fix [#186](https://github.com/winlinvip/simple-rtmp-server/issues/186), hotfix for bug #186, drop connect args when not object. 2.0.6. diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 89b4af760..67b200d26 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -125,7 +125,10 @@ function Ubuntu_prepare() echo "Ubuntu install tools success" return 0 } -Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi +# donot prepare tools, for srs-librtmp depends only gcc and g++. +if [ $SRS_EXPORT_LIBRTMP = NO ]; then + Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi +fi ##################################################################################### # for Centos, auto install tools by yum ##################################################################################### @@ -213,50 +216,55 @@ function Centos_prepare() echo "Centos install tools success" return 0 } -Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi +# donot prepare tools, for srs-librtmp depends only gcc and g++. +if [ $SRS_EXPORT_LIBRTMP = NO ]; then + Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi +fi ##################################################################################### # st-1.9 ##################################################################################### -# check the arm flag file, if flag changed, need to rebuild the st. -_ST_MAKE=linux-debug -if [ $SRS_EMBEDED_CPU = YES ]; then - # ok, arm specified, if the flag filed does not exists, need to rebuild. - if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then - echo "st-1.9t for arm is ok."; +if [ $SRS_EXPORT_LIBRTMP = NO ]; then + # check the arm flag file, if flag changed, need to rebuild the st. + _ST_MAKE=linux-debug + if [ $SRS_EMBEDED_CPU = YES ]; then + # ok, arm specified, if the flag filed does not exists, need to rebuild. + if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then + echo "st-1.9t for arm is ok."; + else + # TODO: FIXME: patch the bug. + # patch st for arm, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm#st-arm-bug-fix + echo "build st-1.9t for arm"; + ( + rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} && + unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && + patch -p0 < ../../3rdparty/patches/1.st.arm.patch && + make CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} EXTRA_CFLAGS="-DMD_HAVE_EPOLL" ${_ST_MAKE} && + cd .. && rm -rf st && ln -sf st-1.9/obj st && + cd .. && touch ${SRS_OBJS}/_flag.st.arm.tmp + ) + fi else - # TODO: FIXME: patch the bug. - # patch st for arm, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm#st-arm-bug-fix - echo "build st-1.9t for arm"; - ( - rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} && - unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && - patch -p0 < ../../3rdparty/patches/1.st.arm.patch && - make CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} EXTRA_CFLAGS="-DMD_HAVE_EPOLL" ${_ST_MAKE} && - cd .. && rm -rf st && ln -sf st-1.9/obj st && - cd .. && touch ${SRS_OBJS}/_flag.st.arm.tmp - ) - fi -else - if [[ ! -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then - echo "st-1.9t is ok."; - else - echo "build st-1.9t"; - ( - rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} && - unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && - echo "we alaways patch the st, for we may build srs under arm directly" && - echo "the 1.st.arm.patch is ok for x86 because it's only modify code under macro linux arm" && - patch -p0 < ../../3rdparty/patches/1.st.arm.patch && - make ${_ST_MAKE} && - cd .. && rm -rf st && ln -sf st-1.9/obj st && - cd .. && rm -f ${SRS_OBJS}/_flag.st.arm.tmp - ) + if [[ ! -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then + echo "st-1.9t is ok."; + else + echo "build st-1.9t"; + ( + rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} && + unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && + echo "we alaways patch the st, for we may build srs under arm directly" && + echo "the 1.st.arm.patch is ok for x86 because it's only modify code under macro linux arm" && + patch -p0 < ../../3rdparty/patches/1.st.arm.patch && + make ${_ST_MAKE} && + cd .. && rm -rf st && ln -sf st-1.9/obj st && + cd .. && rm -f ${SRS_OBJS}/_flag.st.arm.tmp + ) + fi fi + # check status + ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi + if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "build st-1.9 static lib failed."; exit -1; fi fi -# check status -ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi -if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "build st-1.9 static lib failed."; exit -1; fi ##################################################################################### # http-parser-2.1 @@ -335,7 +343,9 @@ function write_nginx_html5() END } # create the nginx dir, for http-server if not build nginx -mkdir -p ${SRS_OBJS}/nginx +if [ $SRS_EXPORT_LIBRTMP = NO ]; then + mkdir -p ${SRS_OBJS}/nginx +fi # make nginx __SRS_BUILD_NGINX=NO; if [ $SRS_EMBEDED_CPU = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi if [ $__SRS_BUILD_NGINX = YES ]; then @@ -361,31 +371,34 @@ if [ $__SRS_BUILD_NGINX = YES ]; then sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf fi -# create forward dir -mkdir -p ${SRS_OBJS}/nginx/html/live && -mkdir -p ${SRS_OBJS}/nginx/html/forward/live +# the demo dir. +if [ $SRS_EXPORT_LIBRTMP = NO ]; then + # 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 + # nginx.html to detect whether nginx is alive + echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html +fi if [ $SRS_NGINX = YES ]; then echo "#define SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H diff --git a/trunk/auto/libs.sh b/trunk/auto/libs.sh index 9f0597173..6e1eedaf9 100755 --- a/trunk/auto/libs.sh +++ b/trunk/auto/libs.sh @@ -57,7 +57,7 @@ done echo "" >> ${FILE} # parent Makefile, to create module output dir before compile it. -echo " mkdir -p ${SRS_OBJS_DIR}/include" >> ${SRS_MAKEFILE} -echo " mkdir -p ${SRS_OBJS_DIR}/lib" >> ${SRS_MAKEFILE} +echo " mkdir -p ${SRS_OBJS_DIR}/include" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} +echo " mkdir -p ${SRS_OBJS_DIR}/lib" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} echo -n "generate lib ${LIB_NAME} ok"; echo '!'; diff --git a/trunk/auto/modules.sh b/trunk/auto/modules.sh index d33114184..9b4af71b5 100755 --- a/trunk/auto/modules.sh +++ b/trunk/auto/modules.sh @@ -85,6 +85,6 @@ done echo "" >> ${FILE} # parent Makefile, to create module output dir before compile it. -echo " mkdir -p ${SRS_OBJS_DIR}/${MODULE_DIR}" >> ${SRS_MAKEFILE} +echo " mkdir -p ${SRS_OBJS_DIR}/${MODULE_DIR}" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} echo -n "generate module ${MODULE_ID} ok"; echo '!'; diff --git a/trunk/auto/summary.sh b/trunk/auto/summary.sh index 013299f6f..c4c55a04d 100755 --- a/trunk/auto/summary.sh +++ b/trunk/auto/summary.sh @@ -20,7 +20,9 @@ SrsGperfMCSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MC = YES ]; then 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 < ${SRS_OBJS}/${SRS_BUILD_SUMMARY} + +if [ $SRS_EXPORT_LIBRTMP = NO ]; then + cat < ${SRS_OBJS}/${SRS_BUILD_SUMMARY} #!/bin/bash ##################################################################################### @@ -94,7 +96,26 @@ echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manag 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 "You can:" echo " ./objs/srs -c conf/srs.conf" echo " to start the srs server, with config conf/srs.conf." END +else + cat < ${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/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}" +END +fi \ No newline at end of file diff --git a/trunk/auto/utest.sh b/trunk/auto/utest.sh index cff082af6..79477686f 100755 --- a/trunk/auto/utest.sh +++ b/trunk/auto/utest.sh @@ -176,6 +176,6 @@ END ##################################################################################### # parent Makefile, to create module output dir before compile it. -echo " mkdir -p ${SRS_OBJS_DIR}/utest" >> ${SRS_MAKEFILE} +echo " mkdir -p ${SRS_OBJS_DIR}/utest" >> ${SRS_WORKDIR}/${SRS_MAKEFILE} echo -n "generate utest ok"; echo '!'; diff --git a/trunk/configure b/trunk/configure index 3f33c9e48..2987ab18e 100755 --- a/trunk/configure +++ b/trunk/configure @@ -33,10 +33,12 @@ if [ $SRS_EXPORT_LIBRTMP != NO ]; then # 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} + _CPT=${SRS_EXPORT_LIBRTMP}/research/librtmp && mkdir -p ${_CPT} && cp research/librtmp/*.c research/librtmp/Makefile ${_CPT} && + _CPT=${SRS_EXPORT_LIBRTMP}/auto && mkdir -p ${_CPT} && cp auto/generate_header.sh ${_CPT} && + _CPT=${SRS_EXPORT_LIBRTMP}/src/core && mkdir -p ${_CPT} && cp src/core/* ${_CPT} && + _CPT=${SRS_EXPORT_LIBRTMP}/src/kernel && mkdir -p ${_CPT} && cp src/kernel/* ${_CPT} && + _CPT=${SRS_EXPORT_LIBRTMP}/src/rtmp && mkdir -p ${_CPT} && cp src/rtmp/* ${_CPT} && + _CPT=${SRS_EXPORT_LIBRTMP}/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 @@ -468,7 +470,9 @@ echo 'configure ok! ' # when configure success, prepare build ##################################################################################### # create objs/logs for ffmpeg to write log. -mkdir -p ${SRS_OBJS}/logs +if [ $SRS_EXPORT_LIBRTMP = NO ]; then + mkdir -p ${SRS_OBJS}/logs +fi ##################################################################################### # configure summary diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 1fe95b5d3..993aed8b0 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 2 #define VERSION_MINOR 0 -#define VERSION_REVISION 9 +#define VERSION_REVISION 10 // server info. #define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_ROLE "origin/edge server"