winlin

support arm build for http api and server

@@ -242,8 +242,27 @@ if [ ! -f ${SRS_OBJS}/st/libst.so ]; then echo "build st-1.9 failed."; exit -1; @@ -242,8 +242,27 @@ if [ ! -f ${SRS_OBJS}/st/libst.so ]; then echo "build st-1.9 failed."; exit -1;
242 ##################################################################################### 242 #####################################################################################
243 # http-parser-2.1 243 # http-parser-2.1
244 ##################################################################################### 244 #####################################################################################
  245 +# check the arm flag file, if flag changed, need to rebuild the st.
245 if [ $SRS_HTTP_PARSER = YES ]; then 246 if [ $SRS_HTTP_PARSER = YES ]; then
246 - if [[ -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then 247 + # ok, arm specified, if the flag filed does not exists, need to rebuild.
  248 + if [ $SRS_ARM_UBUNTU12 = YES ]; then
  249 + if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
  250 + echo "http-parser-2.1 for arm is ok.";
  251 + else
  252 + echo "build http-parser-2.1 for arm";
  253 + (
  254 + rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
  255 + cd http-parser-2.1 &&
  256 + sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&
  257 + sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&
  258 + make CC=${SrsArmCC} AR=${SrsArmAR} package &&
  259 + cd .. && rm -rf hp && ln -sf http-parser-2.1 hp &&
  260 + cd .. && touch ${SRS_OBJS}/_flag.st.hp.tmp
  261 + )
  262 + fi
  263 + else
  264 + # arm not specified, if exists flag, need to rebuild for no-arm platform.
  265 + if [[ ! -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
247 echo "http-parser-2.1 is ok."; 266 echo "http-parser-2.1 is ok.";
248 else 267 else
249 echo "build http-parser-2.1"; 268 echo "build http-parser-2.1";
@@ -253,9 +272,12 @@ if [ $SRS_HTTP_PARSER = YES ]; then @@ -253,9 +272,12 @@ if [ $SRS_HTTP_PARSER = YES ]; then
253 sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile && 272 sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&
254 sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile && 273 sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&
255 make package && 274 make package &&
256 - cd .. && rm -rf hp && ln -sf http-parser-2.1 hp 275 + cd .. && rm -rf hp && ln -sf http-parser-2.1 hp &&
  276 + cd .. && rm -f ${SRS_OBJS}/_flag.st.hp.tmp
257 ) 277 )
258 fi 278 fi
  279 + fi
  280 +
259 # check status 281 # check status
260 ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi 282 ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi
261 if [[ ! -f ${SRS_OBJS}/hp/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi 283 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 @@ -581,7 +603,7 @@ echo "" >> $SRS_AUTO_HEADERS_H
581 ##################################################################################### 603 #####################################################################################
582 # generated the contributors from AUTHORS.txt 604 # generated the contributors from AUTHORS.txt
583 ##################################################################################### 605 #####################################################################################
584 -SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '* ' '{print $2}'` 606 +SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '\* ' '{print $2}'`
585 echo "#define SRS_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H 607 echo "#define SRS_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H
586 for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do 608 for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do
587 echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H 609 echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
@@ -101,7 +101,9 @@ do @@ -101,7 +101,9 @@ do
101 --jobs) SRS_JOBS=${value} ;; 101 --jobs) SRS_JOBS=${value} ;;
102 --prefix) SRS_PREFIX=${value} ;; 102 --prefix) SRS_PREFIX=${value} ;;
103 --static) SRS_STATIC=YES ;; 103 --static) SRS_STATIC=YES ;;
  104 +
104 --dev) SRS_DEV=YES ;; 105 --dev) SRS_DEV=YES ;;
  106 + --arm) SRS_ARM_UBUNTU12=YES ;;
105 --pi) SRS_PI=YES ;; 107 --pi) SRS_PI=YES ;;
106 108
107 *) 109 *)
@@ -116,13 +118,13 @@ done @@ -116,13 +118,13 @@ done
116 ##################################################################################### 118 #####################################################################################
117 # if arm specified, set some default to disabled. 119 # if arm specified, set some default to disabled.
118 if [ $SRS_ARM_UBUNTU12 = YES ]; then 120 if [ $SRS_ARM_UBUNTU12 = YES ]; then
119 - if [ $SRS_HLS = RESERVED ]; then SRS_HLS=NO; fi 121 + if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi
120 if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi 122 if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi
121 - if [ $SRS_SSL = RESERVED ]; then SRS_SSL=NO; fi 123 + if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi
122 if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi 124 if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi
123 if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi 125 if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi
124 - if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=NO; fi  
125 - if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=NO; fi 126 + if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=YES; fi
  127 + if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=YES; fi
126 if [ $SRS_LIBRTMP = RESERVED ]; then SRS_LIBRTMP=NO; fi 128 if [ $SRS_LIBRTMP = RESERVED ]; then SRS_LIBRTMP=NO; fi
127 if [ $SRS_BWTC = RESERVED ]; then SRS_BWTC=NO; fi 129 if [ $SRS_BWTC = RESERVED ]; then SRS_BWTC=NO; fi
128 if [ $SRS_RESEARCH = RESERVED ]; then SRS_RESEARCH=NO; fi 130 if [ $SRS_RESEARCH = RESERVED ]; then SRS_RESEARCH=NO; fi
@@ -143,8 +145,8 @@ else @@ -143,8 +145,8 @@ else
143 if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi 145 if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi
144 if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi 146 if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi
145 if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi 147 if [ $SRS_HTTP_CALLBACK = RESERVED ]; then SRS_HTTP_CALLBACK=NO; fi
146 - if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=NO; fi  
147 - if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=NO; fi 148 + if [ $SRS_HTTP_SERVER = RESERVED ]; then SRS_HTTP_SERVER=YES; fi
  149 + if [ $SRS_HTTP_API = RESERVED ]; then SRS_HTTP_API=YES; fi
148 if [ $SRS_LIBRTMP = RESERVED ]; then SRS_LIBRTMP=NO; fi 150 if [ $SRS_LIBRTMP = RESERVED ]; then SRS_LIBRTMP=NO; fi
149 if [ $SRS_BWTC = RESERVED ]; then SRS_BWTC=NO; fi 151 if [ $SRS_BWTC = RESERVED ]; then SRS_BWTC=NO; fi
150 if [ $SRS_RESEARCH = RESERVED ]; then SRS_RESEARCH=NO; fi 152 if [ $SRS_RESEARCH = RESERVED ]; then SRS_RESEARCH=NO; fi
@@ -270,6 +272,7 @@ if [ $help = yes ]; then @@ -270,6 +272,7 @@ if [ $help = yes ]; then
270 --prefix=<path> the absolute install path for srs. 272 --prefix=<path> the absolute install path for srs.
271 --dev for dev, open all features, no gperf/gprof/arm. 273 --dev for dev, open all features, no gperf/gprof/arm.
272 --pi for raspberry-pi(directly build), open features hls/ssl/static. 274 --pi for raspberry-pi(directly build), open features hls/ssl/static.
  275 + --arm alias for --with-arm-ubuntu12
273 276
274 END 277 END
275 exit 0 278 exit 0