From 1117f78587e67f557309443721101239ef5d1af2 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 4 Apr 2014 11:36:22 +0800 Subject: [PATCH] support arm build for http api and server --- trunk/auto/depends.sh | 46 ++++++++++++++++++++++++++++++++----------- trunk/auto/options.sh | 17 +++++++++------- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 9b423ad24..400f71aaf 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -242,20 +242,42 @@ if [ ! -f ${SRS_OBJS}/st/libst.so ]; then echo "build st-1.9 failed."; exit -1; ##################################################################################### # http-parser-2.1 ##################################################################################### +# check the arm flag file, if flag changed, need to rebuild the st. if [ $SRS_HTTP_PARSER = YES ]; then - if [[ -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then - echo "http-parser-2.1 is ok."; + # ok, arm specified, if the flag filed does not exists, need to rebuild. + if [ $SRS_ARM_UBUNTU12 = YES ]; then + if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then + echo "http-parser-2.1 for arm is ok."; + else + echo "build http-parser-2.1 for arm"; + ( + rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && + cd http-parser-2.1 && + sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile && + sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile && + make CC=${SrsArmCC} AR=${SrsArmAR} package && + cd .. && rm -rf hp && ln -sf http-parser-2.1 hp && + cd .. && touch ${SRS_OBJS}/_flag.st.hp.tmp + ) + fi else - echo "build http-parser-2.1"; - ( - rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && - cd http-parser-2.1 && - sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile && - sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile && - make package && - cd .. && rm -rf hp && ln -sf http-parser-2.1 hp - ) + # arm not specified, if exists flag, need to rebuild for no-arm platform. + if [[ ! -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then + echo "http-parser-2.1 is ok."; + else + echo "build http-parser-2.1"; + ( + rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && + cd http-parser-2.1 && + sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile && + sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile && + make package && + cd .. && rm -rf hp && ln -sf http-parser-2.1 hp && + cd .. && rm -f ${SRS_OBJS}/_flag.st.hp.tmp + ) + fi fi + # check status ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi if [[ ! -f ${SRS_OBJS}/hp/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi @@ -581,7 +603,7 @@ echo "" >> $SRS_AUTO_HEADERS_H ##################################################################################### # generated the contributors from AUTHORS.txt ##################################################################################### -SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '* ' '{print $2}'` +SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '\* ' '{print $2}'` echo "#define SRS_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 2f348bdad..0e54c8563 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -97,11 +97,13 @@ do --without-gcp) SRS_GPERF_CP=NO ;; --without-gprof) SRS_GPROF=NO ;; --without-arm-ubuntu12) SRS_ARM_UBUNTU12=NO ;; - + --jobs) SRS_JOBS=${value} ;; --prefix) SRS_PREFIX=${value} ;; --static) SRS_STATIC=YES ;; + --dev) SRS_DEV=YES ;; + --arm) SRS_ARM_UBUNTU12=YES ;; --pi) SRS_PI=YES ;; *) @@ -116,13 +118,13 @@ done ##################################################################################### # 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_HLS = RESERVED ]; then SRS_HLS=YES; fi if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi - if [ $SRS_SSL = RESERVED ]; then SRS_SSL=NO; fi + if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi - if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=NO; fi - if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=NO; fi + if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=YES; fi + if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=YES; 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 @@ -143,8 +145,8 @@ else if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi - if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=NO; fi - if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=NO; fi + if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=YES; fi + if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=YES; 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 @@ -270,6 +272,7 @@ if [ $help = yes ]; then --prefix= the absolute install path for srs. --dev for dev, open all features, no gperf/gprof/arm. --pi for raspberry-pi(directly build), open features hls/ssl/static. + --arm alias for --with-arm-ubuntu12 END exit 0