winlin

refine code for cross build

@@ -42,7 +42,7 @@ function Ubuntu_prepare() @@ -42,7 +42,7 @@ function Ubuntu_prepare()
42 fi 42 fi
43 fi 43 fi
44 44
45 - # for arm, install the cross build tool chain. 45 + # cross build for arm, install the cross build tool chain.
46 if [ $SRS_ARM_UBUNTU12 = YES ]; then 46 if [ $SRS_ARM_UBUNTU12 = YES ]; then
47 $SrsArmCC --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then 47 $SrsArmCC --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
48 echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi" 48 echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi"
@@ -52,7 +52,7 @@ function Ubuntu_prepare() @@ -52,7 +52,7 @@ function Ubuntu_prepare()
52 fi 52 fi
53 fi 53 fi
54 54
55 - # for mips, user must installed the tool chain. 55 + # cross build for mips, user must installed the tool chain.
56 if [ $SRS_MIPS_UBUNTU12 = YES ]; then 56 if [ $SRS_MIPS_UBUNTU12 = YES ]; then
57 $SrsArmCC --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then 57 $SrsArmCC --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
58 echo "user must install the tool chain: $SrsArmCC" 58 echo "user must install the tool chain: $SrsArmCC"
@@ -147,7 +147,7 @@ function Centos_prepare() @@ -147,7 +147,7 @@ function Centos_prepare()
147 return 0; 147 return 0;
148 fi 148 fi
149 149
150 - # for arm, install the cross build tool chain. 150 + # cross build for arm, install the cross build tool chain.
151 if [ $SRS_CROSS_BUILD = 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
@@ -252,7 +252,7 @@ function OSX_prepare() @@ -252,7 +252,7 @@ function OSX_prepare()
252 return 0; 252 return 0;
253 fi 253 fi
254 254
255 - # for arm, install the cross build tool chain. 255 + # cross build for arm, install the cross build tool chain.
256 if [ $SRS_CROSS_BUILD = 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
@@ -377,7 +377,7 @@ fi @@ -377,7 +377,7 @@ fi
377 # st-1.9 377 # st-1.9
378 ##################################################################################### 378 #####################################################################################
379 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then 379 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
380 - # check the arm flag file, if flag changed, need to rebuild the st. 380 + # check the cross build flag file, if flag changed, need to rebuild the st.
381 _ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="EXTRA_CFLAGS=-DMD_HAVE_EPOLL" 381 _ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="EXTRA_CFLAGS=-DMD_HAVE_EPOLL"
382 # for osx, use darwin for st, donot use epoll. 382 # for osx, use darwin for st, donot use epoll.
383 if [ $OS_IS_OSX = YES ]; then 383 if [ $OS_IS_OSX = YES ]; then
@@ -387,7 +387,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -387,7 +387,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
387 # @see: https://github.com/simple-rtmp-server/srs/issues/197 387 # @see: https://github.com/simple-rtmp-server/srs/issues/197
388 if [ $SRS_CROSS_BUILD = YES ]; then 388 if [ $SRS_CROSS_BUILD = YES ]; then
389 # 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.
390 - if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then 390 + if [[ -f ${SRS_OBJS}/_flag.st.cross.build.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
391 echo "st-1.9t for arm is ok."; 391 echo "st-1.9t for arm is ok.";
392 else 392 else
393 # TODO: FIXME: patch the bug. 393 # TODO: FIXME: patch the bug.
@@ -401,13 +401,14 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -401,13 +401,14 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
401 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch && 401 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch &&
402 make ${_ST_MAKE} CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} ${_ST_EXTRA_CFLAGS} && 402 make ${_ST_MAKE} CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} ${_ST_EXTRA_CFLAGS} &&
403 cd .. && rm -rf st && ln -sf st-1.9/obj st && 403 cd .. && rm -rf st && ln -sf st-1.9/obj st &&
404 - cd .. && touch ${SRS_OBJS}/_flag.st.arm.tmp 404 + cd .. && touch ${SRS_OBJS}/_flag.st.cross.build.tmp
405 ) 405 )
406 fi 406 fi
407 else 407 else
408 - if [[ ! -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then 408 + if [[ ! -f ${SRS_OBJS}/_flag.st.cross.build.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
409 echo "st-1.9t is ok."; 409 echo "st-1.9t is ok.";
410 else 410 else
  411 + # patch st for arm, @see: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SrsLinuxArm#st-arm-bug-fix
411 echo "build st-1.9t"; 412 echo "build st-1.9t";
412 ( 413 (
413 rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} && 414 rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
@@ -417,7 +418,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -417,7 +418,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
417 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch && 418 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch &&
418 make ${_ST_MAKE} ${_ST_EXTRA_CFLAGS} && 419 make ${_ST_MAKE} ${_ST_EXTRA_CFLAGS} &&
419 cd .. && rm -rf st && ln -sf st-1.9/obj st && 420 cd .. && rm -rf st && ln -sf st-1.9/obj st &&
420 - cd .. && rm -f ${SRS_OBJS}/_flag.st.arm.tmp 421 + cd .. && rm -f ${SRS_OBJS}/_flag.st.cross.build.tmp
421 ) 422 )
422 fi 423 fi
423 fi 424 fi
@@ -429,7 +430,7 @@ fi @@ -429,7 +430,7 @@ fi
429 ##################################################################################### 430 #####################################################################################
430 # http-parser-2.1 431 # http-parser-2.1
431 ##################################################################################### 432 #####################################################################################
432 -# check the arm flag file, if flag changed, need to rebuild the st. 433 +# check the cross build flag file, if flag changed, need to rebuild the st.
433 if [ $SRS_HTTP_CORE = YES ]; then 434 if [ $SRS_HTTP_CORE = YES ]; then
434 # ok, arm specified, if the flag filed does not exists, need to rebuild. 435 # ok, arm specified, if the flag filed does not exists, need to rebuild.
435 if [ $SRS_CROSS_BUILD = YES ]; then 436 if [ $SRS_CROSS_BUILD = YES ]; then
@@ -447,7 +448,7 @@ if [ $SRS_HTTP_CORE = YES ]; then @@ -447,7 +448,7 @@ if [ $SRS_HTTP_CORE = YES ]; then
447 ) 448 )
448 fi 449 fi
449 else 450 else
450 - # arm not specified, if exists flag, need to rebuild for no-arm platform. 451 + # cross build not specified, if exists flag, need to rebuild for no-arm platform.
451 if [[ ! -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then 452 if [[ ! -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
452 echo "http-parser-2.1 is ok."; 453 echo "http-parser-2.1 is ok.";
453 else 454 else
@@ -613,10 +614,10 @@ if [ $SRS_SSL = YES ]; then @@ -613,10 +614,10 @@ if [ $SRS_SSL = YES ]; then
613 if [ $SRS_USE_SYS_SSL = YES ]; then 614 if [ $SRS_USE_SYS_SSL = YES ]; then
614 echo "warning: donot compile ssl, use system ssl" 615 echo "warning: donot compile ssl, use system ssl"
615 else 616 else
616 - # check the arm flag file, if flag changed, need to rebuild the st. 617 + # check the cross build flag file, if flag changed, need to rebuild the st.
617 if [ $SRS_CROSS_BUILD = YES ]; then 618 if [ $SRS_CROSS_BUILD = YES ]; then
618 # ok, arm specified, if the flag filed does not exists, need to rebuild. 619 # ok, arm specified, if the flag filed does not exists, need to rebuild.
619 - if [[ -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then 620 + if [[ -f ${SRS_OBJS}/_flag.ssl.cross.build.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
620 echo "openssl-1.0.1f for arm is ok."; 621 echo "openssl-1.0.1f for arm is ok.";
621 else 622 else
622 echo "build openssl-1.0.1f for arm"; 623 echo "build openssl-1.0.1f for arm";
@@ -628,12 +629,12 @@ if [ $SRS_SSL = YES ]; then @@ -628,12 +629,12 @@ if [ $SRS_SSL = YES ]; then
628 LD=${SrsArmLD} LINK=${SrsArmGCC} RANDLIB=${SrsArmRANDLIB} && 629 LD=${SrsArmLD} LINK=${SrsArmGCC} RANDLIB=${SrsArmRANDLIB} &&
629 make install_sw && 630 make install_sw &&
630 cd .. && rm -rf openssl && ln -sf openssl-1.0.1f/_release openssl && 631 cd .. && rm -rf openssl && ln -sf openssl-1.0.1f/_release openssl &&
631 - cd .. && touch ${SRS_OBJS}/_flag.ssl.arm.tmp 632 + cd .. && touch ${SRS_OBJS}/_flag.ssl.cross.build.tmp
632 ) 633 )
633 fi 634 fi
634 else 635 else
635 - # arm not specified, if exists flag, need to rebuild for no-arm platform.  
636 - if [[ ! -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then 636 + # cross build not specified, if exists flag, need to rebuild for no-arm platform.
  637 + if [[ ! -f ${SRS_OBJS}/_flag.ssl.cross.build.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
637 echo "openssl-1.0.1f is ok."; 638 echo "openssl-1.0.1f is ok.";
638 else 639 else
639 echo "build openssl-1.0.1f"; 640 echo "build openssl-1.0.1f";
@@ -643,7 +644,7 @@ if [ $SRS_SSL = YES ]; then @@ -643,7 +644,7 @@ if [ $SRS_SSL = YES ]; then
643 $CONFIGURE_TOOL --prefix=`pwd`/_release -no-shared $OPENSSL_HOTFIX && 644 $CONFIGURE_TOOL --prefix=`pwd`/_release -no-shared $OPENSSL_HOTFIX &&
644 make && make install_sw && 645 make && make install_sw &&
645 cd .. && rm -rf openssl && ln -sf openssl-1.0.1f/_release openssl && 646 cd .. && rm -rf openssl && ln -sf openssl-1.0.1f/_release openssl &&
646 - cd .. && rm -f ${SRS_OBJS}/_flag.ssl.arm.tmp 647 + cd .. && rm -f ${SRS_OBJS}/_flag.ssl.cross.build.tmp
647 ) 648 )
648 fi 649 fi
649 fi 650 fi
@@ -138,7 +138,7 @@ Options: @@ -138,7 +138,7 @@ Options:
138 --with-gmp build memory profile for SRS with gperf tools. 138 --with-gmp build memory profile for SRS with gperf tools.
139 --with-gcp build cpu profile for SRS with gperf tools. 139 --with-gcp build cpu profile for SRS with gperf tools.
140 --with-gprof build SRS with gprof(GNU profile tool). 140 --with-gprof build SRS with gprof(GNU profile tool).
141 - --with-arm-ubuntu12 build SRS on ubuntu12 for armhf(v7cpu). 141 + --with-arm-ubuntu12 cross build SRS on ubuntu12 for armhf(v7cpu).
142 142
143 --without-ssl disable rtmp complex handshake. 143 --without-ssl disable rtmp complex handshake.
144 --without-hls disable hls, the apple http live streaming. 144 --without-hls disable hls, the apple http live streaming.
@@ -161,7 +161,7 @@ Options: @@ -161,7 +161,7 @@ Options:
161 --without-gmp do not build memory profile for SRS with gperf tools. 161 --without-gmp do not build memory profile for SRS with gperf tools.
162 --without-gcp do not build cpu profile for SRS with gperf tools. 162 --without-gcp do not build cpu profile for SRS with gperf tools.
163 --without-gprof do not build srs with gprof(GNU profile tool). 163 --without-gprof do not build srs with gprof(GNU profile tool).
164 - --without-arm-ubuntu12 do not build srs on ubuntu12 for armhf(v7cpu). 164 + --without-arm-ubuntu12 do not cross build srs on ubuntu12 for armhf(v7cpu).
165 165
166 --prefix=<path> the absolute install path for srs. 166 --prefix=<path> the absolute install path for srs.
167 --static whether add '-static' to link options. 167 --static whether add '-static' to link options.