From a9da5903f6469c8fa94e6c5c094813a23a21052a Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 16 Mar 2014 20:16:42 +0800 Subject: [PATCH] arm support ssl/hls, change to 0.9.17 --- trunk/auto/depends.sh | 281 +++++++++++++++++++++++------------- trunk/auto/options.sh | 77 +++++++--- trunk/configure | 43 +++++- trunk/src/core/srs_core.hpp | 2 +- 4 files changed, 274 insertions(+), 129 deletions(-) diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index ddff1073a..9b838b0a3 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -1,7 +1,8 @@ #!/bin/bash -# variables: -# SRS_JOBS: the build jobs, parent script must set it. +# variables, parent script must set it: +# SRS_JOBS: the build jobs. +# SrsArmMakeOptions: the arm make options for ubuntu12(armhf, v7cpu) ##################################################################################### ##################################################################################### @@ -33,7 +34,7 @@ function Ubuntu_prepare() { uname -v|grep Ubuntu >/dev/null 2>&1 ret=$?; if [[ 0 -ne $ret ]]; then - return; + return 0; fi echo "Ubuntu detected, install tools if needed" @@ -41,69 +42,80 @@ function Ubuntu_prepare() gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install gcc" require_sudoer "sudo apt-get install -y --force-yes gcc" - sudo apt-get install -y --force-yes gcc + sudo apt-get install -y --force-yes gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install gcc success" fi g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install g++" require_sudoer "sudo apt-get install -y --force-yes g++" - sudo apt-get install -y --force-yes g++ + sudo apt-get install -y --force-yes g++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install g++ success" fi make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install make" require_sudoer "sudo apt-get install -y --force-yes make" - sudo apt-get install -y --force-yes make + sudo apt-get install -y --force-yes make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install make success" fi autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install autoconf" require_sudoer "sudo apt-get install -y --force-yes autoconf" - sudo apt-get install -y --force-yes autoconf + sudo apt-get install -y --force-yes autoconf; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install autoconf success" fi libtool --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install libtool" require_sudoer "sudo apt-get install -y --force-yes libtool" - sudo apt-get install -y --force-yes libtool + sudo apt-get install -y --force-yes libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install libtool success" fi if [[ ! -f /usr/include/pcre.h ]]; then echo "install libpcre3-dev" require_sudoer "sudo apt-get install -y --force-yes libpcre3-dev" - sudo apt-get install -y --force-yes libpcre3-dev + sudo apt-get install -y --force-yes libpcre3-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install libpcre3-dev success" fi if [[ ! -f /usr/include/zlib.h ]]; then echo "install zlib1g-dev" require_sudoer "sudo apt-get install -y --force-yes zlib1g-dev" - sudo apt-get install -y --force-yes zlib1g-dev + sudo apt-get install -y --force-yes zlib1g-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install zlib1g-dev success" fi if [[ ! -d /usr/include/freetype2 ]]; then echo "install libfreetype6-dev" require_sudoer "sudo apt-get install -y --force-yes libfreetype6-dev" - sudo apt-get install -y --force-yes libfreetype6-dev + sudo apt-get install -y --force-yes libfreetype6-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install libfreetype6-dev success" fi + # for arm, install the cross build tool chain. + if [ $SRS_ARM_UBUNTU12 = YES ]; then + arm-linux-gnueabi-gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then + echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi" + require_sudoer "sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi" + sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi + echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi success" + fi + fi + echo "Ubuntu install tools success" + return 0 } -Ubuntu_prepare +Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu perfapre failed, ret=$ret"; exit $ret; fi ##################################################################################### # for Centos, auto install tools by yum ##################################################################################### function Centos_prepare() { if [[ ! -f /etc/redhat-release ]]; then - return; + return 0; fi echo "Centos detected, install tools if needed" @@ -111,83 +123,111 @@ function Centos_prepare() gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install gcc" require_sudoer "sudo yum install -y gcc" - sudo yum install -y gcc + sudo yum install -y gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install gcc success" fi g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install gcc-c++" require_sudoer "sudo yum install -y gcc-c++" - sudo yum install -y gcc-c++ + sudo yum install -y gcc-c++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install gcc-c++ success" fi make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install make" require_sudoer "sudo yum install -y make" - sudo yum install -y make + sudo yum install -y make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install make success" fi automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install automake" require_sudoer "sudo yum install -y automake" - sudo yum install -y automake + sudo yum install -y automake; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install automake success" fi autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install autoconf" require_sudoer "sudo yum install -y autoconf" - sudo yum install -y autoconf + sudo yum install -y autoconf; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install autoconf success" fi libtool --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "install libtool" require_sudoer "sudo yum install -y libtool" - sudo yum install -y libtool + sudo yum install -y libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install libtool success" fi if [[ ! -f /usr/include/pcre.h ]]; then echo "install pcre-devel" require_sudoer "sudo yum install -y pcre-devel" - sudo yum install -y pcre-devel + sudo yum install -y pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install pcre-devel success" fi if [[ ! -f /usr/include/zlib.h ]]; then echo "install zlib-devel" require_sudoer "sudo yum install -y zlib-devel" - sudo yum install -y zlib-devel + sudo yum install -y zlib-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install zlib-devel success" fi if [[ ! -d /usr/include/freetype2 ]]; then echo "install freetype-devel" require_sudoer "sudo yum install -y freetype-devel" - sudo yum install -y freetype-devel + sudo yum install -y freetype-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi echo "install freetype-devel success" fi + # for arm, install the cross build tool chain. + if [ $SRS_ARM_UBUNTU12 = YES ]; then + echo "arm-ubuntu12 is invalid for CentOS" + return 1 + fi + echo "Centos install tools success" + return 0 } -Centos_prepare +Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then "CentOS perfapre failed, ret=$ret"; exit $ret; fi ##################################################################################### # st-1.9 ##################################################################################### -if [[ -f ${SRS_OBJS}/st-1.9/obj/libst.a && -f ${SRS_OBJS}/st-1.9/obj/libst.so ]]; then - echo "st-1.9t is ok."; +# check the arm flag file, if flag changed, need to rebuild the st. +if [ $SRS_ARM_UBUNTU12 = 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-1.9/obj/libst.a && -f ${SRS_OBJS}/st-1.9/obj/libst.so ]]; 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/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 && + make CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} linux-debug && + cd .. && rm -f st && ln -sf st-1.9/obj st && + cd .. && touch ${SRS_OBJS}/_flag.st.arm.tmp + ) + fi 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 && - make linux-debug && - cd .. && rm -f st && ln -sf st-1.9/obj st - ) + # arm not specified, if exists flag, need to rebuild for no-arm platform. + if [[ ! -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st-1.9/obj/libst.a && -f ${SRS_OBJS}/st-1.9/obj/libst.so ]]; 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 && + make linux-debug && + cd .. && rm -f 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 @@ -230,48 +270,50 @@ function write_nginx_html5() END } -if [ $SRS_HLS = YES ]; then - if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then - echo "nginx-1.5.7 is ok."; - else - echo "build nginx-1.5.7"; - ( - rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} && - unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 && - ./configure --prefix=`pwd`/_release && make ${SRS_JOBS} && make install && - cd .. && ln -sf nginx-1.5.7/_release nginx - ) - fi - # check status - ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi - if [ ! -f ${SRS_OBJS}/nginx/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi +if [ $SRS_ARM_UBUNTU12 = NO ]; then + if [ $SRS_HLS = YES ]; then + if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then + echo "nginx-1.5.7 is ok."; + else + echo "build nginx-1.5.7"; + ( + rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} && + unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 && + ./configure --prefix=`pwd`/_release && make ${SRS_JOBS} && make install && + cd .. && ln -sf nginx-1.5.7/_release nginx + ) + fi + # check status + ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi + if [ ! -f ${SRS_OBJS}/nginx/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi - # use current user to config nginx, - # srs will write ts/m3u8 file use current user, - # nginx default use nobody, so cannot read the ts/m3u8 created by srs. - cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk - sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf - - # 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/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 - - # nginx.html to detect whether nginx is alive - echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html + # use current user to config nginx, + # srs will write ts/m3u8 file use current user, + # nginx default use nobody, so cannot read the ts/m3u8 created by srs. + cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk + sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf + + # 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/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 + + # nginx.html to detect whether nginx is alive + echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html + fi fi if [ $SRS_HLS = YES ]; then @@ -320,28 +362,30 @@ ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/forwa # only when the nginx is ok, # if api-server not enalbed, use nginx as demo. -if [ $SRS_HLS = YES ]; then - if [ $SRS_HTTP_CALLBACK = YES ]; then - # override the default index. - rm -f ${SRS_OBJS}/nginx/html/index.html && - ln -sf `pwd`/research/players/nginx_index.html ${SRS_OBJS}/nginx/html/index.html - else - rm -f ${SRS_OBJS}/nginx/html/index.html && - cat<> ${SRS_OBJS}/nginx/html/index.html - - - - SRS - - - - - +if [ $SRS_ARM_UBUNTU12 = NO ]; then + if [ $SRS_HLS = YES ]; then + if [ $SRS_HTTP_CALLBACK = YES ]; then + # override the default index. + rm -f ${SRS_OBJS}/nginx/html/index.html && + ln -sf `pwd`/research/players/nginx_index.html ${SRS_OBJS}/nginx/html/index.html + else + rm -f ${SRS_OBJS}/nginx/html/index.html && + cat<> ${SRS_OBJS}/nginx/html/index.html + + + + SRS + + + + + END + fi fi fi @@ -349,17 +393,37 @@ fi # openssl, for rtmp complex handshake ##################################################################################### if [ $SRS_SSL = YES ]; then - if [[ -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then - echo "openssl-1.0.1f is ok."; + # check the arm flag file, if flag changed, need to rebuild the st. + if [ $SRS_ARM_UBUNTU12 = YES ]; then + # ok, arm specified, if the flag filed does not exists, need to rebuild. + if [[ -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then + echo "openssl-1.0.1f for arm is ok."; + else + echo "build openssl-1.0.1f for arm"; + ( + rm -rf ${SRS_OBJS}/openssl-1.0.1f && cd ${SRS_OBJS} && + unzip -q ../3rdparty/openssl-1.0.1f.zip && cd openssl-1.0.1f && + ./Configure --prefix=`pwd`/_release -no-shared no-asm linux-armv4 && + make CC=${SrsArmCC} GCC=${SrsArmGCC} AR="${SrsArmAR} r" KD=${SrsArmLD} LINK=${SrsArmLINK} RANDLIB=${SrsArmRANDLIB} && make install && + cd .. && ln -sf openssl-1.0.1f/_release openssl && + cd .. && touch ${SRS_OBJS}/_flag.ssl.arm.tmp + ) + fi else - echo "build openssl-1.0.1f"; - ( - rm -rf ${SRS_OBJS}/openssl-1.0.1f && cd ${SRS_OBJS} && - unzip -q ../3rdparty/openssl-1.0.1f.zip && cd openssl-1.0.1f && - ./config --prefix=`pwd`/_release -no-shared && - make && make install && - cd .. && ln -sf openssl-1.0.1f/_release openssl - ) + # arm not specified, if exists flag, need to rebuild for no-arm platform. + if [[ ! -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then + echo "openssl-1.0.1f is ok."; + else + echo "build openssl-1.0.1f"; + ( + rm -rf ${SRS_OBJS}/openssl-1.0.1f && cd ${SRS_OBJS} && + unzip -q ../3rdparty/openssl-1.0.1f.zip && cd openssl-1.0.1f && + ./config --prefix=`pwd`/_release -no-shared && + make && make install && + cd .. && ln -sf openssl-1.0.1f/_release openssl && + cd .. && rm -f ${SRS_OBJS}/_flag.ssl.arm.tmp + ) + fi fi # check status ret=$?; if [[ $ret -ne 0 ]]; then echo "build openssl-1.0.1f failed, ret=$ret"; exit $ret; fi @@ -471,3 +535,12 @@ if [ $SRS_GPERF_CP = YES ]; then else echo "#undef SRS_GPERF_CP" >> $SRS_AUTO_HEADERS_H fi + +##################################################################################### +# for arm. +##################################################################################### +if [ $SRS_ARM_UBUNTU12 = YES ]; then + echo "#define SRS_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H +else + echo "#undef SRS_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H +fi diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index c5917afb6..9b3c48377 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -24,24 +24,10 @@ SRS_GPERF_MC=RESERVED # gperf memory check SRS_GPERF_MP=RESERVED # gperf memory profile SRS_GPERF_CP=RESERVED # gperf cpu profile SRS_GPROF=RESERVED # gprof +SRS_ARM_UBUNTU12=RESERVED # armhf(v7cpu) built on ubuntu12 # arguments SRS_JOBS=1 -# TODO: remove the default to yes. -SRS_HLS=YES -SRS_SSL=YES -SRS_FFMPEG=YES -SRS_HTTP_CALLBACK=YES -SRS_LIBRTMP=YES -SRS_BWTC=NO -SRS_RESEARCH=NO -SRS_UTEST=YES -SRS_GPERF=NO -SRS_GPERF_MC=NO -SRS_GPERF_MP=NO -SRS_GPERF_CP=NO -SRS_GPROF=NO - ##################################################################################### # parse options ##################################################################################### @@ -75,6 +61,7 @@ do --with-gmp) SRS_GPERF_MP=YES ;; --with-gcp) SRS_GPERF_CP=YES ;; --with-gprof) SRS_GPROF=YES ;; + --with-arm-ubuntu12) SRS_ARM_UBUNTU12=YES ;; --without-ssl) SRS_SSL=NO ;; --without-hls) SRS_HLS=NO ;; @@ -89,6 +76,7 @@ do --without-gmp) SRS_GPERF_MP=NO ;; --without-gcp) SRS_GPERF_CP=NO ;; --without-gprof) SRS_GPROF=NO ;; + --without-arm-ubuntu12) SRS_ARM_UBUNTU12=NO ;; --jobs) SRS_JOBS=${value} ;; @@ -99,6 +87,42 @@ do esac done +##################################################################################### +# apply the default value when user donot specified. +##################################################################################### +# if arm specified, set some default to disabled. +if [ $SRS_ARM_UBUNTU12 = YES ]; then + if [ $SRS_HLS = RESERVED ]; then SRS_HLS=NO; fi + if [ $SRS_SSL = RESERVED ]; then SRS_SSL=NO; fi + if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi + if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi + if [ $SRS_LIBRTMP = RESERVED ]; then SRS_LIBRTMP=NO; fi + if [ $SRS_BWTC = RESERVED ]; then SRS_BWTC=NO; fi + if [ $SRS_RESEARCH = RESERVED ]; then SRS_RESEARCH=NO; fi + if [ $SRS_UTEST = RESERVED ]; then SRS_UTEST=NO; fi + if [ $SRS_GPERF = RESERVED ]; then SRS_GPERF=NO; fi + if [ $SRS_GPERF_MC = RESERVED ]; then SRS_GPERF_MC=NO; fi + if [ $SRS_GPERF_MP = RESERVED ]; then SRS_GPERF_MP=NO; fi + if [ $SRS_GPERF_CP = RESERVED ]; then SRS_GPERF_CP=NO; fi + if [ $SRS_GPROF = RESERVED ]; then SRS_GPROF=NO; fi + if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then SRS_ARM_UBUNTU12=NO; fi +else + if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi + if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi + if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=YES; fi + if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=YES; fi + if [ $SRS_LIBRTMP = RESERVED ]; then SRS_LIBRTMP=YES; fi + if [ $SRS_BWTC = RESERVED ]; then SRS_BWTC=NO; fi + if [ $SRS_RESEARCH = RESERVED ]; then SRS_RESEARCH=NO; fi + if [ $SRS_UTEST = RESERVED ]; then SRS_UTEST=YES; fi + if [ $SRS_GPERF = RESERVED ]; then SRS_GPERF=NO; fi + if [ $SRS_GPERF_MC = RESERVED ]; then SRS_GPERF_MC=NO; fi + if [ $SRS_GPERF_MP = RESERVED ]; then SRS_GPERF_MP=NO; fi + if [ $SRS_GPERF_CP = RESERVED ]; then SRS_GPERF_CP=NO; fi + if [ $SRS_GPROF = RESERVED ]; then SRS_GPROF=NO; fi + if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then SRS_ARM_UBUNTU12=NO; fi +fi + # parse the jobs for make if [[ "" -eq SRS_JOBS ]]; then export SRS_JOBS="--jobs" @@ -120,7 +144,7 @@ if [ $help = yes ]; then --with-ssl enable rtmp complex handshake, requires openssl-devel installed. to delivery h264 video and aac audio to flash player. --with-hls enable hls streaming, build nginx as http server for hls. - --with-http-callback enable http hooks, build cherrypy as demo api server. + --with-http-callback enable http hooks, build cherrypy as demo api server. srs will call the http hooks, such as: on_connect. --with-ffmpeg enable transcoding with ffmpeg. --with-librtmp enable srs-librtmp, library for client. @@ -132,10 +156,11 @@ if [ $help = yes ]; then --with-gmp build memory profile for srs with gperf tools. --with-gcp build cpu profile for srs with gperf tools. --with-gprof build srs with gprof(GNU profile tool). + --with-arm-ubuntu12 build srs on ubuntu12 for armhf(v7cpu). --without-ssl disable rtmp complex handshake. --without-hls disable hls, rtmp streaming only. - --without-http-callback disable http, http hooks callback. + --without-http-callback disable http, http hooks callback. --without-ffmpeg disable the ffmpeg transcoding feature. --without-librtmp disable srs-librtmp, library for client. --without-bwtc disable srs bandwidth test client tool. @@ -146,6 +171,7 @@ if [ $help = yes ]; then --without-gmp do not build memory profile for srs with gperf tools. --without-gcp do not build cpu profile for srs with gperf tools. --without-gprof do not build srs with gprof(GNU profile tool). + --without-arm-ubuntu12 do not build srs on ubuntu12 for armhf(v7cpu). --jobs[=N] Allow N jobs at once; infinite jobs with no arg. used for make in the configure, for example, to make ffmpeg. @@ -181,6 +207,21 @@ if [ $__gperf_slow = YES ]; then if [ $SRS_GPROF = YES ]; then echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help"; __check_ok=NO; fi fi +# check arm, if arm enabled, only allow st/ssl/librtmp, +# user should disable all other features +if [ $SRS_ARM_UBUNTU12 = YES ]; then + if [ $SRS_FFMPEG = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_HTTP_CALLBACK = YES ]; then echo "http-callback for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_BWTC = YES ]; then echo "bwtc for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_UTEST = YES ]; then echo "utest for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_GPERF = YES ]; then echo "gperf for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_GPERF_MC = YES ]; then echo "gmc for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_GPERF_MP = YES ]; then echo "gmp for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_GPERF_CP = YES ]; then echo "gcp for arm is not available, see: ./configure --help"; __check_ok=NO; fi + if [ $SRS_GPROF = YES ]; then echo "gprof for arm is not available, see: ./configure --help"; __check_ok=NO; fi +fi + # check variable neccessary if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi @@ -195,6 +236,7 @@ if [ $SRS_GPERF_MC = RESERVED ]; then echo "you must specifies the gperf-mc, see if [ $SRS_GPERF_MP = RESERVED ]; then echo "you must specifies the gperf-mp, see: ./configure --help"; __check_ok=NO; fi if [ $SRS_GPERF_CP = RESERVED ]; then echo "you must specifies the gperf-cp, see: ./configure --help"; __check_ok=NO; fi if [ $SRS_GPROF = RESERVED ]; then echo "you must specifies the gprof, see: ./configure --help"; __check_ok=NO; fi +if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then echo "you must specifies the arm-ubuntu12, see: ./configure --help"; __check_ok=NO; fi if [ $__check_ok = NO ]; then exit 1; fi @@ -214,5 +256,6 @@ if [ $SRS_GPERF_MC = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-gmc"; el if [ $SRS_GPERF_MP = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-gmp"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-gmp"; fi if [ $SRS_GPERF_CP = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-gcp"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-gcp"; fi if [ $SRS_GPROF = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-gprof"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-gprof"; fi +if [ $SRS_ARM_UBUNTU12 = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-arm-ubuntu12"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-arm-ubuntu12"; fi SRS_CONFIGURE="${SRS_CONFIGURE} ${SRS_JOBS}" echo "regenerate config: ${SRS_CONFIGURE}" diff --git a/trunk/configure b/trunk/configure index ebaa85150..8c6e97cb3 100755 --- a/trunk/configure +++ b/trunk/configure @@ -37,6 +37,15 @@ echo "#define SRS_CONFIGURE \"${SRS_CONFIGURE}\"" > $SRS_AUTO_HEADERS_H echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H +# the arm-ubuntu12 options for make for depends +SrsArmCC="arm-linux-gnueabi-gcc" +SrsArmGCC="arm-linux-gnueabi-gcc" +SrsArmCXX="arm-linux-gnueabi-g++" +SrsArmLINK="arm-linux-gnueabi-g++" +SrsArmAR="arm-linux-gnueabi-ar" +SrsArmLD="arm-linux-gnueabi-ld" +SrsArmRANDLIB="arm-linux-gnueabi-ranlib" + # apply user options. . auto/depends.sh @@ -247,12 +256,25 @@ SrsGperf=""; SrsGperfLink=""; if [ $SRS_GPERF = YES ]; then SrsGperfLink=" -lpth # the cxx flag generated. CXXFLAGS="${CppStd}${WarnLevel}${GDBDebug}${LibraryCompile}${SrsGprof}" if [ $SRS_GPERF = YES ]; then CXXFLAGS="${CXXFLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"; fi -cat << END > ${SRS_OBJS}/${SRS_MAKEFILE} -CC ?= gcc -GCC ?= gcc -CXX ?= g++ -AR ?= ar -LINK ?= g++ +# arm or i386/x86_64 +if [ $SRS_ARM_UBUNTU12 = YES ]; then + cat << END > ${SRS_OBJS}/${SRS_MAKEFILE} +CC = ${SrsArmCC} +GCC = ${SrsArmGCC} +CXX = ${SrsArmCXX} +AR = ${SrsArmAR} +LINK = ${SrsArmLINK} +END +else + cat << END > ${SRS_OBJS}/${SRS_MAKEFILE} +CC = gcc +GCC = gcc +CXX = g++ +AR = ar +LINK = g++ +END +fi +cat << END >> ${SRS_OBJS}/${SRS_MAKEFILE} CXXFLAGS = ${CXXFLAGS} .PHONY: default srs bandwidth librtmp @@ -277,6 +299,8 @@ if [ $SRS_SSL = YES ]; then LibSSLRoot="${SRS_OBJS}/openssl/include"; LibSSLfile # gperftools-2.1, for mem check and mem/cpu profile LibGperfRoot=""; LibGperfFile="" if [ $SRS_GPERF = YES ]; then LibGperfRoot="${SRS_OBJS}/gperf/include"; LibGperfFile="${SRS_OBJS}/gperf/lib/libtcmalloc_and_profiler.a"; fi +# the link options, if arm, use static link +SrsLinkOptions="-ldl"; if [ $SRS_ARM_UBUNTU12 = YES ]; then SrsLinkOptions="-ldl -static"; fi ##################################################################################### # Modules, compile each module, then link to binary @@ -344,7 +368,7 @@ MAIN_ENTRANCES=("srs_main_server" "srs_main_bandcheck") ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile}) # all depends objects MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}" -LINK_OPTIONS="-ldl${SrsGprofLink}${SrsGperfLink}" +LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}" # # srs: # srs(simple rtmp server) over st(state-threads) @@ -447,6 +471,11 @@ if [ $SRS_GPROF = YES ]; then else echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}" fi +if [ $SRS_ARM_UBUNTU12 = YES ]; then + echo -e "${GREEN}arm-ubuntu12(armhf, v7cpu) for srs are builded${BLACK}" +else + echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}" +fi ##################################################################################### # next step diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index b7312227e..fa2a7d812 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 "0" #define VERSION_MINOR "9" -#define VERSION_REVISION "16" +#define VERSION_REVISION "17" #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION // server info. #define RTMP_SIG_SRS_KEY "srs"