winlin

Merge branch '2.0release' into develop

@@ -67,7 +67,7 @@ if [[ -z $SrsArmAR ]]; then SrsArmAR=$__SrsArmAR; fi @@ -67,7 +67,7 @@ if [[ -z $SrsArmAR ]]; then SrsArmAR=$__SrsArmAR; fi
67 if [[ -z $SrsArmLD ]]; then SrsArmLD=$__SrsArmLD; fi 67 if [[ -z $SrsArmLD ]]; then SrsArmLD=$__SrsArmLD; fi
68 if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB=$__SrsArmRANDLIB; fi 68 if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB=$__SrsArmRANDLIB; fi
69 # write to source file 69 # write to source file
70 -if [ $SRS_EMBEDED_CPU = YES ]; then 70 +if [ $SRS_CROSS_BUILD = YES ]; then
71 echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" 71 echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB"
72 echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H 72 echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H
73 else 73 else
@@ -206,7 +206,7 @@ fi @@ -206,7 +206,7 @@ fi
206 ##################################################################################### 206 #####################################################################################
207 # for embeded. 207 # for embeded.
208 ##################################################################################### 208 #####################################################################################
209 -if [ $SRS_EMBEDED_CPU = YES ]; then 209 +if [ $SRS_CROSS_BUILD = YES ]; then
210 echo "#define SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H 210 echo "#define SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
211 else 211 else
212 echo "#undef SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H 212 echo "#undef SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
@@ -148,7 +148,7 @@ function Centos_prepare() @@ -148,7 +148,7 @@ function Centos_prepare()
148 fi 148 fi
149 149
150 # for arm, install the cross build tool chain. 150 # for arm, install the cross build tool chain.
151 - if [ $SRS_EMBEDED_CPU = YES ]; then 151 + if [ $SRS_CROSS_BUILD = YES ]; then
152 echo "embeded(arm/mips) is invalid for CentOS" 152 echo "embeded(arm/mips) is invalid for CentOS"
153 return 1 153 return 1
154 fi 154 fi
@@ -253,7 +253,7 @@ function OSX_prepare() @@ -253,7 +253,7 @@ function OSX_prepare()
253 fi 253 fi
254 254
255 # for arm, install the cross build tool chain. 255 # for arm, install the cross build tool chain.
256 - if [ $SRS_EMBEDED_CPU = YES ]; then 256 + if [ $SRS_CROSS_BUILD = YES ]; then
257 echo "embeded(arm/mips) is invalid for OSX" 257 echo "embeded(arm/mips) is invalid for OSX"
258 return 1 258 return 1
259 fi 259 fi
@@ -362,12 +362,15 @@ fi @@ -362,12 +362,15 @@ fi
362 ##################################################################################### 362 #####################################################################################
363 # user must specifies something what a fuck, we suppport following os: 363 # user must specifies something what a fuck, we suppport following os:
364 # centos/ubuntu/osx, 364 # centos/ubuntu/osx,
365 -# embeded system, for example, mips or arm, 365 +# cross build for embeded system, for example, mips or arm,
  366 +# directly build on arm/mips, for example, pi or cubie,
366 # export srs-librtmp 367 # export srs-librtmp
367 # others is invalid. 368 # others is invalid.
368 -if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_EMBEDED_CPU = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then  
369 - echo "what a fuck, os not supported."  
370 - exit 1 369 +if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
  370 + if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then
  371 + echo "what a fuck, os not supported."
  372 + exit 1
  373 + fi
371 fi 374 fi
372 375
373 ##################################################################################### 376 #####################################################################################
@@ -382,7 +385,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -382,7 +385,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
382 fi 385 fi
383 # memory leak for linux-optimized 386 # memory leak for linux-optimized
384 # @see: https://github.com/simple-rtmp-server/srs/issues/197 387 # @see: https://github.com/simple-rtmp-server/srs/issues/197
385 - if [ $SRS_EMBEDED_CPU = YES ]; then 388 + if [ $SRS_CROSS_BUILD = YES ]; then
386 # ok, arm specified, if the flag filed does not exists, need to rebuild. 389 # ok, arm specified, if the flag filed does not exists, need to rebuild.
387 if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then 390 if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
388 echo "st-1.9t for arm is ok."; 391 echo "st-1.9t for arm is ok.";
@@ -409,6 +412,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -409,6 +412,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
409 ( 412 (
410 rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} && 413 rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
411 unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && chmod +w * && 414 unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && chmod +w * &&
  415 + patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
412 patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch && 416 patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch &&
413 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch && 417 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch &&
414 make ${_ST_MAKE} ${_ST_EXTRA_CFLAGS} && 418 make ${_ST_MAKE} ${_ST_EXTRA_CFLAGS} &&
@@ -428,7 +432,7 @@ fi @@ -428,7 +432,7 @@ fi
428 # check the arm flag file, if flag changed, need to rebuild the st. 432 # check the arm flag file, if flag changed, need to rebuild the st.
429 if [ $SRS_HTTP_CORE = YES ]; then 433 if [ $SRS_HTTP_CORE = YES ]; then
430 # ok, arm specified, if the flag filed does not exists, need to rebuild. 434 # ok, arm specified, if the flag filed does not exists, need to rebuild.
431 - if [ $SRS_EMBEDED_CPU = YES ]; then 435 + if [ $SRS_CROSS_BUILD = YES ]; then
432 if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then 436 if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
433 echo "http-parser-2.1 for arm is ok."; 437 echo "http-parser-2.1 for arm is ok.";
434 else 438 else
@@ -483,7 +487,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -483,7 +487,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
483 mkdir -p ${SRS_OBJS}/nginx 487 mkdir -p ${SRS_OBJS}/nginx
484 fi 488 fi
485 # make nginx 489 # make nginx
486 -__SRS_BUILD_NGINX=NO; if [ $SRS_EMBEDED_CPU = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi 490 +__SRS_BUILD_NGINX=NO; if [ $SRS_CROSS_BUILD = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi
487 if [ $__SRS_BUILD_NGINX = YES ]; then 491 if [ $__SRS_BUILD_NGINX = YES ]; then
488 if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then 492 if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then
489 echo "nginx-1.5.7 is ok."; 493 echo "nginx-1.5.7 is ok.";
@@ -595,7 +599,7 @@ fi @@ -595,7 +599,7 @@ fi
595 ##################################################################################### 599 #####################################################################################
596 # extra configure options 600 # extra configure options
597 CONFIGURE_TOOL="./config" 601 CONFIGURE_TOOL="./config"
598 -if [ $SRS_EMBEDED_CPU = YES ]; then 602 +if [ $SRS_CROSS_BUILD = YES ]; then
599 CONFIGURE_TOOL="./Configure linux-armv4" 603 CONFIGURE_TOOL="./Configure linux-armv4"
600 fi 604 fi
601 if [ $SRS_OSX = YES ]; then 605 if [ $SRS_OSX = YES ]; then
@@ -610,7 +614,7 @@ if [ $SRS_SSL = YES ]; then @@ -610,7 +614,7 @@ if [ $SRS_SSL = YES ]; then
610 echo "warning: donot compile ssl, use system ssl" 614 echo "warning: donot compile ssl, use system ssl"
611 else 615 else
612 # check the arm flag file, if flag changed, need to rebuild the st. 616 # check the arm flag file, if flag changed, need to rebuild the st.
613 - if [ $SRS_EMBEDED_CPU = YES ]; then 617 + if [ $SRS_CROSS_BUILD = YES ]; then
614 # ok, arm specified, if the flag filed does not exists, need to rebuild. 618 # ok, arm specified, if the flag filed does not exists, need to rebuild.
615 if [[ -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then 619 if [[ -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
616 echo "openssl-1.0.1f for arm is ok."; 620 echo "openssl-1.0.1f for arm is ok.";
@@ -27,4 +27,4 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then @@ -27,4 +27,4 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
27 _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/libs && mkdir -p ${_CPT} && cp src/libs/* ${_CPT} 27 _CPT=${SRS_EXPORT_LIBRTMP_PROJECT}/src/libs && mkdir -p ${_CPT} && cp src/libs/* ${_CPT}
28 # check ret 28 # check ret
29 ret=$?; if [[ $ret -ne 0 ]]; then echo "export src failed, ret=$ret"; exit $ret; fi 29 ret=$?; if [[ $ret -ne 0 ]]; then echo "export src failed, ret=$ret"; exit $ret; fi
30 -fi  
  30 +fi
@@ -101,9 +101,8 @@ SRS_DISABLE_ALL=NO @@ -101,9 +101,8 @@ SRS_DISABLE_ALL=NO
101 SRS_ENABLE_ALL=NO 101 SRS_ENABLE_ALL=NO
102 # 102 #
103 ################################################################ 103 ################################################################
104 -# calc  
105 -# whether embed cpu, arm/mips  
106 -SRS_EMBEDED_CPU=NO 104 +# whether cross build for embed cpu, arm/mips
  105 +SRS_CROSS_BUILD=NO
107 106
108 ##################################################################################### 107 #####################################################################################
109 # menu 108 # menu
@@ -374,10 +373,10 @@ function apply_user_presets() { @@ -374,10 +373,10 @@ function apply_user_presets() {
374 373
375 # whether embeded cpu. 374 # whether embeded cpu.
376 if [ $SRS_ARM_UBUNTU12 = YES ]; then 375 if [ $SRS_ARM_UBUNTU12 = YES ]; then
377 - SRS_EMBEDED_CPU=YES 376 + SRS_CROSS_BUILD=YES
378 fi 377 fi
379 if [ $SRS_MIPS_UBUNTU12 = YES ]; then 378 if [ $SRS_MIPS_UBUNTU12 = YES ]; then
380 - SRS_EMBEDED_CPU=YES 379 + SRS_CROSS_BUILD=YES
381 fi 380 fi
382 381
383 # all disabled. 382 # all disabled.
@@ -906,7 +905,7 @@ function check_option_conflicts() { @@ -906,7 +905,7 @@ function check_option_conflicts() {
906 905
907 # check embeded(arm/mips), if embeded enabled, only allow st/ssl/librtmp, 906 # check embeded(arm/mips), if embeded enabled, only allow st/ssl/librtmp,
908 # user should disable all other features 907 # user should disable all other features
909 - if [ $SRS_EMBEDED_CPU = YES ]; then 908 + if [ $SRS_CROSS_BUILD = YES ]; then
910 if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi 909 if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi
911 if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi 910 if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi
912 if [ $SRS_GPERF = YES ]; then echo "gperf for arm is not available, see: ./configure --help"; __check_ok=NO; fi 911 if [ $SRS_GPERF = YES ]; then echo "gperf for arm is not available, see: ./configure --help"; __check_ok=NO; fi
@@ -286,7 +286,7 @@ __REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX) @@ -286,7 +286,7 @@ __REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX)
286 END 286 END
287 287
288 # embeded, ubuntu12, use embeded tool chain. 288 # embeded, ubuntu12, use embeded tool chain.
289 -if [ $SRS_EMBEDED_CPU = YES ]; then 289 +if [ $SRS_CROSS_BUILD = YES ]; then
290 cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE} 290 cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
291 default: 291 default:
292 \$(MAKE) GCC=${SrsArmGCC} CXX=${SrsArmCXX} AR=${SrsArmAR} LINK=${SrsArmCXX} _default 292 \$(MAKE) GCC=${SrsArmGCC} CXX=${SrsArmCXX} AR=${SrsArmAR} LINK=${SrsArmCXX} _default